diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..4f29a10053aa --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,29 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3/.devcontainer/base.Dockerfile + +# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6 +ARG VARIANT="3.9.0-buster" +FROM python:${VARIANT} + +# [Option] Install Node.js +ARG INSTALL_NODE="true" +ARG NODE_VERSION="lts/*" +RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. +# COPY requirements.txt /tmp/pip-tmp/ +# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ +# && rm -rf /tmp/pip-tmp + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 + + +RUN pip install -U https://github.com/platformio/platformio-core/archive/develop.zip +RUN platformio update +# To get the test platforms +RUN pip install PyYaml +#ENV PATH /code/buildroot/bin/:/code/buildroot/tests/:${PATH} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..54627d462b68 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,51 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3 +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + // Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9 + "VARIANT": "3.9.0-buster", + // Options + "INSTALL_NODE": "false", + "NODE_VERSION": "lts/*" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "python.pythonPath": "/usr/local/bin/python", + "python.languageServer": "Pylance", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "platformio.platformio-ide", + "marlinfirmware.auto-build", + "editorconfig.editorconfig" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "pip3 install --user -r requirements.txt", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" +} diff --git a/.gitignore b/.gitignore index 09db344257e7..a7f8a091aa4a 100755 --- a/.gitignore +++ b/.gitignore @@ -21,35 +21,18 @@ # Generated files _Version.h -bdf2u8g +bdf2u8g.exe +genpages.exe marlin_config.json mczip.h *.gen *.sublime-workspace -# # OS -# applet/ .DS_Store -# -# Misc -# -*~ -*.orig -*.rej -*.bak -*.idea -*.i -*.ii -*.swp -tags - -# -# C++ -# -# Compiled Object files +# Compiled C++ Object files *.slo *.lo *.o @@ -80,10 +63,7 @@ tags *.out *.app -# -# C -# -# Object files +# Compiled C Object files *.o *.ko *.obj @@ -143,13 +123,13 @@ vc-fileutils.settings .vscode/* !.vscode/extensions.json -#Simulation +# Simulation files imgui.ini eeprom.dat spi_flash.bin fs.img -#cmake +# CMake CMakeLists.txt src/CMakeLists.txt CMakeListsPrivate.txt @@ -170,3 +150,16 @@ __pycache__ # IOLogger logs *_log.csv + +# Misc. +*~ +*.orig +*.rej +*.bak +*.idea +*.i +*.ii +*.swp +tags +*.logs +*.bak diff --git a/Makefile b/Makefile index d0495dc7d863..2a18c0b4e829 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,16 @@ +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 + help: @echo "Tasks for local development:" @echo "* tests-single-ci: Run a single test from inside the CI" @echo "* tests-single-local: Run a single test locally" - @echo "* tests-single-local-docker: Run a single test locally, using docker-compose" + @echo "* tests-single-local-docker: Run a single test locally, using docker" @echo "* tests-all-local: Run all tests locally" - @echo "* tests-all-local-docker: Run all tests locally, using docker-compose" - @echo "* setup-local-docker: Setup local docker-compose" + @echo "* tests-all-local-docker: Run all tests locally, using docker" + @echo "* setup-local-docker: Build the local docker image" @echo "" @echo "Options for testing:" @echo " TEST_TARGET Set when running tests-single-*, to select the" @@ -34,19 +39,21 @@ 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 - docker-compose run --rm marlin $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)" + @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)" .PHONY: tests-single-local-docker tests-all-local: export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \ && export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \ - && for TEST_TARGET in $$(./get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done + && for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done .PHONY: tests-all-local tests-all-local-docker: - docker-compose run --rm marlin $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) + @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) .PHONY: tests-all-local-docker setup-local-docker: - docker-compose build + $(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile . .PHONY: setup-local-docker diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index edda1e5a8b34..33d98f49a2e0 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -274,7 +274,13 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one (or both) of the nozzles +// Switch extruders by bumping the toolhead. Requires EVENT_GCODE_TOOLCHANGE_#. +//#define MECHANICAL_SWITCHING_EXTRUDER + +/** + * A dual-nozzle that uses a servomotor to raise/lower one (or both) of the nozzles. + * Can be combined with SWITCHING_EXTRUDER. + */ //#define SWITCHING_NOZZLE #if ENABLED(SWITCHING_NOZZLE) #define SWITCHING_NOZZLE_SERVO_NR 0 @@ -283,6 +289,9 @@ #define SWITCHING_NOZZLE_SERVO_DWELL 2500 // Dwell time to wait for servo to make physical move #endif +// Switch nozzles by bumping the toolhead. Requires EVENT_GCODE_TOOLCHANGE_#. +//#define MECHANICAL_SWITCHING_NOZZLE + /** * Two separate X-carriages with extruders that connect to a moving part * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. @@ -686,6 +695,7 @@ * @section mpctemp */ #if ENABLED(MPCTEMP) + //#define MPC_AUTOTUNE // Include a method to do MPC auto-tuning (~5664-5882 bytes of flash) //#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1300 bytes of flash) //#define MPC_AUTOTUNE_MENU // Add MPC auto-tuning to the "Advanced Settings" menu. (~350 bytes of flash) @@ -1160,26 +1170,29 @@ //#define ENDSTOPPULLDOWN_ZMIN_PROBE #endif -// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). -#define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. -#define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. -#define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. -#define I_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define J_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define K_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define U_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define V_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define W_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define I_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define J_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define K_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define U_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define V_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Z_MIN_PROBE_ENDSTOP_INVERTING true // Set to true to invert the logic of the probe. +/** + * Endstop "Hit" State + * Set to the state (HIGH or LOW) that applies to each endstop. + */ +#define X_MIN_ENDSTOP_HIT_STATE LOW +#define X_MAX_ENDSTOP_HIT_STATE HIGH +#define Y_MIN_ENDSTOP_HIT_STATE LOW +#define Y_MAX_ENDSTOP_HIT_STATE HIGH +#define Z_MIN_ENDSTOP_HIT_STATE LOW +#define Z_MAX_ENDSTOP_HIT_STATE HIGH +#define I_MIN_ENDSTOP_HIT_STATE HIGH +#define I_MAX_ENDSTOP_HIT_STATE HIGH +#define J_MIN_ENDSTOP_HIT_STATE HIGH +#define J_MAX_ENDSTOP_HIT_STATE HIGH +#define K_MIN_ENDSTOP_HIT_STATE HIGH +#define K_MAX_ENDSTOP_HIT_STATE HIGH +#define U_MIN_ENDSTOP_HIT_STATE HIGH +#define U_MAX_ENDSTOP_HIT_STATE HIGH +#define V_MIN_ENDSTOP_HIT_STATE HIGH +#define V_MAX_ENDSTOP_HIT_STATE HIGH +#define W_MIN_ENDSTOP_HIT_STATE HIGH +#define W_MAX_ENDSTOP_HIT_STATE HIGH +#define Z_MIN_PROBE_ENDSTOP_HIT_STATE LOW // Enable this feature if all enabled endstop pins are interrupt-capable. // This will remove the need to poll the interrupt pins, saving many CPU cycles. @@ -1341,19 +1354,17 @@ /** * Z_MIN_PROBE_PIN * - * Define this pin if the probe is not connected to Z_MIN_PIN. - * If not defined the default pin for the selected MOTHERBOARD - * will be used. Most of the time the default is what you want. + * Override this pin only if the probe cannot be connected to + * the default Z_MIN_PROBE_PIN for the selected MOTHERBOARD. * * - The simplest option is to use a free endstop connector. * - Use 5V for powered (usually inductive) sensors. * - * - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin: - * - For simple switches connect... - * - normally-closed switches to GND and D32. - * - normally-open switches to 5V and D32. + * - For simple switches... + * - Normally-closed (NC) also connect to GND. + * - Normally-open (NO) also connect to 5V. */ -//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default +//#define Z_MIN_PROBE_PIN -1 /** * Probe Type @@ -1384,8 +1395,13 @@ /** * Z Servo Probe, such as an endstop switch on a rotating arm. */ -//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector. -//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles +//#define Z_PROBE_SERVO_NR 0 +#ifdef Z_PROBE_SERVO_NR + //#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles + //#define Z_SERVO_MEASURE_ANGLE 45 // Use if the servo must move to a "free" position for measuring after deploy + //#define Z_SERVO_INTERMEDIATE_STOW // Stow the probe between points + //#define Z_SERVO_DEACTIVATE_AFTER_STOW // Deactivate the servo when probe is stowed +#endif /** * The BLTouch probe uses a Hall effect sensor and emulates a servo. @@ -1544,6 +1560,12 @@ */ #define NOZZLE_TO_PROBE_OFFSET { -15, -50, -1.35 } +// Enable and set to use a specific tool for probing. Disable to allow any tool. +#define PROBING_TOOL 0 +#ifdef PROBING_TOOL + //#define PROBE_TOOLCHANGE_NO_MOVE // Suppress motion on probe tool-change +#endif + // Most probes should stay away from the edges of the bed, but // with NOZZLE_AS_PROBE this can be negative for a wider probing area. #define PROBING_MARGIN 20 @@ -1693,8 +1715,8 @@ // @section extruder -#define DISABLE_E false // Disable the extruder when not stepping -#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled +//#define DISABLE_E // Disable the extruder when not stepping +#define DISABLE_OTHER_EXTRUDERS // Keep only the active extruder enabled // @section motion @@ -1889,6 +1911,47 @@ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM // large enough to avoid false positives.) //#define FILAMENT_MOTION_SENSOR + + #if ENABLED(FILAMENT_MOTION_SENSOR) + //#define FILAMENT_SWITCH_AND_MOTION + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + #define NUM_MOTION_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_MOTION#_PIN for each. + //#define FIL_MOTION1_PIN -1 + + // Override individually if the motion sensors vary + //#define FIL_MOTION1_STATE LOW + //#define FIL_MOTION1_PULLUP + //#define FIL_MOTION1_PULLDOWN + + //#define FIL_MOTION2_STATE LOW + //#define FIL_MOTION2_PULLUP + //#define FIL_MOTION2_PULLDOWN + + //#define FIL_MOTION3_STATE LOW + //#define FIL_MOTION3_PULLUP + //#define FIL_MOTION3_PULLDOWN + + //#define FIL_MOTION4_STATE LOW + //#define FIL_MOTION4_PULLUP + //#define FIL_MOTION4_PULLDOWN + + //#define FIL_MOTION5_STATE LOW + //#define FIL_MOTION5_PULLUP + //#define FIL_MOTION5_PULLDOWN + + //#define FIL_MOTION6_STATE LOW + //#define FIL_MOTION6_PULLUP + //#define FIL_MOTION6_PULLDOWN + + //#define FIL_MOTION7_STATE LOW + //#define FIL_MOTION7_PULLUP + //#define FIL_MOTION7_PULLDOWN + + //#define FIL_MOTION8_STATE LOW + //#define FIL_MOTION8_PULLUP + //#define FIL_MOTION8_PULLDOWN + #endif + #endif #endif #endif @@ -2050,6 +2113,9 @@ //#define UBL_HILBERT_CURVE // Use Hilbert distribution for less travel when probing multiple points + //#define UBL_TILT_ON_MESH_POINTS // Use nearest mesh points with G29 J for better Z reference + //#define UBL_TILT_ON_MESH_POINTS_3POINT // Use nearest mesh points with G29 J0 (3-point) + #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 @@ -2108,8 +2174,8 @@ #if ENABLED(LCD_BED_TRAMMING) #define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets - #define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points - #define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points + #define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at tramming points + #define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between tramming points //#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner //#define BED_TRAMMING_USE_PROBE #if ENABLED(BED_TRAMMING_USE_PROBE) @@ -2173,6 +2239,7 @@ #if ENABLED(Z_SAFE_HOMING) #define Z_SAFE_HOMING_X_POINT X_CENTER // X point for Z homing #define Z_SAFE_HOMING_Y_POINT Y_CENTER // Y point for Z homing + //#define Z_SAFE_HOMING_POINT_ABSOLUTE // Ignore home offsets (M206) for Z homing position #endif // Homing speeds (linear=mm/min, rotational=°/min) @@ -3037,7 +3104,7 @@ * - Product: https://www.aliexpress.com/item/1005002008179262.html * * RELOADED (T5UID1) - * - Download https://github.com/Desuuuu/DGUS-reloaded/releases + * - Download https://github.com/Neo2003/DGUS-reloaded/releases * - Copy the downloaded DWIN_SET folder to the SD card. * * IA_CREALITY (T5UID1) @@ -3049,12 +3116,15 @@ * - Download files as specified for your type of display. * - Plug the microSD card into the back of the display. * - Boot the display and wait for the update to complete. + * + * :[ 'ORIGIN', 'FYSETC', 'HYPRECY', 'MKS', 'RELOADED', 'IA_CREALITY' ] */ //#define DGUS_LCD_UI ORIGIN #if DGUS_UI_IS(MKS) #define USE_MKS_GREEN_UI #elif DGUS_UI_IS(IA_CREALITY) - //#define LCD_SCREEN_ROTATE 90 // Portrait Mode or 800x480 displays + //#define LCD_SCREEN_ROTATE 90 // Portrait Mode or 800x480 displays + //#define IA_CREALITY_BOOT_DELAY 1500 // (ms) #endif // @@ -3069,15 +3139,23 @@ //#define TOUCH_UI_FTDI_EVE // -// Touch-screen LCD for Anycubic printers +// Touch-screen LCD for Anycubic Chiron // -//#define ANYCUBIC_LCD_I3MEGA //#define ANYCUBIC_LCD_CHIRON -#if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON) - //#define ANYCUBIC_LCD_DEBUG + +// +// Touch-screen LCD for Anycubic i3 Mega +// +//#define ANYCUBIC_LCD_I3MEGA +#if ENABLED(ANYCUBIC_LCD_I3MEGA) //#define ANYCUBIC_LCD_GCODE_EXT // Add ".gcode" to menu entries for DGUS clone compatibility #endif +// +// Touch-screen LCD for Anycubic Vyper +// +//#define ANYCUBIC_LCD_VYPER + // // 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028 // @@ -3221,11 +3299,11 @@ */ #define TFT_FONT NOTOSANS - //#define TFT_SHARED_SPI // SPI is shared between TFT display and other devices. Disable async data transfer + //#define TFT_SHARED_IO // I/O is shared between TFT display and other devices. Disable async data transfer. #endif #if ENABLED(TFT_LVGL_UI) - //#define MKS_WIFI_MODULE // MKS WiFi module + //#define MKS_WIFI_MODULE // MKS WiFi module #endif /** diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b3b42fb1844a..1068e4b94eec 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -194,8 +194,6 @@ */ //#define HEPHESTOS2_HEATED_BED_KIT #if ENABLED(HEPHESTOS2_HEATED_BED_KIT) - #undef TEMP_SENSOR_BED - #define TEMP_SENSOR_BED 70 #define HEATER_BED_INVERTING true #endif @@ -303,9 +301,12 @@ #define THERMAL_PROTECTION_PERIOD 40 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius - //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && EITHER(MPCTEMP, PIDTEMP) - //#define TEMP_TUNING_MAINTAIN_FAN // Don't slow fan speed during M303 or M306 T + //#define ADAPTIVE_FAN_SLOWING // Slow down the part-cooling fan if the temperature drops + #if ENABLED(ADAPTIVE_FAN_SLOWING) + //#define REPORT_ADAPTIVE_FAN_SLOWING // Report fan slowing activity to the console + #if EITHER(MPCTEMP, PIDTEMP) + //#define TEMP_TUNING_MAINTAIN_FAN // Don't slow down the fan speed during M303 or M306 T + #endif #endif /** @@ -368,10 +369,35 @@ #if ANY(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_BED, THERMAL_PROTECTION_CHAMBER, THERMAL_PROTECTION_COOLER) /** - * Thermal Protection Variance Monitor - EXPERIMENTAL. - * Kill the machine on a stuck temperature sensor. Disable if you get false positives. + * Thermal Protection Variance Monitor - EXPERIMENTAL + * Kill the machine on a stuck temperature sensor. + * + * This feature may cause some thermally-stable systems to halt. Be sure to test it throughly under + * a variety of conditions. Disable if you get false positives. + * + * This feature ensures that temperature sensors are updating regularly. If sensors die or get "stuck", + * or if Marlin stops reading them, temperatures will remain constant while heaters may still be powered! + * This feature only monitors temperature changes so it should catch any issue, hardware or software. + * + * By default it uses the THERMAL_PROTECTION_*_PERIOD constants (above) for the time window, within which + * at least one temperature change must occur, to indicate that sensor polling is working. If any monitored + * heater's temperature remains totally constant (without even a fractional change) during this period, a + * thermal malfunction error occurs and the printer is halted. + * + * A very stable heater might produce a false positive and halt the printer. In this case, try increasing + * the corresponding THERMAL_PROTECTION_*_PERIOD constant a bit. Keep in mind that uncontrolled heating + * shouldn't be allowed to persist for more than a minute or two. + * + * Be careful to distinguish false positives from real sensor issues before disabling this feature. If the + * heater's temperature appears even slightly higher than expected after restarting, you may have a real + * thermal malfunction. Check the temperature graph in your host for any unusual bumps. */ - //#define THERMAL_PROTECTION_VARIANCE_MONITOR // Detect a sensor malfunction preventing temperature updates + //#define THERMAL_PROTECTION_VARIANCE_MONITOR + #if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR) + // Variance detection window to override the THERMAL_PROTECTION...PERIOD settings above. + // Keep in mind that some heaters heat up faster than others. + //#define THERMAL_PROTECTION_VARIANCE_MONITOR_PERIOD 30 // (s) Override all watch periods + #endif #endif #if ENABLED(PIDTEMP) @@ -1060,7 +1086,51 @@ #endif -// @section motion +// @section motion control + +/** + * Fixed-time-based Motion Control -- EXPERIMENTAL + * Enable/disable and set parameters with G-code M493. + */ +//#define FT_MOTION +#if ENABLED(FT_MOTION) + #define FTM_DEFAULT_MODE ftMotionMode_ENABLED // Default mode of fixed time control. (Enums in ft_types.h) + #define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h) + #define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers. + #define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers. + #define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false). + #define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. + #define FTM_SHAPING_ZETA 0.1f // Zeta used by input shapers. + #define FTM_SHAPING_V_TOL 0.05f // Vibration tolerance used by EI input shapers. + + /** + * Advanced configuration + */ + #define FTM_BATCH_SIZE 100 // Batch size for trajectory generation; + // half the window size for Ulendo FBS. + #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (1 / FTM_TS) + #define FTM_TS 0.001f // (s) Time step for trajectory generation. (1 / FTM_FS) + #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update. + #define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps. + #define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency. + #define FTM_ZMAX 100 // Maximum delays for shaping functions (even numbers only!). + // Calculate as: + // 1/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZV. + // (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZVD, MZV. + // 3/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 2HEI. + // 2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 3HEI. + #define FTM_STEPS_PER_UNIT_TIME 20 // Interpolated stepper commands per unit time. + // Calculate as (FTM_STEPPER_FS / FTM_FS). + #define FTM_CTS_COMPARE_VAL 10 // Comparison value used in interpolation algorithm. + // Calculate as (FTM_STEPS_PER_UNIT_TIME / 2). + // These values may be configured to adjust duration of loop(). + #define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop(). + #define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop(). + + // This value may be configured to adjust duration to consume the command buffer. + // Try increasing this value if stepper motion is not smooth. + #define FTM_STEPPERCMD_BUFF_SIZE 1000 // Size of the stepper command buffers. +#endif /** * Input Shaping -- EXPERIMENTAL @@ -1099,6 +1169,8 @@ //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. #endif +// @section motion + #define AXIS_RELATIVE_MODES { false, false, false, false } // Add a Duplicate option for well-separated conjoined nozzles @@ -1118,19 +1190,20 @@ /** * Idle Stepper Shutdown - * Enable DISABLE_INACTIVE_* to shut down axis steppers after an idle period. - * The Deactive Time can be overridden with M18 and M84. Set to 0 for No Timeout. + * Enable DISABLE_IDLE_* to shut down axis steppers after an idle period. + * The default timeout duration can be overridden with M18 and M84. Set to 0 for No Timeout. */ -#define DEFAULT_STEPPER_DEACTIVE_TIME 120 -#define DISABLE_INACTIVE_X -#define DISABLE_INACTIVE_Y -#define DISABLE_INACTIVE_Z // Disable if the nozzle could fall onto your printed part! -//#define DISABLE_INACTIVE_I -//#define DISABLE_INACTIVE_J -//#define DISABLE_INACTIVE_K -//#define DISABLE_INACTIVE_U -//#define DISABLE_INACTIVE_V -//#define DISABLE_INACTIVE_W +#define DEFAULT_STEPPER_TIMEOUT_SEC 120 +#define DISABLE_IDLE_X +#define DISABLE_IDLE_Y +#define DISABLE_IDLE_Z // Disable if the nozzle could fall onto your printed part! +//#define DISABLE_IDLE_I +//#define DISABLE_IDLE_J +//#define DISABLE_IDLE_K +//#define DISABLE_IDLE_U +//#define DISABLE_IDLE_V +//#define DISABLE_IDLE_W +#define DISABLE_IDLE_E // Shut down all idle extruders // Default Minimum Feedrates for printing and travel moves #define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum feedrate. Set with M205 S. @@ -1267,6 +1340,12 @@ #endif #endif +/** + * Multi-stepping sends steps in bursts to reduce MCU usage for high step-rates. + * This allows higher feedrates than the MCU could otherwise support. + */ +#define MULTISTEPPING_LIMIT 16 //: [1, 2, 4, 8, 16, 32, 64, 128] + /** * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible @@ -1923,7 +2002,7 @@ // // Specify additional languages for the UI. Default specified by LCD_LANGUAGE. // -#if ANY(DOGLCD, TFT_COLOR_UI, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI) +#if ANY(DOGLCD, TFT_COLOR_UI, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI, ANYCUBIC_LCD_VYPER) //#define LCD_LANGUAGE_2 fr //#define LCD_LANGUAGE_3 de //#define LCD_LANGUAGE_4 es @@ -2149,13 +2228,10 @@ * Points to probe for all 3-point Leveling procedures. * Override if the automatically selected points are inadequate. */ -#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) - //#define PROBE_PT_1_X 15 - //#define PROBE_PT_1_Y 180 - //#define PROBE_PT_2_X 15 - //#define PROBE_PT_2_Y 20 - //#define PROBE_PT_3_X 170 - //#define PROBE_PT_3_Y 20 +#if NEEDS_THREE_PROBE_POINTS + //#define PROBE_PT_1 { 15, 180 } // (mm) { x, y } + //#define PROBE_PT_2 { 15, 20 } + //#define PROBE_PT_3 { 170, 20 } #endif /** @@ -2951,28 +3027,28 @@ * Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here. * The default pins can be found in your board's pins file. */ - //#define X_CS_PIN -1 - //#define Y_CS_PIN -1 - //#define Z_CS_PIN -1 - //#define X2_CS_PIN -1 - //#define Y2_CS_PIN -1 - //#define Z2_CS_PIN -1 - //#define Z3_CS_PIN -1 - //#define Z4_CS_PIN -1 - //#define I_CS_PIN -1 - //#define J_CS_PIN -1 - //#define K_CS_PIN -1 - //#define U_CS_PIN -1 - //#define V_CS_PIN -1 - //#define W_CS_PIN -1 - //#define E0_CS_PIN -1 - //#define E1_CS_PIN -1 - //#define E2_CS_PIN -1 - //#define E3_CS_PIN -1 - //#define E4_CS_PIN -1 - //#define E5_CS_PIN -1 - //#define E6_CS_PIN -1 - //#define E7_CS_PIN -1 + //#define X_CS_PIN -1 + //#define Y_CS_PIN -1 + //#define Z_CS_PIN -1 + //#define X2_CS_PIN -1 + //#define Y2_CS_PIN -1 + //#define Z2_CS_PIN -1 + //#define Z3_CS_PIN -1 + //#define Z4_CS_PIN -1 + //#define I_CS_PIN -1 + //#define J_CS_PIN -1 + //#define K_CS_PIN -1 + //#define U_CS_PIN -1 + //#define V_CS_PIN -1 + //#define W_CS_PIN -1 + //#define E0_CS_PIN -1 + //#define E1_CS_PIN -1 + //#define E2_CS_PIN -1 + //#define E3_CS_PIN -1 + //#define E4_CS_PIN -1 + //#define E5_CS_PIN -1 + //#define E6_CS_PIN -1 + //#define E7_CS_PIN -1 /** * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). @@ -2980,9 +3056,9 @@ * but you can override or define them here. */ //#define TMC_USE_SW_SPI - //#define TMC_SW_MOSI -1 - //#define TMC_SW_MISO -1 - //#define TMC_SW_SCK -1 + //#define TMC_SPI_MOSI -1 + //#define TMC_SPI_MISO -1 + //#define TMC_SPI_SCK -1 // @section tmc/serial @@ -3160,7 +3236,7 @@ * * It is recommended to set HOMING_BUMP_MM to { 0, 0, 0 }. * - * SPI_ENDSTOPS *** Beta feature! *** TMC2130/TMC5160 Only *** + * SPI_ENDSTOPS *** TMC2130/TMC5160 Only *** * Poll the driver through SPI to determine load when homing. * Removes the need for a wire from DIAG1 to an endstop pin. * @@ -3188,7 +3264,7 @@ //#define U_STALL_SENSITIVITY 8 //#define V_STALL_SENSITIVITY 8 //#define W_STALL_SENSITIVITY 8 - //#define SPI_ENDSTOPS // TMC2130 only + //#define SPI_ENDSTOPS // TMC2130/TMC5160 only //#define IMPROVE_HOMING_RELIABILITY #endif @@ -3207,10 +3283,9 @@ //#define TMC_HOME_PHASE { 896, 896, 896 } /** - * Beta feature! - * Create a 50/50 square wave step pulse optimal for stepper drivers. + * Step on both rising and falling edge signals (as with a square wave). */ - //#define SQUARE_WAVE_STEPPING + //#define EDGE_STEPPING /** * Enable M122 debugging command for TMC stepper drivers. @@ -4045,16 +4120,17 @@ * Sample debug features * If you add more debug displays, be careful to avoid conflicts! */ - #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning - #define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row - #define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row - - #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row - // If you experience stuttering, reboots, etc. this option can reveal how - // tweaks made to the configuration are affecting the printer in real-time. - #define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix - // row. By default idle() is profiled so this shows how "idle" the processor is. - // See class CodeProfiler. + #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning + #define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row + + #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row + // If you experience stuttering, reboots, etc. this option can reveal how + // tweaks made to the configuration are affecting the printer in real-time. + #define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix + // row. By default idle() is profiled so this shows how "idle" the processor is. + // See class CodeProfiler. + //#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multistepping 1 to 128 on this LED matrix row. #endif /** diff --git a/Marlin/Marlin.ino b/Marlin/Marlin.ino index 57c825445fb5..744e98c2e313 100644 --- a/Marlin/Marlin.ino +++ b/Marlin/Marlin.ino @@ -27,7 +27,7 @@ Configuration - https://github.com/MarlinFirmware/Configurations Example configurations for several printer models. - - https://www.youtube.com/watch?v=3gwWVFtdg-4 + - https://youtu.be/3gwWVFtdg-4 A good 20-minute overview of Marlin configuration by Tom Sanladerer. (Applies to Marlin 1.0.x, so Jerk and Acceleration should be halved.) Also... https://www.google.com/search?tbs=vid%3A1&q=configure+marlin diff --git a/Marlin/Version.h b/Marlin/Version.h index 4d1529d48610..f3b75ea6b4ec 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 "2023-02-27" +//#define STRING_DISTRIBUTION_DATE "2023-04-01" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/config.ini b/Marlin/config.ini index 0fb9fb0c9308..c4fe7597f850 100644 --- a/Marlin/config.ini +++ b/Marlin/config.ini @@ -73,9 +73,9 @@ use_xmin_plug = on use_ymin_plug = on use_zmin_plug = on -x_min_endstop_inverting = false -y_min_endstop_inverting = false -z_min_endstop_inverting = false +x_min_endstop_hit_state = HIGH +y_min_endstop_hit_state = HIGH +z_min_endstop_hit_state = HIGH default_axis_steps_per_unit = { 80, 80, 400, 500 } axis_relative_modes = { false, false, false, false } @@ -95,10 +95,10 @@ invert_y_dir = true invert_z_dir = false invert_e0_dir = false -invert_e_step_pin = false -invert_x_step_pin = false -invert_y_step_pin = false -invert_z_step_pin = false +step_state_e = HIGH +step_state_x = HIGH +step_state_y = HIGH +step_state_z = HIGH disable_x = false disable_y = false @@ -127,7 +127,7 @@ busy_while_heating = on default_ejerk = 5.0 default_keepalive_interval = 2 default_leveling_fade_height = 0.0 -disable_inactive_extruder = on +disable_other_extruders = on display_charset_hd44780 = JAPANESE eeprom_boot_silent = on eeprom_chitchat = on @@ -176,12 +176,12 @@ auto_report_temperatures = on autotemp = on autotemp_oldweight = 0.98 bed_check_interval = 5000 -default_stepper_deactive_time = 120 +default_stepper_timeout_sec = 120 default_volumetric_extruder_limit = 0.00 -disable_inactive_e = true -disable_inactive_x = true -disable_inactive_y = true -disable_inactive_z = true +disable_idle_x = on +disable_idle_y = on +disable_idle_z = on +disable_idle_e = on e0_auto_fan_pin = -1 encoder_100x_steps_per_sec = 80 encoder_10x_steps_per_sec = 30 diff --git a/Marlin/src/HAL/AVR/MarlinSerial.h b/Marlin/src/HAL/AVR/MarlinSerial.h index 7eb76000d66e..7dd208e54e85 100644 --- a/Marlin/src/HAL/AVR/MarlinSerial.h +++ b/Marlin/src/HAL/AVR/MarlinSerial.h @@ -34,6 +34,7 @@ #include #include "../../inc/MarlinConfigPre.h" +#include "../../core/types.h" #include "../../core/serial_hook.h" #ifndef SERIAL_PORT @@ -138,10 +139,6 @@ #define BYTE 0 - // Templated type selector - template struct TypeSelector { typedef T type;} ; - template struct TypeSelector { typedef F type; }; - template class MarlinSerial { protected: @@ -164,7 +161,7 @@ static constexpr B_U2Xx B_U2X = 0; // Base size of type on buffer size - typedef typename TypeSelector<(Cfg::RX_SIZE>256), uint16_t, uint8_t>::type ring_buffer_pos_t; + typedef uvalue_t(Cfg::RX_SIZE - 1) ring_buffer_pos_t; struct ring_buffer_r { volatile ring_buffer_pos_t head, tail; diff --git a/Marlin/src/HAL/AVR/fastio.h b/Marlin/src/HAL/AVR/fastio.h index 8a5e4650f4c6..4516d9cd540f 100644 --- a/Marlin/src/HAL/AVR/fastio.h +++ b/Marlin/src/HAL/AVR/fastio.h @@ -255,84 +255,6 @@ enum ClockSource2 : uint8_t { #define SET_FOCB(T,V) SET_FOC(T,B,V) #define SET_FOCC(T,V) SET_FOC(T,C,V) -#if 0 - -/** - * PWM availability macros - */ - -// Determine which hardware PWMs are already in use -#define _PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == E6_AUTO_FAN_PIN || P == E7_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN || P == COOLER_AUTO_FAN_PIN) -#if PIN_EXISTS(CONTROLLER_FAN) - #define PWM_CHK_FAN_B(P) (_PWM_CHK_FAN_B(P) || P == CONTROLLER_FAN_PIN) -#else - #define PWM_CHK_FAN_B(P) _PWM_CHK_FAN_B(P) -#endif - -#if ANY_PIN(FAN, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7) - #if PIN_EXISTS(FAN7) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN || P == FAN6_PIN || P == FAN7_PIN) - #elif PIN_EXISTS(FAN6) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN || P == FAN6_PIN) - #elif PIN_EXISTS(FAN5) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN) - #elif PIN_EXISTS(FAN4) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN) - #elif PIN_EXISTS(FAN3) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN) - #elif PIN_EXISTS(FAN2) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN) - #elif PIN_EXISTS(FAN1) - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN) - #else - #define PWM_CHK_FAN_A(P) (P == FAN0_PIN) - #endif -#else - #define PWM_CHK_FAN_A(P) false -#endif - -#if HAS_MOTOR_CURRENT_PWM - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN || P == MOTOR_CURRENT_PWM_XY_PIN) - #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN) - #else - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN) - #endif -#else - #define PWM_CHK_MOTOR_CURRENT(P) false -#endif - -#ifdef NUM_SERVOS - #if AVR_ATmega2560_FAMILY - #define PWM_CHK_SERVO(P) (P == 5 || (NUM_SERVOS > 12 && P == 6) || (NUM_SERVOS > 24 && P == 46)) // PWMS 3A, 4A & 5A - #elif AVR_ATmega2561_FAMILY - #define PWM_CHK_SERVO(P) (P == 5) // PWM3A - #elif AVR_ATmega1284_FAMILY - #define PWM_CHK_SERVO(P) false - #elif AVR_AT90USB1286_FAMILY - #define PWM_CHK_SERVO(P) (P == 16) // PWM3A - #elif AVR_ATmega328_FAMILY - #define PWM_CHK_SERVO(P) false - #endif -#else - #define PWM_CHK_SERVO(P) false -#endif - -#if ENABLED(BARICUDA) - #if HAS_HEATER_1 && HAS_HEATER_2 - #define PWM_CHK_HEATER(P) (P == HEATER_1_PIN || P == HEATER_2_PIN) - #elif HAS_HEATER_1 - #define PWM_CHK_HEATER(P) (P == HEATER_1_PIN) - #endif -#else - #define PWM_CHK_HEATER(P) false -#endif - -#define PWM_CHK(P) (PWM_CHK_HEATER(P) || PWM_CHK_SERVO(P) || PWM_CHK_MOTOR_CURRENT(P) || PWM_CHK_FAN_A(P) || PWM_CHK_FAN_B(P)) - -#endif // PWM_CHK is not used in Marlin - // define which hardware PWMs are available for the current CPU // all timer 1 PWMS deleted from this list because they are never available #if AVR_ATmega2560_FAMILY diff --git a/Marlin/src/HAL/AVR/fastio/fastio_1280.h b/Marlin/src/HAL/AVR/fastio/fastio_1280.h index f482f823e8b9..e6ecbabb800f 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_1280.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_1280.h @@ -27,6 +27,9 @@ * Hardware Pin : 02 03 06 07 01 05 15 16 17 18 23 24 25 26 64 63 13 12 46 45 44 43 78 77 76 75 74 73 72 71 60 59 58 57 56 55 54 53 50 70 52 51 42 41 40 39 38 37 36 35 22 21 20 19 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 | 04 08 09 10 11 14 27 28 29 30 31 32 33 34 47 48 49 61 62 65 66 67 68 69 79 80 81 98 99 100 * Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 | E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx * Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 73 75 76 77 74 xx xx xx xx xx + * + * Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA + * AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg */ #include "../fastio.h" diff --git a/Marlin/src/HAL/AVR/fastio/fastio_1281.h b/Marlin/src/HAL/AVR/fastio/fastio_1281.h index e0bc5e2995d1..812586225d17 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_1281.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_1281.h @@ -26,6 +26,9 @@ * * Logical Pin: 38 39 40 41 42 43 44 45 16 10 11 12 06 07 08 09 30 31 32 33 34 35 36 37 17 18 19 20 21 22 23 24 00 01 13 05 02 03 14 15 46 47 48 49 50 51 52 53 25 26 27 28 29 04 * Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5 + * + * Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA + * AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg */ #include "../fastio.h" diff --git a/Marlin/src/HAL/AVR/fastio/fastio_168.h b/Marlin/src/HAL/AVR/fastio/fastio_168.h index 8cfdd1e8f825..4f591b37b901 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_168.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_168.h @@ -26,6 +26,9 @@ * * Logical Pin: 08 09 10 11 12 13 14 15 16 17 18 19 20 21 00 01 02 03 04 05 06 07 * Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 + * + * Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA + * AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg */ #include "../fastio.h" diff --git a/Marlin/src/HAL/AVR/fastio/fastio_644.h b/Marlin/src/HAL/AVR/fastio/fastio_644.h index f4a9427e0abf..16bdc6a23da2 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_644.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_644.h @@ -26,6 +26,9 @@ * * Logical Pin: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 * Port: B0 B1 B2 B3 B4 B5 B6 B7 D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 A7 A6 A5 A4 A3 A2 A1 A0 + * + * Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA + * AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg */ /** ATMega644 diff --git a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h index 51d400b70565..d2a8aca6f38c 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h @@ -27,6 +27,9 @@ * Logical Pin: 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45 * Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 * The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3 + * + * Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA + * AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg */ #include "../fastio.h" diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index ff1610f74164..45aa3a50b967 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -69,8 +69,8 @@ /** * Checks for SOFT PWM */ -#if HAS_FAN0 && FAN_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER) - #error "FAN_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)." +#if HAS_FAN0 && FAN0_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER) + #error "FAN0_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)." #error "Disable SPEAKER or enable FAN_SOFT_PWM." #endif diff --git a/Marlin/src/HAL/AVR/math.h b/Marlin/src/HAL/AVR/math.h index 34f859fbbb03..16848524fa03 100644 --- a/Marlin/src/HAL/AVR/math.h +++ b/Marlin/src/HAL/AVR/math.h @@ -84,32 +84,26 @@ FORCE_INLINE static uint16_t MultiU24X32toH16(uint32_t longIn1, uint32_t longIn2 return intRes; } -// intRes = intIn1 * intIn2 >> 8 +// charRes = charIn1 * charIn2 >> 8 // uses: -// r1, r0 for the result of mul. After the second mul, r0 holds bits 0-7 of the 24 bit result and -// the top bit of r0 is used for rounding. -// [tmp] to store 0. -// [intRes] (A B) is bits 8-15 and is the returned value. +// r1, r0 for the result of mul. After the mul, r0 holds bits 0-7 of the 16 bit result, +// and the top bit of r0 is used for rounding. +// [charRes] is bits 8-15 and is the returned value. // [charIn1] is an 8 bit parameter. -// [intIn2] (B A) is a 16 bit parameter. +// [charIn2] is an 8 bit parameter. // -FORCE_INLINE static uint16_t MultiU8X16toH16(uint8_t charIn1, uint16_t intIn2) { - uint8_t tmp; - uint16_t intRes; +FORCE_INLINE static uint8_t MultiU8X8toH8(uint8_t charIn1, uint8_t charIn2) { + uint8_t charRes; __asm__ __volatile__ ( - A("clr %[tmp]") - A("mul %[charIn1], %B[intIn2]") - A("movw %A[intRes], r0") - A("mul %[charIn1], %A[intIn2]") - A("lsl r0") - A("adc %A[intRes], r1") - A("adc %B[intRes], %[tmp]") + A("mul %[charIn1], %[charIn2]") + A("mov %[charRes], r1") A("clr r1") - : [intRes] "=&r" (intRes), - [tmp] "=&r" (tmp) + A("lsl r0") + A("adc %[charRes], r1") + : [charRes] "=&r" (charRes) : [charIn1] "d" (charIn1), - [intIn2] "d" (intIn2) + [charIn2] "d" (charIn2) : "cc" ); - return intRes; + return charRes; } diff --git a/Marlin/src/HAL/AVR/timers.h b/Marlin/src/HAL/AVR/timers.h index 33c3880b6b99..d9cdfc4f0131 100644 --- a/Marlin/src/HAL/AVR/timers.h +++ b/Marlin/src/HAL/AVR/timers.h @@ -44,14 +44,14 @@ typedef uint16_t hal_timer_t; #define MF_TIMER_TEMP 0 #endif -#define TEMP_TIMER_FREQUENCY ((F_CPU) / 64.0 / 256.0) +#define TEMP_TIMER_FREQUENCY (((F_CPU) + 0x2000) / 0x4000) #define STEPPER_TIMER_RATE HAL_TIMER_RATE #define STEPPER_TIMER_PRESCALE 8 -#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // Cannot be of type double +#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) -#define PULSE_TIMER_RATE STEPPER_TIMER_RATE // frequency of pulse timer -#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE +#define PULSE_TIMER_RATE STEPPER_TIMER_RATE +#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE #define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US #define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A) diff --git a/Marlin/src/HAL/DUE/MarlinSerial.h b/Marlin/src/HAL/DUE/MarlinSerial.h index 5a61bffee0da..b80ae2182312 100644 --- a/Marlin/src/HAL/DUE/MarlinSerial.h +++ b/Marlin/src/HAL/DUE/MarlinSerial.h @@ -30,6 +30,7 @@ #include #include "../../inc/MarlinConfigPre.h" +#include "../../core/types.h" #include "../../core/serial_hook.h" // Define constants and variables for buffering incoming serial data. We're @@ -52,10 +53,6 @@ // #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256." //#endif -// Templated type selector -template struct TypeSelector { typedef T type;} ; -template struct TypeSelector { typedef F type; }; - // Templated structure wrapper template struct StructWrapper { constexpr StructWrapper(int) {} @@ -76,7 +73,7 @@ class MarlinSerial { static constexpr int HWUART_IRQ_ID = IRQ_IDS[Cfg::PORT]; // Base size of type on buffer size - typedef typename TypeSelector<(Cfg::RX_SIZE>256), uint16_t, uint8_t>::type ring_buffer_pos_t; + typedef uvalue_t(Cfg::RX_SIZE - 1) ring_buffer_pos_t; struct ring_buffer_r { volatile ring_buffer_pos_t head, tail; diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index 1f5acc360c72..996404a7d04c 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -64,7 +64,7 @@ * Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time * as the TMC2130 soft SPI the most common setup. */ -#define _IS_HW_SPI(P) (defined(TMC_SW_##P) && (TMC_SW_##P == SD_MOSI_PIN || TMC_SW_##P == SD_MISO_PIN || TMC_SW_##P == SD_SCK_PIN)) +#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN)) #if ENABLED(SDSUPPORT) && HAS_DRIVER(TMC2130) #if ENABLED(TMC_USE_SW_SPI) diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index ddfedf92eed9..5dc9b2cfe2e8 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -50,14 +50,12 @@ #define MYSERIAL1 flushableSerial -#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT) - #if ENABLED(ESP3D_WIFISUPPORT) - typedef ForwardSerial1Class< decltype(Serial2Socket) > DefaultSerial1; - extern DefaultSerial1 MSerial0; - #define MYSERIAL2 MSerial0 - #else - #define MYSERIAL2 webSocketSerial - #endif +#if ENABLED(ESP3D_WIFISUPPORT) + typedef ForwardSerial1Class< decltype(Serial2Socket) > DefaultSerial1; + extern DefaultSerial1 MSerial0; + #define MYSERIAL2 MSerial0 +#elif ENABLED(WIFISUPPORT) + #define MYSERIAL2 webSocketSerial #endif #define CRITICAL_SECTION_START() portENTER_CRITICAL(&hal.spinlock) diff --git a/Marlin/src/HAL/ESP32/inc/SanityCheck.h b/Marlin/src/HAL/ESP32/inc/SanityCheck.h index 8c5621f10c02..2d1b85033090 100644 --- a/Marlin/src/HAL/ESP32/inc/SanityCheck.h +++ b/Marlin/src/HAL/ESP32/inc/SanityCheck.h @@ -56,3 +56,7 @@ #if BOTH(I2S_STEPPER_STREAM, LIN_ADVANCE) && DISABLED(EXPERIMENTAL_I2S_LA) #error "I2S stream is currently incompatible with LIN_ADVANCE." #endif + +#if BOTH(I2S_STEPPER_STREAM, PRINTCOUNTER) && PRINTCOUNTER_SAVE_INTERVAL > 0 && DISABLED(PRINTCOUNTER_SYNC) + #error "PRINTCOUNTER_SAVE_INTERVAL may cause issues on ESP32 with an I2S expander. Define PRINTCOUNTER_SYNC in Configuration.h for an imperfect solution." +#endif diff --git a/Marlin/src/HAL/ESP32/ota.cpp b/Marlin/src/HAL/ESP32/ota.cpp index 69a3e25e5631..f31a78c2c519 100644 --- a/Marlin/src/HAL/ESP32/ota.cpp +++ b/Marlin/src/HAL/ESP32/ota.cpp @@ -50,7 +50,7 @@ void OTA_init() { }) .onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); - char *str; + const char *str = "unknown"; switch (error) { case OTA_AUTH_ERROR: str = "Auth Failed"; break; case OTA_BEGIN_ERROR: str = "Begin Failed"; break; diff --git a/Marlin/src/HAL/ESP32/timers.cpp b/Marlin/src/HAL/ESP32/timers.cpp index c37ad2430cb2..a6893150b663 100644 --- a/Marlin/src/HAL/ESP32/timers.cpp +++ b/Marlin/src/HAL/ESP32/timers.cpp @@ -111,12 +111,12 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { /** * Set the upper value of the timer, when the timer reaches this upper value the * interrupt should be triggered and the counter reset - * @param timer_num timer number to set the count to - * @param count threshold at which the interrupt is triggered + * @param timer_num timer number to set the compare value to + * @param compare threshold at which the interrupt is triggered */ -void HAL_timer_set_compare(const uint8_t timer_num, hal_timer_t count) { +void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare) { const tTimerConfig timer = timer_config[timer_num]; - timer_set_alarm_value(timer.group, timer.idx, count); + timer_set_alarm_value(timer.group, timer.idx, compare); } /** diff --git a/Marlin/src/HAL/LINUX/spi_pins.h b/Marlin/src/HAL/LINUX/spi_pins.h index 33136ac9dd80..9b406518738c 100644 --- a/Marlin/src/HAL/LINUX/spi_pins.h +++ b/Marlin/src/HAL/LINUX/spi_pins.h @@ -25,10 +25,10 @@ #include "../../inc/MarlinConfigPre.h" #if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_ENABLE == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) - #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently - // needed due to the speed and mode required for communicating with each device being different. - // This requirement can be removed if the SPI access to these devices is updated to use - // spiBeginTransaction. + #define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently + // needed due to the speed and mode required for communicating with each device being different. + // This requirement can be removed if the SPI access to these devices is updated to use + // spiBeginTransaction. #endif // Onboard SD diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 9ff3a6ba598f..746f43a2a472 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -28,6 +28,7 @@ DefaultSerial1 USBSerial(false, UsbSerial); uint32_t MarlinHAL::adc_result = 0; +pin_t MarlinHAL::adc_pin = 0; // U8glib required functions extern "C" { diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index b0eeb983b445..15d61d30d1f6 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -241,15 +241,18 @@ class MarlinHAL { // Begin ADC sampling on the given pin. Called from Temperature::isr! static uint32_t adc_result; - static void adc_start(const pin_t pin) { - adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits - } + static pin_t adc_pin; + + static void adc_start(const pin_t pin) { adc_pin = pin; } // Is the ADC ready for reading? - static bool adc_ready() { return true; } + static bool adc_ready() { return LPC176x::adc_hardware.done(LPC176x::pin_get_adc_channel(adc_pin)); } // The current value of the ADC register - static uint16_t adc_value() { return uint16_t(adc_result); } + static uint16_t adc_value() { + adc_result = FilteredADC::read(adc_pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits + return uint16_t(adc_result); + } /** * Set the PWM duty cycle for the pin to the given value. diff --git a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp index 257d8579e21d..4d6cb55cff58 100644 --- a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp +++ b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp @@ -60,7 +60,7 @@ // ------------------------ // Public functions // ------------------------ -#if ENABLED(LPC_SOFTWARE_SPI) +#if ENABLED(SOFTWARE_SPI) // Software SPI @@ -161,7 +161,7 @@ // TODO: Implement this method } -#endif // LPC_SOFTWARE_SPI +#endif // SOFTWARE_SPI /** * @brief Wait until TXE (tx empty) flag is set and BSY (busy) flag unset. diff --git a/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h b/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h index 35499500081a..a0bf4215383e 100644 --- a/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h +++ b/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h @@ -30,5 +30,5 @@ // LPC1768 boards seem to lose steps when saving to EEPROM during print (issue #20785) // TODO: Which other boards are incompatible? #if defined(MCU_LPC1768) && ENABLED(FLASH_EEPROM_EMULATION) && PRINTCOUNTER_SAVE_INTERVAL > 0 - #define PRINTCOUNTER_SYNC 1 + #define PRINTCOUNTER_SYNC #endif diff --git a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h index 8265d58a6e8f..b9a336066818 100644 --- a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h +++ b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h @@ -95,7 +95,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o #if USING_HW_SERIAL0 #define IS_TX0(P) (P == P0_02) #define IS_RX0(P) (P == P0_03) - #if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI) + #if IS_TX0(TMC_SPI_MISO) || IS_RX0(TMC_SPI_MOSI) #error "Serial port pins (0) conflict with Trinamic SPI pins!" #elif HAS_PRUSA_MMU1 && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN)) #error "Serial port pins (0) conflict with Multi-Material-Unit multiplexer pins!" @@ -111,7 +111,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o #define IS_RX1(P) (P == P0_16) #define _IS_TX1_1 IS_TX1 #define _IS_RX1_1 IS_RX1 - #if IS_TX1(TMC_SW_SCK) + #if IS_TX1(TMC_SPI_SCK) #error "Serial port pins (1) conflict with other pins!" #elif HAS_ROTARY_ENCODER #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1) diff --git a/Marlin/src/HAL/LPC1768/spi_pins.h b/Marlin/src/HAL/LPC1768/spi_pins.h index e7d774742f42..a82b21dda91f 100644 --- a/Marlin/src/HAL/LPC1768/spi_pins.h +++ b/Marlin/src/HAL/LPC1768/spi_pins.h @@ -24,10 +24,10 @@ #include "../../core/macros.h" #if BOTH(SDSUPPORT, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_ENABLE == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) - #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently - // needed due to the speed and mode required for communicating with each device being different. - // This requirement can be removed if the SPI access to these devices is updated to use - // spiBeginTransaction. + #define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently + // needed due to the speed and mode required for communicating with each device being different. + // This requirement can be removed if the SPI access to these devices is updated to use + // spiBeginTransaction. #endif /** onboard SD card */ diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp index 804fc85e792f..abf1cf5e439d 100644 --- a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp @@ -139,7 +139,7 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun DataTransferBegin(DATASIZE_16BIT); SPIx.dmaSendAsync(Data, Count, MemoryIncrease); - TERN_(TFT_SHARED_SPI, while (isBusy())); + TERN_(TFT_SHARED_IO, while (isBusy())); } #endif // HAS_SPI_TFT diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.h b/Marlin/src/HAL/LPC1768/tft/tft_spi.h index dad393981ed1..4817a5aae30a 100644 --- a/Marlin/src/HAL/LPC1768/tft/tft_spi.h +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.h @@ -69,7 +69,7 @@ class TFT_SPI { static bool isBusy(); static void Abort(); - static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT); + static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT); static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); }; static void DataTransferAbort(); diff --git a/Marlin/src/HAL/NATIVE_SIM/spi_pins.h b/Marlin/src/HAL/NATIVE_SIM/spi_pins.h index a5138e0ccbe8..fd3378b33759 100644 --- a/Marlin/src/HAL/NATIVE_SIM/spi_pins.h +++ b/Marlin/src/HAL/NATIVE_SIM/spi_pins.h @@ -25,7 +25,7 @@ #include "../../inc/MarlinConfigPre.h" #if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_ENABLE == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) - #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently + #define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode required for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use // spiBeginTransaction. diff --git a/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h b/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h index f412e09e1102..f3b64c4ccad4 100644 --- a/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h +++ b/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h @@ -52,7 +52,7 @@ class TFT_SPI { static bool isBusy(); static void Abort(); - static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT); + static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT); static void DataTransferEnd(); static void DataTransferAbort(); diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.h b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.h index 6d5f91d3ba45..ec263b6dd36b 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.h +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.h @@ -34,4 +34,3 @@ void u8g_i2c_stop(); #ifdef __cplusplus } #endif - diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h index 44ffbfeb90e5..2a50eddcd407 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h @@ -40,5 +40,3 @@ uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void #define U8G_COM_T6963 u8g_com_null_fn #define U8G_COM_FAST_PARALLEL u8g_com_null_fn #define U8G_COM_UC_I2C u8g_com_null_fn - - diff --git a/Marlin/src/HAL/SAMD21/HAL_SPI.cpp b/Marlin/src/HAL/SAMD21/HAL_SPI.cpp index 0fc530cdb231..69c6a43af835 100644 --- a/Marlin/src/HAL/SAMD21/HAL_SPI.cpp +++ b/Marlin/src/HAL/SAMD21/HAL_SPI.cpp @@ -64,7 +64,7 @@ } void spiInit(uint8_t spiRate) { - // Use datarates Marlin uses + // Use Marlin datarates uint32_t clock; switch (spiRate) { case SPI_FULL_SPEED: clock = 8000000; break; diff --git a/Marlin/src/HAL/SAMD21/fastio.h b/Marlin/src/HAL/SAMD21/fastio.h index db64f2166fa4..df907ff7ec6c 100644 --- a/Marlin/src/HAL/SAMD21/fastio.h +++ b/Marlin/src/HAL/SAMD21/fastio.h @@ -213,4 +213,3 @@ #define DIO53_PIN PIN_PA21 #define DIO54_PIN PIN_PA06 #define DIO55_PIN PIN_PA07 - diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index 3e85aca293d2..61569c793738 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -138,7 +138,7 @@ typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs. -#ifdef STM32G0B1xx +#if defined(STM32G0B1xx) || defined(STM32H7xx) typedef int32_t pin_t; #else typedef int16_t pin_t; diff --git a/Marlin/src/HAL/STM32/HAL_SPI.cpp b/Marlin/src/HAL/STM32/HAL_SPI.cpp index 40d320d5e822..278d209c47cb 100644 --- a/Marlin/src/HAL/STM32/HAL_SPI.cpp +++ b/Marlin/src/HAL/STM32/HAL_SPI.cpp @@ -78,7 +78,6 @@ static SPISettings spiConfig; case SPI_SPEED_6: delaySPIFunc = &delaySPI_2000; break; // desired: 250,000 actual: ~210K default: delaySPIFunc = &delaySPI_4000; break; // desired: 125,000 actual: ~123K } - SPI.begin(); } // Begin SPI transaction, set clock, bit order, data mode diff --git a/Marlin/src/HAL/STM32/inc/Conditionals_post.h b/Marlin/src/HAL/STM32/inc/Conditionals_post.h index c5ce66a26f54..83ce077c754d 100644 --- a/Marlin/src/HAL/STM32/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32/inc/Conditionals_post.h @@ -30,5 +30,5 @@ // Some STM32F4 boards may lose steps when saving to EEPROM during print (PR #17946) #if defined(STM32F4xx) && ENABLED(FLASH_EEPROM_EMULATION) && PRINTCOUNTER_SAVE_INTERVAL > 0 - #define PRINTCOUNTER_SYNC 1 + #define PRINTCOUNTER_SYNC #endif diff --git a/Marlin/src/HAL/STM32/inc/SanityCheck.h b/Marlin/src/HAL/STM32/inc/SanityCheck.h index e8ddfa172005..eaad8db4d33d 100644 --- a/Marlin/src/HAL/STM32/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32/inc/SanityCheck.h @@ -55,7 +55,7 @@ * Check for common serial pin conflicts */ #define _CHECK_SERIAL_PIN(N) (( \ - BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN_PIN == N || \ + BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN0_PIN == N || \ SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N \ )) #define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN) diff --git a/Marlin/src/HAL/STM32/pinsDebug.h b/Marlin/src/HAL/STM32/pinsDebug.h index 29a4e003f98a..b12d621e9889 100644 --- a/Marlin/src/HAL/STM32/pinsDebug.h +++ b/Marlin/src/HAL/STM32/pinsDebug.h @@ -111,7 +111,9 @@ const XrefInfo pin_xref[] PROGMEM = { #if NUM_ANALOG_FIRST >= NUM_DIGITAL_PINS #define HAS_HIGH_ANALOG_PINS 1 #endif -#define NUM_ANALOG_LAST ((NUM_ANALOG_FIRST) + (NUM_ANALOG_INPUTS) - 1) +#ifndef NUM_ANALOG_LAST + #define NUM_ANALOG_LAST ((NUM_ANALOG_FIRST) + (NUM_ANALOG_INPUTS) - 1) +#endif #define NUMBER_PINS_TOTAL ((NUM_DIGITAL_PINS) + TERN0(HAS_HIGH_ANALOG_PINS, NUM_ANALOG_INPUTS)) #define VALID_PIN(P) (WITHIN(P, 0, (NUM_DIGITAL_PINS) - 1) || TERN0(HAS_HIGH_ANALOG_PINS, WITHIN(P, NUM_ANALOG_FIRST, NUM_ANALOG_LAST))) #define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp b/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp index cf9e569336bc..6ac3549b41b2 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp @@ -71,7 +71,7 @@ void TFT_FSMC::Init() { Timing.DataLatency = 17; Timing.AccessMode = FSMC_ACCESS_MODE_A; // Write Timing - // Can be decreases from 8-15-8 to 0-0-1 with risk of stability loss + // Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss ExtTiming.AddressSetupTime = 8; ExtTiming.AddressHoldTime = 15; ExtTiming.DataSetupTime = 8; @@ -100,11 +100,11 @@ void TFT_FSMC::Init() { HAL_SRAM_Init(&SRAMx, &Timing, &ExtTiming); - __HAL_RCC_DMA2_CLK_ENABLE(); - #ifdef STM32F1xx - DMAtx.Instance = DMA2_Channel1; + __HAL_RCC_DMA1_CLK_ENABLE(); + DMAtx.Instance = DMA1_Channel1; #elif defined(STM32F4xx) + __HAL_RCC_DMA2_CLK_ENABLE(); DMAtx.Instance = DMA2_Stream0; DMAtx.Init.Channel = DMA_CHANNEL_0; DMAtx.Init.FIFOMode = DMA_FIFOMODE_ENABLE; @@ -174,6 +174,8 @@ void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou DMAtx.Init.PeriphInc = MemoryIncrease; HAL_DMA_Init(&DMAtx); HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count); + + TERN_(TFT_SHARED_IO, while (isBusy())); } void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.h b/Marlin/src/HAL/STM32/tft/tft_fsmc.h index 41ff8c9a83c8..8eb41d717d6d 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.h @@ -31,6 +31,10 @@ #error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware." #endif +#ifndef HAL_SRAM_MODULE_ENABLED + #error "SRAM module disabled for the STM32 framework (HAL_SRAM_MODULE_ENABLED)! Please consult the development team." +#endif + #ifndef LCD_READ_ID #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) #endif @@ -69,8 +73,8 @@ class TFT_FSMC { static bool isBusy(); static void Abort(); - static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {} - static void DataTransferEnd() {}; + static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {} + static void DataTransferEnd() {} static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); } static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); } diff --git a/Marlin/src/HAL/STM32/tft/tft_ltdc.h b/Marlin/src/HAL/STM32/tft/tft_ltdc.h index 8d83839bb3fa..ee655610116e 100644 --- a/Marlin/src/HAL/STM32/tft/tft_ltdc.h +++ b/Marlin/src/HAL/STM32/tft/tft_ltdc.h @@ -58,7 +58,7 @@ class TFT_LTDC { static bool isBusy(); static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ } - static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {} + static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {} static void DataTransferEnd() {}; static void WriteData(uint16_t Data); diff --git a/Marlin/src/HAL/STM32/tft/tft_spi.cpp b/Marlin/src/HAL/STM32/tft/tft_spi.cpp index 5e79f156d27c..6ee4dc3364ee 100644 --- a/Marlin/src/HAL/STM32/tft/tft_spi.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_spi.cpp @@ -242,7 +242,7 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request - TERN_(TFT_SHARED_SPI, while (isBusy())); + TERN_(TFT_SHARED_IO, while (isBusy())); } @@ -261,6 +261,7 @@ void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY); + while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {} Abort(); } diff --git a/Marlin/src/HAL/STM32/tft/tft_spi.h b/Marlin/src/HAL/STM32/tft/tft_spi.h index 6b8613e3f87f..4825b65c68c3 100644 --- a/Marlin/src/HAL/STM32/tft/tft_spi.h +++ b/Marlin/src/HAL/STM32/tft/tft_spi.h @@ -60,7 +60,7 @@ class TFT_SPI { static bool isBusy(); static void Abort(); - static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT); + static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT); static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); }; static void DataTransferAbort(); diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp index 6dabcde51ead..7898e9f2bcc1 100644 --- a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp @@ -77,7 +77,7 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb // Not every MarlinSerial port should handle emergency parsing. // It would not make sense to parse GCode from TMC responses, for example. constexpr bool serial_handles_emergency(int port) { - return false + return (false #ifdef SERIAL_PORT || (SERIAL_PORT) == port #endif @@ -87,7 +87,7 @@ constexpr bool serial_handles_emergency(int port) { #ifdef LCD_SERIAL_PORT || (LCD_SERIAL_PORT) == port #endif - ; + ); } #define DEFINE_HWSERIAL_MARLIN(name, n) \ diff --git a/Marlin/src/HAL/STM32F1/sdio.cpp b/Marlin/src/HAL/STM32F1/sdio.cpp index 6e41d2cbf1b4..b00be302179d 100644 --- a/Marlin/src/HAL/STM32F1/sdio.cpp +++ b/Marlin/src/HAL/STM32F1/sdio.cpp @@ -136,8 +136,13 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) { } bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { - uint32_t retries = SDIO_READ_RETRIES; - while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true; + uint8_t retries = SDIO_READ_RETRIES; + while (retries--) { + if (SDIO_ReadBlock_DMA(blockAddress, data)) return true; + #if SD_RETRY_DELAY_MS + delay(SD_RETRY_DELAY_MS); + #endif + } return false; } diff --git a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp index 512e70cf3f70..1e4dfec8a690 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp +++ b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp @@ -20,6 +20,8 @@ * */ +#ifdef __STM32F1__ + #include "../../../inc/MarlinConfig.h" #if HAS_FSMC_TFT @@ -245,6 +247,8 @@ void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Count); dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); + + TERN_(TFT_SHARED_IO, while (isBusy())); } void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { @@ -260,3 +264,5 @@ void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) } #endif // HAS_FSMC_TFT + +#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h index 8d26f6eac0b7..0db7f559b67a 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h @@ -30,6 +30,13 @@ #include +#ifndef FSMC_DMA_DEV + #define FSMC_DMA_DEV DMA2 +#endif +#ifndef FSMC_DMA_CHANNEL + #define FSMC_DMA_CHANNEL DMA_CH5 +#endif + #define DATASIZE_8BIT DMA_SIZE_8BITS #define DATASIZE_16BIT DMA_SIZE_16BITS #define TFT_IO_DRIVER TFT_FSMC @@ -58,7 +65,7 @@ class TFT_FSMC { static bool isBusy(); static void Abort(); - static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) {}; + static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) {}; static void DataTransferEnd() {}; static void WriteData(uint16_t Data) { Transmit(Data); } diff --git a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp index bb495d5f58b5..eed52f4e8a38 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp +++ b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp @@ -20,6 +20,8 @@ * */ +#ifdef __STM32F1__ + #include "../../../inc/MarlinConfig.h" #if HAS_SPI_TFT @@ -154,7 +156,7 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun DataTransferBegin(); SPIx.dmaSendAsync(Data, Count, MemoryIncrease == DMA_MINC_ENABLE); - TERN_(TFT_SHARED_SPI, while (isBusy())); + TERN_(TFT_SHARED_IO, while (isBusy())); } void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { @@ -165,3 +167,5 @@ void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) } #endif // HAS_SPI_TFT + +#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/tft/tft_spi.h b/Marlin/src/HAL/STM32F1/tft/tft_spi.h index 2bda8c21f724..573077d21d90 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_spi.h +++ b/Marlin/src/HAL/STM32F1/tft/tft_spi.h @@ -76,7 +76,7 @@ class TFT_SPI { static bool isBusy(); static void Abort(); - static void DataTransferBegin(uint16_t DataWidth = DATA_SIZE_16BIT); + static void DataTransferBegin(uint16_t DataWidth=DATA_SIZE_16BIT); static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); }; static void DataTransferAbort(); diff --git a/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp b/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp index ac9ad072aa05..bf57ba0034b1 100644 --- a/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp +++ b/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp @@ -20,6 +20,8 @@ * */ +#ifdef __STM32F1__ + #include "../../../inc/MarlinConfig.h" #if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS @@ -141,4 +143,6 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) { return result; } -#endif // HAS_TFT_XPT2046 +#endif // HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS + +#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/timers.h b/Marlin/src/HAL/STM32F1/timers.h index 0cd807fc8479..557522f336a2 100644 --- a/Marlin/src/HAL/STM32F1/timers.h +++ b/Marlin/src/HAL/STM32F1/timers.h @@ -81,7 +81,7 @@ typedef uint16_t hal_timer_t; #endif #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE, MKS_ROBIN_E3D, MKS_ROBIN_E3) - // SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM. + // SKR Mini E3 boards use PA8 as FAN0_PIN, so TIMER 1 is used for Fan PWM. #ifdef STM32_HIGH_DENSITY #define MF_TIMER_SERVO0 8 // tone.cpp uses Timer 4 #else diff --git a/Marlin/src/HAL/shared/esp_wifi.cpp b/Marlin/src/HAL/shared/esp_wifi.cpp index a55f5ca39f91..8a6ac2dfa955 100644 --- a/Marlin/src/HAL/shared/esp_wifi.cpp +++ b/Marlin/src/HAL/shared/esp_wifi.cpp @@ -21,6 +21,9 @@ */ #include "../../inc/MarlinConfig.h" + +#if ENABLED(WIFISUPPORT) + #include "Delay.h" void esp_wifi_init(void) { // init ESP01 WIFI module pins @@ -41,3 +44,5 @@ void esp_wifi_init(void) { // init ESP01 WIFI module pi OUT_WRITE(ESP_WIFI_MODULE_ENABLE_PIN, HIGH); #endif } + +#endif // WIFISUPPORT diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 3b704e4f653e..19aaedf7c65d 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -34,6 +34,10 @@ #include "HAL/shared/esp_wifi.h" #include "HAL/shared/cpu_exception/exception_hook.h" +#if ENABLED(WIFISUPPORT) + #include "HAL/shared/esp_wifi.h" +#endif + #ifdef ARDUINO #include #endif @@ -46,6 +50,9 @@ #include "module/settings.h" #include "module/stepper.h" #include "module/temperature.h" +#if ENABLED(FT_MOTION) + #include "module/ft_motion.h" +#endif #include "gcode/gcode.h" #include "gcode/parser.h" @@ -429,7 +436,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { if (has_blocks) gcode.reset_stepper_timeout(ms); // Reset timeout for M18/M84, M85 max 'kill', and laser. // M18 / M84 : Handle steppers inactive time timeout - #if HAS_DISABLE_INACTIVE_AXIS + #if HAS_DISABLE_IDLE_AXES if (gcode.stepper_inactive_time) { static bool already_shutdown_steppers; // = false @@ -439,16 +446,16 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { already_shutdown_steppers = true; // Individual axes will be disabled if configured - TERN_(DISABLE_INACTIVE_X, stepper.disable_axis(X_AXIS)); - TERN_(DISABLE_INACTIVE_Y, stepper.disable_axis(Y_AXIS)); - TERN_(DISABLE_INACTIVE_Z, stepper.disable_axis(Z_AXIS)); - TERN_(DISABLE_INACTIVE_I, stepper.disable_axis(I_AXIS)); - TERN_(DISABLE_INACTIVE_J, stepper.disable_axis(J_AXIS)); - TERN_(DISABLE_INACTIVE_K, stepper.disable_axis(K_AXIS)); - TERN_(DISABLE_INACTIVE_U, stepper.disable_axis(U_AXIS)); - TERN_(DISABLE_INACTIVE_V, stepper.disable_axis(V_AXIS)); - TERN_(DISABLE_INACTIVE_W, stepper.disable_axis(W_AXIS)); - TERN_(DISABLE_INACTIVE_EXTRUDER, stepper.disable_e_steppers()); + TERN_(DISABLE_IDLE_X, stepper.disable_axis(X_AXIS)); + TERN_(DISABLE_IDLE_Y, stepper.disable_axis(Y_AXIS)); + TERN_(DISABLE_IDLE_Z, stepper.disable_axis(Z_AXIS)); + TERN_(DISABLE_IDLE_I, stepper.disable_axis(I_AXIS)); + TERN_(DISABLE_IDLE_J, stepper.disable_axis(J_AXIS)); + TERN_(DISABLE_IDLE_K, stepper.disable_axis(K_AXIS)); + TERN_(DISABLE_IDLE_U, stepper.disable_axis(U_AXIS)); + TERN_(DISABLE_IDLE_V, stepper.disable_axis(V_AXIS)); + TERN_(DISABLE_IDLE_W, stepper.disable_axis(W_AXIS)); + TERN_(DISABLE_IDLE_E, stepper.disable_e_steppers()); TERN_(AUTO_BED_LEVELING_UBL, bedlevel.steppers_were_disabled()); } @@ -520,8 +527,8 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { if (ELAPSED(ms, next_cub_ms_##N)) { \ next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \ CODE; \ - queue.inject(F(BUTTON##N##_GCODE)); \ - TERN_(HAS_MARLINUI_MENU, ui.quick_feedback()); \ + queue.inject(F(BUTTON##N##_GCODE)); \ + TERN_(HAS_MARLINUI_MENU, ui.quick_feedback()); \ } \ } \ }while(0) @@ -669,7 +676,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { && ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS)) && !planner.has_blocks_queued() ) { - #if ENABLED(SWITCHING_EXTRUDER) + #if HAS_SWITCHING_EXTRUDER bool oldstatus; switch (active_extruder) { default: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 0); stepper.ENABLE_EXTRUDER(0); break; @@ -683,7 +690,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { #endif // E_STEPPERS > 2 #endif // E_STEPPERS > 1 } - #else // !SWITCHING_EXTRUDER + #else // !HAS_SWITCHING_EXTRUDER bool oldstatus; switch (active_extruder) { default: @@ -699,7 +706,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { planner.set_e_position_mm(olde); planner.synchronize(); - #if ENABLED(SWITCHING_EXTRUDER) + #if HAS_SWITCHING_EXTRUDER switch (active_extruder) { default: if (oldstatus) stepper.ENABLE_EXTRUDER(0); else stepper.DISABLE_EXTRUDER(0); break; #if E_STEPPERS > 1 @@ -709,12 +716,12 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { #endif // E_STEPPERS > 2 #endif // E_STEPPERS > 1 } - #else // !SWITCHING_EXTRUDER + #else // !HAS_SWITCHING_EXTRUDER switch (active_extruder) { #define _CASE_RESTORE(N) case N: if (oldstatus) stepper.ENABLE_EXTRUDER(N); else stepper.DISABLE_EXTRUDER(N); break; REPEAT(E_STEPPERS, _CASE_RESTORE); } - #endif // !SWITCHING_EXTRUDER + #endif // !HAS_SWITCHING_EXTRUDER gcode.reset_stepper_timeout(ms); } @@ -881,8 +888,12 @@ void idle(bool no_stepper_sleep/*=false*/) { // Update the LVGL interface TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER()); + // Manage Fixed-time Motion Control + TERN_(FT_MOTION, fxdTiCtrl.loop()); + IDLE_DONE: TERN_(MARLIN_DEV_MODE, idle_depth--); + return; } @@ -1270,7 +1281,9 @@ void setup() { SETUP_RUN(hal.init_board()); - SETUP_RUN(esp_wifi_init()); + #if ENABLED(WIFISUPPORT) + SETUP_RUN(esp_wifi_init()); + #endif // Report Reset Reason if (mcu & RST_POWER_ON) SERIAL_ECHOLNPGM(STR_POWERUP); diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index bdf86392c97f..147080542d81 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -381,6 +381,8 @@ #define BOARD_ZONESTAR_ZM3E4V2 5064 // Zonestar ZM3E4 V2 (STM32F103VC) #define BOARD_ERYONE_ERY32_MINI 5065 // Eryone Ery32 mini (STM32F103VE) #define BOARD_PANDA_PI_V29 5066 // Panda Pi V2.9 - Standalone (STM32F103RC) +#define BOARD_SOVOL_V131 5067 // Sovol V1.3.1 (GD32F103RET6) +#define BOARD_TRIGORILLA_V006 5068 // Trigorilla V0.0.6 (GD32F103RE) // // ARM Cortex-M4F @@ -452,6 +454,7 @@ #define BOARD_BTT_SKR_SE_BX_V3 6005 // BigTreeTech SKR SE BX V3.0 (STM32H743II) #define BOARD_BTT_SKR_V3_0 6006 // BigTreeTech SKR V3.0 (STM32H743VG) #define BOARD_BTT_SKR_V3_0_EZ 6007 // BigTreeTech SKR V3.0 EZ (STM32H743VG) +#define BOARD_BTT_OCTOPUS_MAX_EZ_V1_0 6008 // BigTreeTech Octopus Max EZ V1.0 (STM32H723VE / STM32H723ZE) // // Espressif ESP32 WiFi @@ -492,7 +495,7 @@ // Simulations // -#define BOARD_LINUX_RAMPS 9999 +#define BOARD_SIMULATED 9999 #define _MB_1(B) (defined(BOARD_##B) && MOTHERBOARD==BOARD_##B) #define MB(V...) DO(MB,||,V) diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 2d0b23a52998..bf309293ac6c 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -55,6 +55,7 @@ // eu Basque-Euskera // fi Finnish // fr French +// fr_na French without accents (DWIN T5UID1 touchscreen) // gl Galician // hr Croatian // hu Hungarian @@ -229,10 +230,9 @@ #define STR_PID_DEBUG_INPUT ": Input " #define STR_PID_DEBUG_OUTPUT " Output " #define STR_INVALID_EXTRUDER_NUM " - Invalid extruder number !" -#define STR_MPC_AUTOTUNE "MPC Autotune" -#define STR_MPC_AUTOTUNE_START " start for " STR_E -#define STR_MPC_AUTOTUNE_INTERRUPTED " interrupted!" -#define STR_MPC_AUTOTUNE_FINISHED " finished! Put the constants below into Configuration.h" +#define STR_MPC_AUTOTUNE_START "MPC Autotune start for " STR_E +#define STR_MPC_AUTOTUNE_INTERRUPTED "MPC Autotune interrupted!" +#define STR_MPC_AUTOTUNE_FINISHED "MPC Autotune finished! Put the constants below into Configuration.h" #define STR_MPC_COOLING_TO_AMBIENT "Cooling to ambient" #define STR_MPC_HEATING_PAST_200 "Heating to over 200C" #define STR_MPC_MEASURING_AMBIENT "Measuring ambient heatloss at " diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 727b191d0404..64704c1e6cb4 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -85,11 +85,6 @@ void serial_offset(const_float_t v, const uint8_t sp/*=0*/) { SERIAL_DECIMAL(v); } -void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post/*=nullptr*/) { - if (pre) serial_print(pre); - serial_print(onoff ? on : off); - if (post) serial_print(post); -} void serialprint_onoff(const bool onoff) { serial_print(onoff ? F(STR_ON) : F(STR_OFF)); } void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); } void serialprint_truefalse(const bool tf) { serial_print(tf ? F("true") : F("false")); } diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index a1126d74615c..a741d4b1e4d0 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -327,7 +327,12 @@ inline void serial_echolnpair(FSTR_P const fstr, T v) { serial_echolnpair_P(FTOP void serial_echo_start(); void serial_error_start(); -void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr); +inline void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr) { + if (pre) serial_print(pre); + if (onoff && on) serial_print(on); + if (!onoff && off) serial_print(off); + if (post) serial_print(post); +} void serialprint_onoff(const bool onoff); void serialprintln_onoff(const bool onoff); void serialprint_truefalse(const bool tf); diff --git a/Marlin/src/core/serial_base.h b/Marlin/src/core/serial_base.h index a5abd67d8727..059b42428498 100644 --- a/Marlin/src/core/serial_base.h +++ b/Marlin/src/core/serial_base.h @@ -23,6 +23,8 @@ #include "../inc/MarlinConfigPre.h" +#include // for size_t + #if ENABLED(EMERGENCY_PARSER) #include "../feature/e_parser.h" #endif diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index bae345b49625..15d572af6022 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -31,10 +31,8 @@ // // typename IF<(MYOPT==12), int, float>::type myvar; // -template -struct IF { typedef R type; }; -template -struct IF { typedef L type; }; +template struct IF { typedef R type; }; +template struct IF { typedef L type; }; #define ALL_AXIS_NAMES X, X2, Y, Y2, Z, Z2, Z3, Z4, I, J, K, U, V, W, E0, E1, E2, E3, E4, E5, E6, E7 @@ -86,38 +84,54 @@ struct IF { typedef L type; }; #define AXIS_COLLISION(L) (AXIS4_NAME == L || AXIS5_NAME == L || AXIS6_NAME == L || AXIS7_NAME == L || AXIS8_NAME == L || AXIS9_NAME == L) +// Helpers +#define _RECIP(N) ((N) ? 1.0f / static_cast(N) : 0.0f) +#define _ABS(N) ((N) < 0 ? -(N) : (N)) +#define _LS(N) (N = (T)(uint32_t(N) << p)) +#define _RS(N) (N = (T)(uint32_t(N) >> p)) +#define FI FORCE_INLINE + +// Define types based on largest bit width stored value required +#define bits_t(W) typename IF<((W)> 16), uint32_t, typename IF<((W)> 8), uint16_t, uint8_t>::type>::type +#define uvalue_t(V) typename IF<((V)>65535), uint32_t, typename IF<((V)>255), uint16_t, uint8_t>::type>::type +#define value_t(V) typename IF<((V)>32767), int32_t, typename IF<((V)>127), int16_t, int8_t>::type>::type + // General Flags for some number of states template struct Flags { - typedef typename IF<(N>8), uint16_t, uint8_t>::type bits_t; + typedef value_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, + b16:1, b17:1, b18:1, b19:1, b20:1, b21:1, b22:1, b23:1, b24:1, b25:1, b26:1, b27:1, b28:1, b29:1, b30:1, b31:1; } N32; union { - bits_t b; - typename IF<(N>8), N16, N8>::type flag; + flagbits_t b; + typename IF<(N>16), N32, typename IF<(N>8), N16, N8>::type>::type flag; }; - void reset() { b = 0; } - void set(const int n, const bool onoff) { onoff ? set(n) : clear(n); } - void set(const int n) { b |= (bits_t)_BV(n); } - void clear(const int n) { b &= ~(bits_t)_BV(n); } - bool test(const int n) const { return TEST(b, n); } - bool operator[](const int n) { return test(n); } - bool operator[](const int n) const { return test(n); } - int size() const { return sizeof(b); } + FI void reset() { b = 0; } + FI void set(const int n, const bool onoff) { onoff ? set(n) : clear(n); } + FI void set(const int n) { b |= (flagbits_t)_BV(n); } + FI void clear(const int n) { b &= ~(flagbits_t)_BV(n); } + FI bool test(const int n) const { return TEST(b, n); } + FI bool operator[](const int n) { return test(n); } + FI bool operator[](const int n) const { return test(n); } + FI int size() const { return sizeof(b); } + FI operator bool() const { return b; } }; // Specialization for a single bool flag template<> struct Flags<1> { bool b; - void reset() { b = false; } - void set(const int n, const bool onoff) { onoff ? set(n) : clear(n); } - void set(const int) { b = true; } - void clear(const int) { b = false; } - bool test(const int) const { return b; } - bool& operator[](const int) { return b; } - bool operator[](const int) const { return b; } - int size() const { return sizeof(b); } + FI void reset() { b = false; } + FI void set(const int n, const bool onoff) { onoff ? set(n) : clear(n); } + FI void set(const int) { b = true; } + FI void clear(const int) { b = false; } + FI bool test(const int) const { return b; } + FI bool& operator[](const int) { return b; } + FI bool operator[](const int) const { return b; } + FI int size() const { return sizeof(b); } + FI operator bool() const { return b; } }; typedef Flags<8> flags_8_t; @@ -129,14 +143,15 @@ typedef struct AxisFlags { struct Flags flags; struct { bool LOGICAL_AXIS_LIST(e:1, x:1, y:1, z:1, i:1, j:1, k:1, u:1, v:1, w:1); }; }; - void reset() { flags.reset(); } - void set(const int n) { flags.set(n); } - void set(const int n, const bool onoff) { flags.set(n, onoff); } - void clear(const int n) { flags.clear(n); } - bool test(const int n) const { return flags.test(n); } - bool operator[](const int n) { return flags[n]; } - bool operator[](const int n) const { return flags[n]; } - int size() const { return sizeof(flags); } + FI void reset() { flags.reset(); } + FI void set(const int n) { flags.set(n); } + FI void set(const int n, const bool onoff) { flags.set(n, onoff); } + FI void clear(const int n) { flags.clear(n); } + FI bool test(const int n) const { return flags.test(n); } + FI bool operator[](const int n) { return flags[n]; } + FI bool operator[](const int n) const { return flags[n]; } + FI int size() const { return sizeof(flags); } + FI operator bool() const { return flags; } } axis_flags_t; // @@ -182,7 +197,7 @@ enum AxisEnum : uint8_t { , ALL_AXES_ENUM = 0xFE, NO_AXIS_ENUM = 0xFF }; -typedef IF<(NUM_AXIS_ENUMS > 8), uint16_t, uint8_t>::type axis_bits_t; +typedef bits_t(NUM_AXIS_ENUMS) axis_bits_t; // // Loop over axes @@ -225,13 +240,6 @@ typedef const_float_t const_celsius_float_t; // Coordinates structures for XY, XYZ, XYZE... // -// Helpers -#define _RECIP(N) ((N) ? 1.0f / static_cast(N) : 0.0f) -#define _ABS(N) ((N) < 0 ? -(N) : (N)) -#define _LS(N) (N = (T)(uint32_t(N) << p)) -#define _RS(N) (N = (T)(uint32_t(N) >> p)) -#define FI FORCE_INLINE - // Forward declarations template struct XYval; template struct XYZval; diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index 2731e62b6754..c4bb3c2a8a3d 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -38,12 +38,12 @@ void safe_delay(millis_t ms); // Delay ensuring that temperatures are // 16x16 bit arrays template struct FlagBits { - typename IF<(W>8), uint16_t, uint8_t>::type bits[H]; - void fill() { memset(bits, 0xFF, sizeof(bits)); } - void reset() { memset(bits, 0x00, sizeof(bits)); } - void unmark(const uint8_t x, const uint8_t y) { CBI(bits[y], x); } - void mark(const uint8_t x, const uint8_t y) { SBI(bits[y], x); } - bool marked(const uint8_t x, const uint8_t y) { return TEST(bits[y], x); } + bits_t(W) flags[H]; + void fill() { memset(flags, 0xFF, sizeof(flags)); } + void reset() { memset(flags, 0x00, sizeof(flags)); } + void unmark(const uint8_t x, const uint8_t y) { CBI(flags[y], x); } + void mark(const uint8_t x, const uint8_t y) { SBI(flags[y], x); } + bool marked(const uint8_t x, const uint8_t y) { return TEST(flags[y], x); } inline void unmark(const xy_int8_t &xy) { unmark(xy.x, xy.y); } inline void mark(const xy_int8_t &xy) { mark(xy.x, xy.y); } inline bool marked(const xy_int8_t &xy) { return marked(xy.x, xy.y); } diff --git a/Marlin/src/feature/bedlevel/abl/bbl.cpp b/Marlin/src/feature/bedlevel/abl/bbl.cpp index d0044303c791..6ef3945fa52c 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.cpp +++ b/Marlin/src/feature/bedlevel/abl/bbl.cpp @@ -175,13 +175,13 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr xy_float_t LevelingBilinear::grid_factor_virt; #define LINEAR_EXTRAPOLATION(E, I) ((E) * 2 - (I)) - float LevelingBilinear::bed_level_virt_coord(const uint8_t x, const uint8_t y) { + float LevelingBilinear::virt_coord(const uint8_t x, const uint8_t y) { uint8_t ep = 0, ip = 1; if (x > (GRID_MAX_POINTS_X) + 1 || y > (GRID_MAX_POINTS_Y) + 1) { // The requested point requires extrapolating two points beyond the mesh. // These values are only requested for the edges of the mesh, which are always an actual mesh point, // and do not require interpolation. When interpolation is not needed, this "Mesh + 2" point is - // cancelled out in bed_level_virt_cmr and does not impact the result. Return 0.0 rather than + // cancelled out in virt_cmr and does not impact the result. Return 0.0 rather than // making this function more complex by extrapolating two points. return 0.0; } @@ -197,8 +197,8 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr ); else return LINEAR_EXTRAPOLATION( - bed_level_virt_coord(ep + 1, y), - bed_level_virt_coord(ip + 1, y) + virt_coord(ep + 1, y), + virt_coord(ip + 1, y) ); } if (!y || y == ABL_TEMP_POINTS_Y - 1) { @@ -213,14 +213,14 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr ); else return LINEAR_EXTRAPOLATION( - bed_level_virt_coord(x, ep + 1), - bed_level_virt_coord(x, ip + 1) + virt_coord(x, ep + 1), + virt_coord(x, ip + 1) ); } return z_values[x - 1][y - 1]; } - float LevelingBilinear::bed_level_virt_cmr(const float p[4], const uint8_t i, const float t) { + float LevelingBilinear::virt_cmr(const float p[4], const uint8_t i, const float t) { return ( p[i-1] * -t * sq(1 - t) + p[i] * (2 - 5 * sq(t) + 3 * t * sq(t)) @@ -229,18 +229,18 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr ) * 0.5f; } - float LevelingBilinear::bed_level_virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty) { + float LevelingBilinear::virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty) { float row[4], column[4]; LOOP_L_N(i, 4) { LOOP_L_N(j, 4) { - column[j] = bed_level_virt_coord(i + x - 1, j + y - 1); + column[j] = virt_coord(i + x - 1, j + y - 1); } - row[i] = bed_level_virt_cmr(column, 1, ty); + row[i] = virt_cmr(column, 1, ty); } - return bed_level_virt_cmr(row, 1, tx); + return virt_cmr(row, 1, tx); } - void LevelingBilinear::bed_level_virt_interpolate() { + void LevelingBilinear::subdivide_mesh() { grid_spacing_virt = grid_spacing / (BILINEAR_SUBDIVISIONS); grid_factor_virt = grid_spacing_virt.reciprocal(); LOOP_L_N(y, GRID_MAX_POINTS_Y) @@ -250,12 +250,7 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr if ((ty && y == (GRID_MAX_POINTS_Y) - 1) || (tx && x == (GRID_MAX_POINTS_X) - 1)) continue; z_values_virt[x * (BILINEAR_SUBDIVISIONS) + tx][y * (BILINEAR_SUBDIVISIONS) + ty] = - bed_level_virt_2cmr( - x + 1, - y + 1, - (float)tx / (BILINEAR_SUBDIVISIONS), - (float)ty / (BILINEAR_SUBDIVISIONS) - ); + virt_2cmr(x + 1, y + 1, (float)tx / (BILINEAR_SUBDIVISIONS), (float)ty / (BILINEAR_SUBDIVISIONS)); } } @@ -263,7 +258,7 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr // Refresh after other values have been updated void LevelingBilinear::refresh_bed_level() { - TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate()); + TERN_(ABL_BILINEAR_SUBDIVISION, subdivide_mesh()); cached_rel.x = cached_rel.y = -999.999; cached_g.x = cached_g.y = -99; } diff --git a/Marlin/src/feature/bedlevel/abl/bbl.h b/Marlin/src/feature/bedlevel/abl/bbl.h index 60dde9060f58..ca2e96593fde 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.h +++ b/Marlin/src/feature/bedlevel/abl/bbl.h @@ -43,10 +43,10 @@ class LevelingBilinear { static xy_pos_t grid_spacing_virt; static xy_float_t grid_factor_virt; - static float bed_level_virt_coord(const uint8_t x, const uint8_t y); - static float bed_level_virt_cmr(const float p[4], const uint8_t i, const float t); - static float bed_level_virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty); - static void bed_level_virt_interpolate(); + static float virt_coord(const uint8_t x, const uint8_t y); + static float virt_cmr(const float p[4], const uint8_t i, const float t); + static float virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty); + static void subdivide_mesh(); #endif public: diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index f2af1445b1f0..b7ee6aeef8a2 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -59,7 +59,7 @@ void unified_bed_leveling::report_current_mesh() { void unified_bed_leveling::report_state() { echo_name(); - SERIAL_ECHO_TERNARY(planner.leveling_active, " System v" UBL_VERSION " ", "", "in", "active\n"); + serial_ternary(planner.leveling_active, F(" System v" UBL_VERSION " "), nullptr, F("in"), F("active\n")); serial_delay(50); } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index ae69e3cd9288..05a937c9853d 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -264,9 +264,9 @@ class unified_bed_leveling { return UBL_Z_RAISE_WHEN_OFF_MESH; #endif - const uint8_t mx = _MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1, my = _MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1, - x0 = get_mesh_x(cx), x1 = get_mesh_x(cx + 1); - const float z1 = calc_z0(rx0, x0, z_values[cx][cy], x1, z_values[mx][cy]), + const uint8_t mx = _MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1, my = _MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1; + const float x0 = get_mesh_x(cx), x1 = get_mesh_x(cx + 1), + z1 = calc_z0(rx0, x0, z_values[cx][cy], x1, z_values[mx][cy]), z2 = calc_z0(rx0, x0, z_values[cx][my], x1, z_values[mx][my]); float z0 = calc_z0(ry0, get_mesh_y(cy), z1, get_mesh_y(cy + 1), z2); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 02efb3e06555..d9205b757769 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -306,16 +306,13 @@ void unified_bed_leveling::G29() { const uint8_t p_val = parser.byteval('P'); const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J'); - #if HAS_MULTI_HOTEND - const uint8_t old_tool_index = active_extruder; - #endif // Check for commands that require the printer to be homed if (may_move) { planner.synchronize(); // Send 'N' to force homing before G29 (internal only) if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes(); - TERN_(HAS_MULTI_HOTEND, if (active_extruder != 0) tool_change(0, true)); + probe.use_probing_tool(); // Position bed horizontally and Z probe vertically. #if HAS_SAFE_BED_LEVELING @@ -696,7 +693,7 @@ void unified_bed_leveling::G29() { UNUSED(probe_deployed); #endif - TERN_(HAS_MULTI_HOTEND, if (old_tool_index != 0) tool_change(old_tool_index)); + probe.use_probing_tool(false); return; } @@ -1479,82 +1476,41 @@ void unified_bed_leveling::smart_fill_mesh() { void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_3_pt_leveling) { - #ifdef G29J_MESH_TILT_MARGIN - const float x_min = _MAX(probe.min_x() + (G29J_MESH_TILT_MARGIN), X_MIN_POS), - x_max = _MIN(probe.max_x() - (G29J_MESH_TILT_MARGIN), X_MAX_POS), - y_min = _MAX(probe.min_y() + (G29J_MESH_TILT_MARGIN), Y_MIN_POS), - y_max = _MIN(probe.max_y() - (G29J_MESH_TILT_MARGIN), Y_MAX_POS); - #else - const float x_min = probe.min_x(), x_max = probe.max_x(), - y_min = probe.min_y(), y_max = probe.max_y(); - #endif - const float dx = (x_max - x_min) / (param.J_grid_size - 1), - dy = (y_max - y_min) / (param.J_grid_size - 1); - - xy_float_t points[3]; - probe.get_three_points(points); - float measured_z; bool abort_flag = false; - #if ENABLED(VALIDATE_MESH_TILT) - float z1, z2, z3; // Needed for algorithm validation below - #endif - struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); if (do_3_pt_leveling) { - SERIAL_ECHOLNPGM("Tilting mesh (1/3)"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); - - measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity); - if (isnan(measured_z)) - abort_flag = true; - else { - measured_z -= get_z_correction(points[0]); - TERN_(VALIDATE_MESH_TILT, z1 = measured_z); - if (param.V_verbosity > 3) { - serial_spaces(16); - SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); + xy_float_t points[3]; + probe.get_three_points(points); + + #if ENABLED(UBL_TILT_ON_MESH_POINTS_3POINT) + mesh_index_pair cpos[3]; + LOOP_L_N(ix, 3) { // Convert points to coordinates of mesh points + cpos[ix] = find_closest_mesh_point_of_type(REAL, points[ix], true); + points[ix] = cpos[ix].meshpos(); } - incremental_LSF(&lsf_results, points[0], measured_z); - } + #endif - if (!abort_flag) { - SERIAL_ECHOLNPGM("Tilting mesh (2/3)"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); + #if ENABLED(VALIDATE_MESH_TILT) + float gotz[3]; // Used for algorithm validation below + #endif - measured_z = probe.probe_at_point(points[1], PROBE_PT_RAISE, param.V_verbosity); - TERN_(VALIDATE_MESH_TILT, z2 = measured_z); - if (isnan(measured_z)) - abort_flag = true; - else { - measured_z -= get_z_correction(points[1]); - if (param.V_verbosity > 3) { - serial_spaces(16); - SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); - } - incremental_LSF(&lsf_results, points[1], measured_z); - } - } + LOOP_L_N(i, 3) { + SERIAL_ECHOLNPGM("Tilting mesh (", i + 1, "/3)"); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/3"), i + 1, GET_TEXT(MSG_LCD_TILTING_MESH))); - if (!abort_flag) { - SERIAL_ECHOLNPGM("Tilting mesh (3/3)"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH))); + measured_z = probe.probe_at_point(points[i], i < 2 ? PROBE_PT_RAISE : PROBE_PT_LAST_STOW, param.V_verbosity); + if ((abort_flag = isnan(measured_z))) break; - measured_z = probe.probe_at_point(points[2], PROBE_PT_LAST_STOW, param.V_verbosity); - TERN_(VALIDATE_MESH_TILT, z3 = measured_z); - if (isnan(measured_z)) - abort_flag = true; - else { - measured_z -= get_z_correction(points[2]); - if (param.V_verbosity > 3) { - serial_spaces(16); - SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); - } - incremental_LSF(&lsf_results, points[2], measured_z); - } + measured_z -= TERN(UBL_TILT_ON_MESH_POINTS_3POINT, z_values[cpos[i].pos.x][cpos[i].pos.y], get_z_correction(points[i])); + TERN_(VALIDATE_MESH_TILT, gotz[i] = measured_z); + + if (param.V_verbosity > 3) { serial_spaces(16); SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); } + + incremental_LSF(&lsf_results, points[i], measured_z); } probe.stow(); @@ -1567,54 +1523,77 @@ void unified_bed_leveling::smart_fill_mesh() { } else { // !do_3_pt_leveling + #ifndef G29J_MESH_TILT_MARGIN + #define G29J_MESH_TILT_MARGIN 0 + #endif + const float x_min = _MAX((X_MIN_POS) + (G29J_MESH_TILT_MARGIN), MESH_MIN_X, probe.min_x()), + x_max = _MIN((X_MAX_POS) - (G29J_MESH_TILT_MARGIN), MESH_MAX_X, probe.max_x()), + y_min = _MAX((Y_MIN_POS) + (G29J_MESH_TILT_MARGIN), MESH_MIN_Y, probe.min_y()), + y_max = _MIN((Y_MAX_POS) - (G29J_MESH_TILT_MARGIN), MESH_MAX_Y, probe.max_y()), + dx = (x_max - x_min) / (param.J_grid_size - 1), + dy = (y_max - y_min) / (param.J_grid_size - 1); + bool zig_zag = false; const uint16_t total_points = sq(param.J_grid_size); uint16_t point_num = 1; - xy_pos_t rpos; LOOP_L_N(ix, param.J_grid_size) { + xy_pos_t rpos; rpos.x = x_min + ix * dx; LOOP_L_N(iy, param.J_grid_size) { rpos.y = y_min + dy * (zig_zag ? param.J_grid_size - 1 - iy : iy); - if (!abort_flag) { - SERIAL_ECHOLNPGM("Tilting mesh point ", point_num, "/", total_points, "\n"); - TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points)); - - measured_z = probe.probe_at_point(rpos, parser.seen_test('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling - - abort_flag = isnan(measured_z); - + #if ENABLED(UBL_TILT_ON_MESH_POINTS) #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - const xy_pos_t lpos = rpos.asLogical(); - DEBUG_CHAR('('); - DEBUG_ECHO_F(rpos.x, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(rpos.y, 7); - DEBUG_ECHOPAIR_F(") logical: (", lpos.x, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(lpos.y, 7); - DEBUG_ECHOPAIR_F(") measured: ", measured_z, 7); - DEBUG_ECHOPAIR_F(" correction: ", get_z_correction(rpos), 7); - } + xy_pos_t oldRpos; + if (DEBUGGING(LEVELING)) oldRpos = rpos; #endif + mesh_index_pair cpos; + rpos -= probe.offset; + cpos = find_closest_mesh_point_of_type(REAL, rpos, true); + rpos = cpos.meshpos(); + #endif - measured_z -= get_z_correction(rpos) /* + probe.offset.z */ ; + SERIAL_ECHOLNPGM("Tilting mesh point ", point_num, "/", total_points, "\n"); + TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points)); - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_F(" final >>>---> ", measured_z, 7); + measured_z = probe.probe_at_point(rpos, parser.seen_test('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling - if (param.V_verbosity > 3) { - serial_spaces(16); - SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); + if ((abort_flag = isnan(measured_z))) break; + + const float zcorr = TERN(UBL_TILT_ON_MESH_POINTS, z_values[cpos.pos.x][cpos.pos.y], get_z_correction(rpos)); + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + const xy_pos_t lpos = rpos.asLogical(); + #if ENABLED(UBL_TILT_ON_MESH_POINTS) + const xy_pos_t oldLpos = oldRpos.asLogical(); + DEBUG_ECHOPGM("Calculated point: ("); DEBUG_ECHO_F(oldRpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(oldRpos.y, 7); + DEBUG_ECHOPAIR_F(") logical: (", oldLpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(oldLpos.y, 7); + DEBUG_ECHOPGM(")\nSelected mesh point: "); + #endif + DEBUG_CHAR('('); DEBUG_ECHO_F(rpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(rpos.y, 7); + DEBUG_ECHOPAIR_F(") logical: (", lpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(lpos.y, 7); + DEBUG_ECHOPAIR_F(") measured: ", measured_z, 7); + DEBUG_ECHOPAIR_F(" correction: ", zcorr, 7); } - incremental_LSF(&lsf_results, rpos, measured_z); + #endif + + measured_z -= zcorr; + + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_F(" final >>>---> ", measured_z, 7); + + if (param.V_verbosity > 3) { + serial_spaces(16); + SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); } + incremental_LSF(&lsf_results, rpos, measured_z); point_num++; } + if (abort_flag) break; zig_zag ^= true; } } @@ -1696,20 +1675,23 @@ void unified_bed_leveling::smart_fill_mesh() { auto normed = [&](const xy_pos_t &pos, const_float_t zadd) { return normal.x * pos.x + normal.y * pos.y + zadd; }; - auto debug_pt = [](FSTR_P const pre, const xy_pos_t &pos, const_float_t zadd) { - d_from(); SERIAL_ECHOF(pre); + auto debug_pt = [](const int num, const xy_pos_t &pos, const_float_t zadd) { + d_from(); DEBUG_ECHOPGM("Point ", num, ":"); DEBUG_ECHO_F(normed(pos, zadd), 6); DEBUG_ECHOLNPAIR_F(" Z error = ", zadd - get_z_correction(pos), 6); }; - debug_pt(F("1st point: "), probe_pt[0], normal.z * z1); - debug_pt(F("2nd point: "), probe_pt[1], normal.z * z2); - debug_pt(F("3rd point: "), probe_pt[2], normal.z * z3); - d_from(); DEBUG_ECHOPGM("safe home with Z="); - DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_homing_xy, 0), 6); - d_from(); DEBUG_ECHOPGM("safe home with Z="); - DEBUG_ECHOLNPAIR_F("mesh value ", normed(safe_homing_xy, get_z_correction(safe_homing_xy)), 6); - DEBUG_ECHOPGM(" Z error = (", Z_SAFE_HOMING_X_POINT, ",", Z_SAFE_HOMING_Y_POINT); - DEBUG_ECHOLNPAIR_F(") = ", get_z_correction(safe_homing_xy), 6); + debug_pt(1, probe_pt[0], normal.z * gotz[0]); + debug_pt(2, probe_pt[1], normal.z * gotz[1]); + debug_pt(3, probe_pt[2], normal.z * gotz[2]); + #if ENABLED(Z_SAFE_HOMING) + constexpr xy_float_t safe_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT }; + d_from(); DEBUG_ECHOPGM("safe home with Z="); + DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_xy, 0), 6); + d_from(); DEBUG_ECHOPGM("safe home with Z="); + DEBUG_ECHOLNPAIR_F("mesh value ", normed(safe_xy, get_z_correction(safe_xy)), 6); + DEBUG_ECHOPGM(" Z error = (", Z_SAFE_HOMING_X_POINT, ",", Z_SAFE_HOMING_Y_POINT); + DEBUG_ECHOLNPAIR_F(") = ", get_z_correction(safe_xy), 6); + #endif #endif } // DEBUGGING(LEVELING) diff --git a/Marlin/src/feature/direct_stepping.h b/Marlin/src/feature/direct_stepping.h index 962310281edb..b8a803f8115b 100644 --- a/Marlin/src/feature/direct_stepping.h +++ b/Marlin/src/feature/direct_stepping.h @@ -80,9 +80,6 @@ namespace DirectStepping { static void set_page_state(const page_idx_t page_idx, const PageState page_state); }; - template struct TypeSelector { typedef T type;} ; - template struct TypeSelector { typedef F type; }; - template struct config_t { static constexpr char CONTROL_CHAR = '!'; @@ -98,8 +95,8 @@ namespace DirectStepping { static constexpr int TOTAL_STEPS = SEGMENT_STEPS * SEGMENTS; static constexpr int PAGE_SIZE = (AXIS_COUNT * BITS_SEGMENT * SEGMENTS) / 8; - typedef typename TypeSelector<(PAGE_SIZE>256), uint16_t, uint8_t>::type write_byte_idx_t; - typedef typename TypeSelector<(PAGE_COUNT>256), uint16_t, uint8_t>::type page_idx_t; + typedef uvalue_t(PAGE_SIZE - 1) write_byte_idx_t; + typedef uvalue_t(PAGE_COUNT - 1) page_idx_t; }; template diff --git a/Marlin/src/feature/easythreed_ui.cpp b/Marlin/src/feature/easythreed_ui.cpp index b15daffc09be..39248bfc7d78 100644 --- a/Marlin/src/feature/easythreed_ui.cpp +++ b/Marlin/src/feature/easythreed_ui.cpp @@ -190,31 +190,28 @@ void EasythreedUI::printButton() { print_key_flag = PF_PAUSE; // The "Print" button now pauses the print card.mount(); // Force SD card to mount - now! if (!card.isMounted) { // Failed to mount? - blink_interval_ms = LED_OFF; // Turn off LED - print_key_flag = PF_START; - return; // Bail out + blink_interval_ms = LED_OFF; // Turn off LED + print_key_flag = PF_START; + return; // Bail out } card.ls(); // List all files to serial output - const uint16_t filecnt = card.countFilesInWorkDir(); // Count printable files in cwd + const int16_t filecnt = card.get_num_items(); // Count printable files in cwd if (filecnt == 0) return; // None are printable? card.selectFileByIndex(filecnt); // Select the last file according to current sort options card.openAndPrintFile(card.filename); // Start printing it - break; - } + } break; case PF_PAUSE: { // Pause printing (not currently firing) if (!printingIsActive()) break; blink_interval_ms = LED_ON; // Set indicator to steady ON queue.inject(F("M25")); // Queue Pause print_key_flag = PF_RESUME; // The "Print" button now resumes the print - break; - } + } break; case PF_RESUME: { // Resume printing if (printingIsActive()) break; blink_interval_ms = LED_BLINK_2; // Blink the indicator LED at 1 second intervals queue.inject(F("M24")); // Queue resume print_key_flag = PF_PAUSE; // The "Print" button now pauses the print - break; - } + } break; } } else { // Register a longer press diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index 7c8d018013fa..3801ded6aa45 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -66,7 +66,7 @@ // Types // ------------------------ -typedef IF<(TERN0(NEOPIXEL_LED, NEOPIXEL_PIXELS > 127)), int16_t, int8_t>::type pixel_index_t; +typedef value_t(TERN0(NEOPIXEL_LED, NEOPIXEL_PIXELS)) pixel_index_t; // ------------------------ // Classes diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 2fdfcba32d21..efc992f80fe1 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -44,6 +44,7 @@ #include "max7219.h" #include "../module/planner.h" +#include "../module/stepper.h" #include "../MarlinCore.h" #include "../HAL/shared/Delay.h" @@ -471,7 +472,7 @@ void Max7219::register_setup() { constexpr millis_t pattern_delay = 4; int8_t spiralx, spiraly, spiral_dir; - IF<(MAX7219_LEDS > 255), uint16_t, uint8_t>::type spiral_count; + uvalue_t(MAX7219_LEDS) spiral_count; void Max7219::test_pattern() { constexpr int8_t way[][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } }; @@ -723,6 +724,19 @@ void Max7219::idle_tasks() { } #endif + #ifdef MAX7219_DEBUG_MULTISTEPPING + static uint8_t last_multistepping = 0; + const uint8_t multistepping = Stepper::steps_per_isr; + if (multistepping != last_multistepping) { + static uint8_t log2_old = 0; + uint8_t log2_new = 0; + for (uint8_t val = multistepping; val > 1; val >>= 1) log2_new++; + mark16(MAX7219_DEBUG_MULTISTEPPING, log2_old, log2_new, &row_change_mask); + last_multistepping = multistepping; + log2_old = log2_new; + } + #endif + // batch line updates suspended--; if (!suspended) diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index b1a069e3205e..cf88b806f542 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -24,8 +24,6 @@ #if ENABLED(MIXING_EXTRUDER) -//#define MIXER_NORMALIZER_DEBUG - #include "mixing.h" Mixer mixer; diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index 85d52d69c8f3..3a14fdad5975 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -148,8 +148,7 @@ class Mixer { static void update_mix_from_vtool(const uint8_t j=selected_vtool) { float ctot = 0; MIXER_STEPPER_LOOP(i) ctot += color[j][i]; - //MIXER_STEPPER_LOOP(i) mix[i] = 100.0f * color[j][i] / ctot; - MIXER_STEPPER_LOOP(i) mix[i] = mixer_perc_t(100.0f * color[j][i] / ctot); + MIXER_STEPPER_LOOP(i) mix[i] = mixer_perc_t(100.0f * color[j][i] / ctot + 0.5f); #ifdef MIXER_NORMALIZER_DEBUG SERIAL_ECHOPGM("V-tool ", j, " [ "); diff --git a/Marlin/src/feature/mmu/mmu2-serial-protocol.md b/Marlin/src/feature/mmu/mmu2-serial-protocol.md index 93135e406f36..42f30e418d1d 100644 --- a/Marlin/src/feature/mmu/mmu2-serial-protocol.md +++ b/Marlin/src/feature/mmu/mmu2-serial-protocol.md @@ -91,4 +91,3 @@ Eject filament - MMU <= 'E*Filament index*\n' - MMU => 'ok\n' - diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index 4f86578a60a7..7b6a48954b61 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -815,8 +815,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) { resume_hotend_temp = thermalManager.degTargetHotend(active_extruder); resume_position = current_position; - if (move_axes && all_axes_homed()) - nozzle.park(0, park_point /*= NOZZLE_PARK_POINT*/); + if (move_axes && all_axes_homed()) nozzle.park(0, park_point); if (turn_off_nozzle) thermalManager.setTargetHotend(0, active_extruder); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 83d149fa09e7..488f5920c25e 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -234,6 +234,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load TERN_(BELTPRINTER, do_blocking_move_to_xy(0.00, 50.00)); + TERN_(MPCTEMP, MPC::e_paused = true); + // Slow Load filament if (slow_load_length) unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE); @@ -297,6 +299,9 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load } while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)); #endif + + TERN_(MPCTEMP, MPC::e_paused = false); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end()); return true; diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index faec893928e6..29c4695ca476 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -113,6 +113,7 @@ void PrintJobRecovery::changed() { purge(); else if (IS_SD_PRINTING()) save(true); + TERN_(EXTENSIBLE_UI, ExtUI::onSetPowerLoss(enabled)); } /** diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 98b6bd051061..44ebd85b327f 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -47,7 +47,7 @@ bool FilamentMonitorBase::enabled = true, #if HAS_FILAMENT_RUNOUT_DISTANCE float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM; - volatile float RunoutResponseDelayed::runout_mm_countdown[NUM_RUNOUT_SENSORS]; + volatile countdown_t RunoutResponseDelayed::mm_countdown; #if ENABLED(FILAMENT_MOTION_SENSOR) uint8_t FilamentSensorEncoder::motion_detected; #endif diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index e74d857a79ed..e839db3f5edf 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -43,12 +43,18 @@ #define FILAMENT_RUNOUT_THRESHOLD 5 #endif +#if ENABLED(FILAMENT_MOTION_SENSOR) + #define HAS_FILAMENT_MOTION 1 +#endif +#if DISABLED(FILAMENT_MOTION_SENSOR) || ENABLED(FILAMENT_SWITCH_AND_MOTION) + #define HAS_FILAMENT_SWITCH 1 +#endif + void event_filament_runout(const uint8_t extruder); template class TFilamentMonitor; -class FilamentSensorEncoder; -class FilamentSensorSwitch; +class FilamentSensor; class RunoutResponseDelayed; class RunoutResponseDebounced; @@ -56,7 +62,7 @@ class RunoutResponseDebounced; typedef TFilamentMonitor< TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced), - TERN(FILAMENT_MOTION_SENSOR, FilamentSensorEncoder, FilamentSensorSwitch) + FilamentSensor > FilamentMonitor; extern FilamentMonitor runout; @@ -98,6 +104,11 @@ class TFilamentMonitor : public FilamentMonitorBase { static void filament_present(const uint8_t extruder) { response.filament_present(extruder); } + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + static void filament_motion_present(const uint8_t extruder) { + response.filament_motion_present(extruder); + } + #endif #if HAS_FILAMENT_RUNOUT_DISTANCE static float& runout_distance() { return response.runout_distance_mm; } @@ -171,37 +182,25 @@ class FilamentSensorBase { static void filament_present(const uint8_t extruder) { runout.filament_present(extruder); // ...which calls response.filament_present(extruder) } + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + static void filament_motion_present(const uint8_t extruder) { + runout.filament_motion_present(extruder); // ...which calls response.filament_motion_present(extruder) + } + #endif public: static void setup() { - #define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0) + #define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0); #define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN) - #if NUM_RUNOUT_SENSORS >= 1 - INIT_RUNOUT_PIN(1); - #endif - #if NUM_RUNOUT_SENSORS >= 2 - INIT_RUNOUT_PIN(2); - #endif - #if NUM_RUNOUT_SENSORS >= 3 - INIT_RUNOUT_PIN(3); - #endif - #if NUM_RUNOUT_SENSORS >= 4 - INIT_RUNOUT_PIN(4); - #endif - #if NUM_RUNOUT_SENSORS >= 5 - INIT_RUNOUT_PIN(5); - #endif - #if NUM_RUNOUT_SENSORS >= 6 - INIT_RUNOUT_PIN(6); - #endif - #if NUM_RUNOUT_SENSORS >= 7 - INIT_RUNOUT_PIN(7); - #endif - #if NUM_RUNOUT_SENSORS >= 8 - INIT_RUNOUT_PIN(8); + REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN); + #undef INIT_RUNOUT_PIN + + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + #define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN) + REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN); + #undef INIT_MOTION_PIN #endif #undef _INIT_RUNOUT_PIN - #undef INIT_RUNOUT_PIN } // Return a bitmask of runout pin states @@ -213,36 +212,29 @@ class FilamentSensorBase { // Return a bitmask of runout flag states (1 bits always indicates runout) static uint8_t poll_runout_states() { - return poll_runout_pins() ^ uint8_t(0 - #if NUM_RUNOUT_SENSORS >= 1 - | (FIL_RUNOUT1_STATE ? 0 : _BV(1 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 2 - | (FIL_RUNOUT2_STATE ? 0 : _BV(2 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 3 - | (FIL_RUNOUT3_STATE ? 0 : _BV(3 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 4 - | (FIL_RUNOUT4_STATE ? 0 : _BV(4 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 5 - | (FIL_RUNOUT5_STATE ? 0 : _BV(5 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 6 - | (FIL_RUNOUT6_STATE ? 0 : _BV(6 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 7 - | (FIL_RUNOUT7_STATE ? 0 : _BV(7 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 8 - | (FIL_RUNOUT8_STATE ? 0 : _BV(8 - 1)) - #endif - ); + #define _OR_RUNOUT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1)) + return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _OR_RUNOUT)); + #undef _OR_RUNOUT } + + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + // Return a bitmask of motion pin states + static uint8_t poll_motion_pins() { + #define _OR_MOTION(N) | (READ(FIL_MOTION##N##_PIN) ? _BV((N) - 1) : 0) + return (0 REPEAT_1(NUM_MOTION_SENSORS, _OR_MOTION)); + #undef _OR_MOTION + } + + // Return a bitmask of motion flag states (1 bits always indicates runout) + static uint8_t poll_motion_states() { + #define _OR_MOTION(N) | (FIL_MOTION##N##_STATE ? 0 : _BV(N - 1)) + return poll_motion_pins() ^ uint8_t(0 REPEAT_1(NUM_MOTION_SENSORS, _OR_MOTION)); + #undef _OR_MOTION + } + #endif }; -#if ENABLED(FILAMENT_MOTION_SENSOR) +#if HAS_FILAMENT_MOTION /** * This sensor uses a magnetic encoder disc and a Hall effect @@ -256,14 +248,14 @@ class FilamentSensorBase { static void poll_motion_sensor() { static uint8_t old_state; - const uint8_t new_state = poll_runout_pins(), + const uint8_t new_state = TERN(FILAMENT_SWITCH_AND_MOTION, poll_motion_pins, poll_runout_pins)(), change = old_state ^ new_state; old_state = new_state; #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) if (change) { SERIAL_ECHOPGM("Motion detected:"); - LOOP_L_N(e, NUM_RUNOUT_SENSORS) + LOOP_L_N(e, TERN(FILAMENT_SWITCH_AND_MOTION, NUM_MOTION_SENSORS, NUM_RUNOUT_SENSORS)) if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e); SERIAL_EOL(); } @@ -277,7 +269,7 @@ class FilamentSensorBase { // If the sensor wheel has moved since the last call to // this method reset the runout counter for the extruder. if (TEST(motion_detected, b->extruder)) - filament_present(b->extruder); + TERN(FILAMENT_SWITCH_AND_MOTION, filament_motion_present, filament_present)(b->extruder); // Clear motion triggers for next block motion_detected = 0; @@ -286,7 +278,9 @@ class FilamentSensorBase { static void run() { poll_motion_sensor(); } }; -#else +#endif // HAS_FILAMENT_MOTION + +#if HAS_FILAMENT_SWITCH /** * This is a simple endstop switch in the path of the filament. @@ -324,25 +318,56 @@ class FilamentSensorBase { } }; + #endif // HAS_FILAMENT_SWITCH + + /** + * This is a simple endstop switch in the path of the filament. + * It can detect filament runout, but not stripouts or jams. + */ + class FilamentSensor : public FilamentSensorBase { + private: + TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor); + TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor); + + public: + static void block_completed(const block_t * const b) { + TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b)); + TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b)); + } + + static void run() { + TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run()); + TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run()); + } + }; -#endif // !FILAMENT_MOTION_SENSOR /********************************* RESPONSE TYPE *********************************/ #if HAS_FILAMENT_RUNOUT_DISTANCE + typedef struct { + float runout[NUM_RUNOUT_SENSORS]; + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + float motion[NUM_MOTION_SENSORS]; + #endif + } countdown_t; + // RunoutResponseDelayed triggers a runout event only if the length // of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed // during a runout condition. class RunoutResponseDelayed { private: - static volatile float runout_mm_countdown[NUM_RUNOUT_SENSORS]; + static volatile countdown_t mm_countdown; public: static float runout_distance_mm; static void reset() { LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i); + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + LOOP_L_N(i, NUM_MOTION_SENSORS) filament_motion_present(i); + #endif } static void run() { @@ -352,7 +377,11 @@ class FilamentSensorBase { if (ELAPSED(ms, t)) { t = millis() + 1000UL; LOOP_L_N(i, NUM_RUNOUT_SENSORS) - SERIAL_ECHOF(i ? F(", ") : F("Remaining mm: "), runout_mm_countdown[i]); + SERIAL_ECHOF(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + LOOP_L_N(i, NUM_MOTION_SENSORS) + SERIAL_ECHOF(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]); + #endif SERIAL_EOL(); } #endif @@ -360,20 +389,33 @@ class FilamentSensorBase { static uint8_t has_run_out() { uint8_t runout_flags = 0; - LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_mm_countdown[i] < 0) SBI(runout_flags, i); + LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (mm_countdown.runout[i] < 0) SBI(runout_flags, i); + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + LOOP_L_N(i, NUM_MOTION_SENSORS) if (mm_countdown.motion[i] < 0) SBI(runout_flags, i); + #endif return runout_flags; } static void filament_present(const uint8_t extruder) { - runout_mm_countdown[extruder] = runout_distance_mm; + mm_countdown.runout[extruder] = runout_distance_mm; } + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + static void filament_motion_present(const uint8_t extruder) { + mm_countdown.motion[extruder] = runout_distance_mm; + } + #endif + static void block_completed(const block_t * const b) { if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover. const uint8_t e = b->extruder; const int32_t steps = b->steps.e; - runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)]; + const float mm = (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)]; + if (e < NUM_RUNOUT_SENSORS) mm_countdown.runout[e] -= mm; + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + if (e < NUM_MOTION_SENSORS) mm_countdown.motion[e] -= mm; + #endif } } }; diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index e7898268e8c8..c0635c72206f 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -141,7 +141,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) { else ocr_off(); #elif ENABLED(SPINDLE_SERVO) - MOVE_SERVO(SPINDLE_SERVO_NR, power); + servo[SPINDLE_SERVO_NR].move(opwr); #else WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); isReadyForUI = true; diff --git a/Marlin/src/feature/spindle_laser_types.h b/Marlin/src/feature/spindle_laser_types.h index 2f36a68a1a32..4e5e4d06f67d 100644 --- a/Marlin/src/feature/spindle_laser_types.h +++ b/Marlin/src/feature/spindle_laser_types.h @@ -57,7 +57,7 @@ #endif #endif -typedef IF<(SPEED_POWER_MAX > 255), uint16_t, uint8_t>::type cutter_cpower_t; +typedef uvalue_t(SPEED_POWER_MAX) cutter_cpower_t; #if CUTTER_UNIT_IS(RPM) && SPEED_POWER_MAX > 255 typedef uint16_t cutter_power_t; diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index dd828bf0c873..c1cef2b9870d 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -86,11 +86,7 @@ void GcodeSuite::G35() { workspace_plane = PLANE_XY; #endif - // Always home with tool 0 active - #if HAS_MULTI_HOTEND - const uint8_t old_tool_index = active_extruder; - tool_change(0, true); - #endif + probe.use_probing_tool(); // Disable duplication mode on homing TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false)); @@ -108,7 +104,6 @@ void GcodeSuite::G35() { // length of the deployed pin (BLTOUCH stroke < 7mm) // Unsure if this is even required. The probe seems to lift correctly after probe done. - do_blocking_move_to_z(SUM_TERN(BLTOUCH, Z_CLEARANCE_BETWEEN_PROBES, bltouch.z_extra_clearance())); const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE, 0, true); if (isnan(z_probed_height)) { @@ -154,9 +149,7 @@ void GcodeSuite::G35() { SERIAL_ECHOLNPGM("G35 aborted."); // Restore the active tool after homing - #if HAS_MULTI_HOTEND - if (old_tool_index != 0) tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER)); // Fetch previous toolhead if not PARKING_EXTRUDER - #endif + probe.use_probing_tool(false); #if BOTH(HAS_LEVELING, RESTORE_LEVELING_AFTER_G35) set_bed_leveling_enabled(leveling_was_active); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 4769bd79c046..e334412054ac 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -97,10 +97,6 @@ class G29_State { bool dryrun, reenable; - #if HAS_MULTI_HOTEND - uint8_t tool_index; - #endif - #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) int abl_probe_index; #endif @@ -281,10 +277,7 @@ G29_TYPE GcodeSuite::G29() { */ if (!g29_in_progress) { - #if HAS_MULTI_HOTEND - abl.tool_index = active_extruder; - if (active_extruder != 0) tool_change(0, true); - #endif + probe.use_probing_tool(); #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) abl.abl_probe_index = -1; @@ -409,7 +402,7 @@ G29_TYPE GcodeSuite::G29() { if (!probe.good_bounds(abl.probe_position_lf, abl.probe_position_rb)) { if (DEBUGGING(LEVELING)) { DEBUG_ECHOLNPGM("G29 L", abl.probe_position_lf.x, " R", abl.probe_position_rb.x, - " F", abl.probe_position_lf.y, " B", abl.probe_position_rb.y); + " F", abl.probe_position_lf.y, " B", abl.probe_position_rb.y); } SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds."); G29_RETURN(false, false); @@ -417,7 +410,7 @@ G29_TYPE GcodeSuite::G29() { // Probe at the points of a lattice grid abl.gridSpacing.set((abl.probe_position_rb.x - abl.probe_position_lf.x) / (abl.grid_points.x - 1), - (abl.probe_position_rb.y - abl.probe_position_lf.y) / (abl.grid_points.y - 1)); + (abl.probe_position_rb.y - abl.probe_position_lf.y) / (abl.grid_points.y - 1)); #endif // ABL_USES_GRID @@ -491,7 +484,7 @@ G29_TYPE GcodeSuite::G29() { if (!no_action) set_bed_leveling_enabled(false); // Deploy certain probes before starting probing - #if ENABLED(BLTOUCH) + #if ENABLED(BLTOUCH) || BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE); #elif HAS_BED_PROBE if (probe.deploy()) { // (returns true on deploy failure) @@ -947,7 +940,7 @@ G29_TYPE GcodeSuite::G29() { process_subcommands_now(F(Z_PROBE_END_SCRIPT)); #endif - TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index)); + probe.use_probing_tool(false); report_current_position(); diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index e3e96a7960c2..9f902141fb24 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -103,9 +103,8 @@ void GcodeSuite::G29() { bedlevel.reset(); mbl_probe_index = 0; if (!ui.wait_for_move) { - queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2")); - TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + if (parser.seen_test('N')) + queue.inject(F("G28" TERN_(CAN_SET_LEVELING_AFTER_G28, "L0"))); // Position bed horizontally and Z probe vertically. #if HAS_SAFE_BED_LEVELING @@ -141,6 +140,11 @@ void GcodeSuite::G29() { do_blocking_move_to(safe_position); #endif // HAS_SAFE_BED_LEVELING + queue.inject(F("G29S2")); + + TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); + TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + return; } state = MeshNext; diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 6f0f27cb9d0d..e279b90e338c 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -124,7 +124,7 @@ * (Z is already at the right height) */ constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT }; - #if HAS_HOME_OFFSET + #if HAS_HOME_OFFSET && DISABLED(Z_SAFE_HOMING_POINT_ABSOLUTE) xy_float_t okay_homing_xy = safe_homing_xy; okay_homing_xy -= home_offset; #else diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 836d5c867b6b..61320c057667 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -63,10 +63,6 @@ enum CalEnum : char { // the 7 main calibration points - #define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP) #define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP) -#if HAS_MULTI_HOTEND - const uint8_t old_tool_index = active_extruder; -#endif - float lcd_probe_pt(const xy_pos_t &xy); void ac_home() { @@ -78,7 +74,7 @@ void ac_home() { } void ac_setup(const bool reset_bed) { - TERN_(HAS_MULTI_HOTEND, tool_change(0, true)); + TERN_(HAS_BED_PROBE, probe.use_probing_tool()); planner.synchronize(); remember_feedrate_scaling_off(); @@ -92,7 +88,7 @@ void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) { TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height)); TERN_(HAS_BED_PROBE, probe.stow()); restore_feedrate_and_scaling(); - TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, true)); + TERN_(HAS_BED_PROBE, probe.use_probing_tool(false)); } void print_signed_float(FSTR_P const prefix, const_float_t f) { diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 8cf652cd8411..816e455b84c7 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -108,6 +108,7 @@ void GcodeSuite::G34() { } #if ENABLED(Z_STEPPER_AUTO_ALIGN) + do { // break out on error const int8_t z_auto_align_iterations = parser.intval('I', Z_STEPPER_ALIGN_ITERATIONS); @@ -142,26 +143,17 @@ void GcodeSuite::G34() { TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY); - // Always home with tool 0 active - #if HAS_MULTI_HOTEND - const uint8_t old_tool_index = active_extruder; - tool_change(0, true); - #endif + probe.use_probing_tool(); TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false)); - // In BLTOUCH HS mode, the probe travels in a deployed state. - // Users of G34 might have a badly misaligned bed, so raise Z by the - // length of the deployed pin (BLTOUCH stroke < 7mm) - #define Z_BASIC_CLEARANCE (Z_CLEARANCE_BETWEEN_PROBES + TERN0(BLTOUCH, bltouch.z_extra_clearance())) - // Compute a worst-case clearance height to probe from. After the first // iteration this will be re-calculated based on the actual bed position auto magnitude2 = [&](const uint8_t i, const uint8_t j) { const xy_pos_t diff = z_stepper_align.xy[i] - z_stepper_align.xy[j]; return HYPOT2(diff.x, diff.y); }; - float z_probe = Z_BASIC_CLEARANCE + (G34_MAX_GRADE) * 0.01f * SQRT(_MAX(0, magnitude2(0, 1) + float z_probe = Z_PROBE_SAFE_CLEARANCE + (G34_MAX_GRADE) * 0.01f * SQRT(_MAX(0, magnitude2(0, 1) #if TRIPLE_Z , magnitude2(2, 1), magnitude2(2, 0) #if QUAD_Z @@ -256,7 +248,7 @@ void GcodeSuite::G34() { // Adapt the next probe clearance height based on the new measurements. // Safe_height = lowest distance to bed (= highest measurement) plus highest measured misalignment. z_maxdiff = z_measured_max - z_measured_min; - z_probe = Z_BASIC_CLEARANCE + z_measured_max + z_maxdiff; + z_probe = Z_PROBE_SAFE_CLEARANCE + z_measured_max + z_maxdiff; #if HAS_Z_STEPPER_ALIGN_STEPPER_XY // Replace the initial values in z_measured with calculated heights at @@ -448,14 +440,16 @@ void GcodeSuite::G34() { sync_plan_position(); #endif - // Restore the active tool after homing - TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER))); // Fetch previous tool for parking extruder + probe.use_probing_tool(false); #if BOTH(HAS_LEVELING, RESTORE_LEVELING_AFTER_G34) set_bed_leveling_enabled(leveling_was_active); #endif }while(0); + + probe.use_probing_tool(false); + #endif // Z_STEPPER_AUTO_ALIGN } diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M871.cpp index c484d4f1b770..f25c848f2fac 100644 --- a/Marlin/src/gcode/calibrate/G76_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M871.cpp @@ -34,7 +34,6 @@ #include "../../module/probe.h" #include "../../feature/bedlevel/bedlevel.h" #include "../../module/temperature.h" -#include "../../module/probe.h" #include "../../feature/probe_temp_comp.h" #include "../../lcd/marlinui.h" @@ -108,7 +107,6 @@ }; auto g76_probe = [](const TempSensorID sid, celsius_t &targ, const xy_pos_t &nozpos) { - do_z_clearance(5.0); // Raise nozzle before probing ptc.set_enabled(false); const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false ptc.set_enabled(true); diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 5807844012b5..d408ded3ac9c 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -139,24 +139,17 @@ inline void servo_probe_test() { bool deploy_state = false, stow_state; #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - + constexpr bool probe_hit_state = Z_MIN_ENDSTOP_HIT_STATE; #define PROBE_TEST_PIN Z_MIN_PIN - constexpr bool probe_inverting = Z_MIN_ENDSTOP_INVERTING; - - SERIAL_ECHOLNPGM(". Probe Z_MIN_PIN: ", PROBE_TEST_PIN); - SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: "); - + #define _PROBE_PREF "Z_MIN" #else - + constexpr bool probe_hit_state = Z_MIN_PROBE_ENDSTOP_HIT_STATE; #define PROBE_TEST_PIN Z_MIN_PROBE_PIN - constexpr bool probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING; - - SERIAL_ECHOLNPGM(". Probe Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN); - SERIAL_ECHOPGM( ". Z_MIN_PROBE_ENDSTOP_INVERTING: "); - + #define _PROBE_PREF "Z_MIN_PROBE" #endif - serialprint_truefalse(probe_inverting); + SERIAL_ECHOLNPGM(". Probe " _PROBE_PREF "_PIN: ", PROBE_TEST_PIN); + serial_ternary(probe_hit_state, F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), F("HIGH"), F("LOW")); SERIAL_EOL(); SET_INPUT_PULLUP(PROBE_TEST_PIN); @@ -173,11 +166,11 @@ inline void servo_probe_test() { SERIAL_ECHOLNPGM(". Check for BLTOUCH"); bltouch._reset(); bltouch._stow(); - if (probe_inverting == READ(PROBE_TEST_PIN)) { + if (READ(PROBE_TEST_PIN) != probe_hit_state) { bltouch._set_SW_mode(); - if (probe_inverting != READ(PROBE_TEST_PIN)) { + if (READ(PROBE_TEST_PIN) == probe_hit_state) { bltouch._deploy(); - if (probe_inverting == READ(PROBE_TEST_PIN)) { + if (READ(PROBE_TEST_PIN) != probe_hit_state) { bltouch._stow(); SERIAL_ECHOLNPGM("= BLTouch Classic 1.2, 1.3, Smart 1.0, 2.0, 2.2, 3.0, 3.1 detected."); // Check for a 3.1 by letting the user trigger it, later @@ -195,31 +188,30 @@ inline void servo_probe_test() { if (!blt) { // DEPLOY and STOW 4 times and see if the signal follows // Then it is a mechanical switch - uint8_t i = 0; SERIAL_ECHOLNPGM(". Deploy & stow 4 times"); - do { + LOOP_L_N(i, 4) { servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy safe_delay(500); deploy_state = READ(PROBE_TEST_PIN); servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][1]); // Stow safe_delay(500); stow_state = READ(PROBE_TEST_PIN); - } while (++i < 4); + } - if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING: INVERTING setting probably backwards."); + if (probe_hit_state == deploy_state) SERIAL_ECHOLNPGM("WARNING: " _PROBE_PREF "_ENDSTOP_HIT_STATE is probably wrong."); if (deploy_state != stow_state) { SERIAL_ECHOLNPGM("= Mechanical Switch detected"); if (deploy_state) { - SERIAL_ECHOLNPGM(" DEPLOYED state: HIGH (logic 1)", - " STOWED (triggered) state: LOW (logic 0)"); + SERIAL_ECHOLNPGM(". DEPLOYED state: HIGH (logic 1)\n" + ". STOWED (triggered) state: LOW (logic 0)"); } else { - SERIAL_ECHOLNPGM(" DEPLOYED state: LOW (logic 0)", - " STOWED (triggered) state: HIGH (logic 1)"); + SERIAL_ECHOLNPGM(". DEPLOYED state: LOW (logic 0)\n" + ". STOWED (triggered) state: HIGH (logic 1)"); } #if ENABLED(BLTOUCH) - SERIAL_ECHOLNPGM("FAIL: BLTOUCH enabled - Set up this device as a Servo Probe with INVERTING set to 'true'."); + SERIAL_ECHOLNPGM("FAIL: Can't enable BLTOUCH. Check your settings."); #endif return; } diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index 4ff48568faea..76fc335e2536 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -212,7 +212,7 @@ void try_to_disable(const stepper_flags_t to_disable) { void GcodeSuite::M18_M84() { if (parser.seenval('S')) { reset_stepper_timeout(); - #if HAS_DISABLE_INACTIVE_AXIS + #if HAS_DISABLE_IDLE_AXES const millis_t ms = parser.value_millis_from_seconds(); #if LASER_SAFETY_TIMEOUT_MS > 0 if (ms && ms <= LASER_SAFETY_TIMEOUT_MS) { diff --git a/Marlin/src/gcode/eeprom/M500-M504.cpp b/Marlin/src/gcode/eeprom/M500-M504.cpp index 412d0033558f..6da1d1cbd73b 100644 --- a/Marlin/src/gcode/eeprom/M500-M504.cpp +++ b/Marlin/src/gcode/eeprom/M500-M504.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfig.h" #if ENABLED(CONFIGURATION_EMBEDDING) - #include "../../sd/SdBaseFile.h" + #include "../../sd/cardreader.h" #include "../../mczip.h" #endif @@ -69,7 +69,7 @@ void GcodeSuite::M502() { SdBaseFile file; const uint16_t size = sizeof(mc_zip); // Need to create the config size on the SD card - if (file.open("mc.zip", O_WRITE|O_CREAT) && file.write(pgm_read_ptr(mc_zip), size) != -1 && file.close()) + if (file.open(card.getroot(), "mc.zip", O_WRITE|O_CREAT) && file.write(pgm_read_ptr(mc_zip), size) != -1 && file.close()) SERIAL_ECHO_MSG("Configuration saved as 'mc.zip'"); } #endif diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp new file mode 100644 index 000000000000..31e16a194d7a --- /dev/null +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -0,0 +1,282 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "../../../inc/MarlinConfig.h" + +#if ENABLED(FT_MOTION) + +#include "../../gcode.h" +#include "../../../module/ft_motion.h" + +void say_shaping() { + SERIAL_ECHO_TERNARY(fxdTiCtrl.cfg_mode, "Fixed time controller ", "en", "dis", "abled"); + if (fxdTiCtrl.cfg_mode == ftMotionMode_DISABLED || fxdTiCtrl.cfg_mode == ftMotionMode_ENABLED) { + SERIAL_ECHOLNPGM("."); + return; + } + #if HAS_X_AXIS + SERIAL_ECHOPGM(" with "); + switch (fxdTiCtrl.cfg_mode) { + default: break; + //case ftMotionMode_ULENDO_FBS: SERIAL_ECHOLNPGM("Ulendo FBS."); return; + case ftMotionMode_ZV: SERIAL_ECHOLNPGM("ZV"); break; + case ftMotionMode_ZVD: SERIAL_ECHOLNPGM("ZVD"); break; + case ftMotionMode_EI: SERIAL_ECHOLNPGM("EI"); break; + case ftMotionMode_2HEI: SERIAL_ECHOLNPGM("2 Hump EI"); break; + case ftMotionMode_3HEI: SERIAL_ECHOLNPGM("3 Hump EI"); break; + case ftMotionMode_MZV: SERIAL_ECHOLNPGM("MZV"); break; + //case ftMotionMode_DISCTF: SERIAL_ECHOLNPGM("discrete transfer functions"); break; + } + SERIAL_ECHOLNPGM(" shaping."); + #endif +} + +/** + * M493: Set Fixed-time Motion Control parameters + * + * S Set the motion / shaping mode. Shaping requires an X axis, at the minimum. + * 0: NORMAL + * 1: FIXED-TIME + * 10: ZV + * 11: ZVD + * 12: EI + * 13: 2HEI + * 14: 3HEI + * 15: MZV + * + * P Enable (1) or Disable (0) Linear Advance pressure control + * + * K Set Linear Advance gain + * + * D Set Dynamic Frequency mode + * 0: DISABLED + * 1: Z-based (Requires a Z axis) + * 2: Mass-based (Requires X and E axes) + * + * A Set static/base frequency for the X axis + * F Set frequency scaling for the X axis + * + * B Set static/base frequency for the Y axis + * H Set frequency scaling for the Y axis + */ +void GcodeSuite::M493() { + // Parse 'S' mode parameter. + if (parser.seenval('S')) { + const ftMotionMode_t val = (ftMotionMode_t)parser.value_byte(); + switch (val) { + case ftMotionMode_DISABLED: + case ftMotionMode_ENABLED: + #if HAS_X_AXIS + case ftMotionMode_ZVD: + case ftMotionMode_2HEI: + case ftMotionMode_3HEI: + case ftMotionMode_MZV: + //case ftMotionMode_ULENDO_FBS: + //case ftMotionMode_DISCTF: + fxdTiCtrl.cfg_mode = val; + say_shaping(); + break; + #endif + default: + SERIAL_ECHOLNPGM("?Invalid control mode [M] value."); + return; + } + + switch (val) { + case ftMotionMode_ENABLED: fxdTiCtrl.reset(); break; + #if HAS_X_AXIS + case ftMotionMode_ZV: + case ftMotionMode_ZVD: + case ftMotionMode_EI: + case ftMotionMode_2HEI: + case ftMotionMode_3HEI: + case ftMotionMode_MZV: + fxdTiCtrl.updateShapingN(fxdTiCtrl.cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, fxdTiCtrl.cfg_baseFreq[1])); + fxdTiCtrl.updateShapingA(); + fxdTiCtrl.reset(); + break; + //case ftMotionMode_ULENDO_FBS: + //case ftMotionMode_DISCTF: + #endif + default: break; + } + } + + #if HAS_EXTRUDERS + + // Pressure control (linear advance) parameter. + if (parser.seen('P')) { + const bool val = parser.value_bool(); + fxdTiCtrl.cfg_linearAdvEna = val; + SERIAL_ECHO_TERNARY(val, "Pressure control: Linear Advance ", "en", "dis", "abled.\n"); + } + + // Pressure control (linear advance) gain parameter. + if (parser.seenval('K')) { + const float val = parser.value_float(); + if (val >= 0.0f) { + fxdTiCtrl.cfg_linearAdvK = val; + SERIAL_ECHOPGM("Pressure control: Linear Advance gain set to: "); + SERIAL_ECHO_F(val, 5); + SERIAL_ECHOLNPGM("."); + } + else { // Value out of range. + SERIAL_ECHOLNPGM("Pressure control: Linear Advance gain out of range."); + } + } + + #endif // HAS_EXTRUDERS + + #if HAS_Z_AXIS || HAS_EXTRUDERS + + // Dynamic frequency mode parameter. + if (parser.seenval('D')) { + if (WITHIN(fxdTiCtrl.cfg_mode, 10U, 19U)) { + const dynFreqMode_t val = dynFreqMode_t(parser.value_byte()); + switch (val) { + case dynFreqMode_DISABLED: + fxdTiCtrl.cfg_dynFreqMode = val; + SERIAL_ECHOLNPGM("Dynamic frequency mode disabled."); + break; + #if HAS_Z_AXIS + case dynFreqMode_Z_BASED: + fxdTiCtrl.cfg_dynFreqMode = val; + SERIAL_ECHOLNPGM("Z-based Dynamic Frequency Mode."); + break; + #endif + #if HAS_EXTRUDERS + case dynFreqMode_MASS_BASED: + fxdTiCtrl.cfg_dynFreqMode = val; + SERIAL_ECHOLNPGM("Mass-based Dynamic Frequency Mode."); + break; + #endif + default: + SERIAL_ECHOLNPGM("?Invalid Dynamic Frequency Mode [D] value."); + break; + } + } + else { + SERIAL_ECHOLNPGM("Incompatible shaper for [D] Dynamic Frequency mode."); + } + } + + #endif // HAS_Z_AXIS || HAS_EXTRUDERS + + #if HAS_X_AXIS + + // Parse frequency parameter (X axis). + if (parser.seenval('A')) { + if (WITHIN(fxdTiCtrl.cfg_mode, 10U, 19U)) { + const float val = parser.value_float(); + const bool frequencyInRange = WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2); + // TODO: Frequency minimum is dependent on the shaper used; the above check isn't always correct. + if (frequencyInRange) { + fxdTiCtrl.cfg_baseFreq[0] = val; + fxdTiCtrl.updateShapingN(fxdTiCtrl.cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, fxdTiCtrl.cfg_baseFreq[1])); + fxdTiCtrl.reset(); + if (fxdTiCtrl.cfg_dynFreqMode) { SERIAL_ECHOPGM("Compensator base dynamic frequency (X/A axis) set to:"); } + else { SERIAL_ECHOPGM("Compensator static frequency (X/A axis) set to: "); } + SERIAL_ECHO_F( fxdTiCtrl.cfg_baseFreq[0], 2 ); + SERIAL_ECHOLNPGM("."); + } + else { // Frequency out of range. + SERIAL_ECHOLNPGM("Invalid [A] frequency value."); + } + } + else { // Mode doesn't use frequency. + SERIAL_ECHOLNPGM("Incompatible mode for [A] frequency."); + } + } + + #if HAS_Z_AXIS || HAS_EXTRUDERS + // Parse frequency scaling parameter (X axis). + if (parser.seenval('F')) { + const bool modeUsesDynFreq = ( + TERN0(HAS_Z_AXIS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_Z_BASED) + || TERN0(HAS_EXTRUDERS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_MASS_BASED) + ); + + if (modeUsesDynFreq) { + const float val = parser.value_float(); + fxdTiCtrl.cfg_dynFreqK[0] = val; + SERIAL_ECHOPGM("Frequency scaling (X/A axis) set to: "); + SERIAL_ECHO_F(fxdTiCtrl.cfg_dynFreqK[0], 8); + SERIAL_ECHOLNPGM("."); + } + else { + SERIAL_ECHOLNPGM("Incompatible mode for [F] frequency scaling."); + } + } + #endif // HAS_Z_AXIS || HAS_EXTRUDERS + + #endif // HAS_X_AXIS + + #if HAS_Y_AXIS + + // Parse frequency parameter (Y axis). + if (parser.seenval('B')) { + if (WITHIN(fxdTiCtrl.cfg_mode, 10U, 19U)) { + const float val = parser.value_float(); + const bool frequencyInRange = WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2); + if (frequencyInRange) { + fxdTiCtrl.cfg_baseFreq[1] = val; + fxdTiCtrl.updateShapingN(fxdTiCtrl.cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, fxdTiCtrl.cfg_baseFreq[1])); + fxdTiCtrl.reset(); + if (fxdTiCtrl.cfg_dynFreqMode) { SERIAL_ECHOPGM("Compensator base dynamic frequency (Y/B axis) set to:"); } + else { SERIAL_ECHOPGM("Compensator static frequency (Y/B axis) set to: "); } + SERIAL_ECHO_F( fxdTiCtrl.cfg_baseFreq[1], 2 ); + SERIAL_ECHOLNPGM("."); + } + else { // Frequency out of range. + SERIAL_ECHOLNPGM("Invalid frequency [B] value."); + } + } + else { // Mode doesn't use frequency. + SERIAL_ECHOLNPGM("Incompatible mode for [B] frequency."); + } + } + + #if HAS_Z_AXIS || HAS_EXTRUDERS + // Parse frequency scaling parameter (Y axis). + if (parser.seenval('H')) { + const bool modeUsesDynFreq = ( + TERN0(HAS_Z_AXIS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_Z_BASED) + || TERN0(HAS_EXTRUDERS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_MASS_BASED) + ); + + if (modeUsesDynFreq) { + const float val = parser.value_float(); + fxdTiCtrl.cfg_dynFreqK[1] = val; + SERIAL_ECHOPGM("Frequency scaling (Y/B axis) set to: "); + SERIAL_ECHO_F(val, 8); + SERIAL_ECHOLNPGM("."); + } + else { + SERIAL_ECHOLNPGM("Incompatible mode for [H] frequency scaling."); + } + } + #endif // HAS_Z_AXIS || HAS_EXTRUDERS + + #endif // HAS_Y_AXIS +} + +#endif // FT_MOTION diff --git a/Marlin/src/gcode/feature/input_shaping/M593.cpp b/Marlin/src/gcode/feature/input_shaping/M593.cpp index a4b3cd3fee97..1b6a43f9ddb7 100644 --- a/Marlin/src/gcode/feature/input_shaping/M593.cpp +++ b/Marlin/src/gcode/feature/input_shaping/M593.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfig.h" -#if HAS_SHAPING +#if HAS_ZV_SHAPING #include "../../gcode.h" #include "../../../module/stepper.h" diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index db31fe3d8ef3..e0aa182bf285 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -53,6 +53,8 @@ static void set_stealth_status(const bool enable, const int8_t eindex) { constexpr int8_t index = -1; #endif + UNUSED(index); + LOOP_LOGICAL_AXES(i) if (parser.seen(AXIS_CHAR(i))) { switch (i) { case X_AXIS: diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index f08ade8c3835..0711d39204f2 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -75,8 +75,8 @@ GcodeSuite gcode; millis_t GcodeSuite::previous_move_ms = 0, GcodeSuite::max_inactive_time = 0; -#if HAS_DISABLE_INACTIVE_AXIS - millis_t GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME); +#if HAS_DISABLE_IDLE_AXES + millis_t GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_TIMEOUT_SEC); #endif // Relative motion mode for each logical axis @@ -895,6 +895,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 486: M486(); break; // M486: Identify and cancel objects #endif + #if ENABLED(FT_MOTION) + case 493: M493(); break; // M493: Fixed-Time Motion control + #endif + case 500: M500(); break; // M500: Store settings in EEPROM case 501: M501(); break; // M501: Read settings from EEPROM case 502: M502(); break; // M502: Revert to default settings @@ -933,8 +937,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 575: M575(); break; // M575: Set serial baudrate #endif - #if HAS_SHAPING - case 593: M593(); break; // M593: Set Input Shaping parameters + #if HAS_ZV_SHAPING + case 593: M593(); break; // M593: Input Shaping control #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 9bb45d9a4309..8493d7f2911d 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -403,7 +403,7 @@ class GcodeSuite { } FORCE_INLINE static void reset_stepper_timeout(const millis_t ms=millis()) { previous_move_ms = ms; } - #if HAS_DISABLE_INACTIVE_AXIS + #if HAS_DISABLE_IDLE_AXES static millis_t stepper_inactive_time; FORCE_INLINE static bool stepper_inactive_timeout(const millis_t ms=millis()) { return ELAPSED(ms, previous_move_ms + stepper_inactive_time); @@ -1038,6 +1038,10 @@ class GcodeSuite { static void M486(); #endif + #if ENABLED(FT_MOTION) + static void M493(); + #endif + static void M500(); static void M501(); static void M502(); @@ -1084,7 +1088,7 @@ class GcodeSuite { static void M575(); #endif - #if HAS_SHAPING + #if HAS_ZV_SHAPING static void M593(); static void M593_report(const bool forReplay=true); #endif diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index 6893d4bec284..0a23e0981c49 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -53,10 +53,7 @@ */ void GcodeSuite::G30() { - #if HAS_MULTI_HOTEND - const uint8_t old_tool_index = active_extruder; - tool_change(0); - #endif + probe.use_probing_tool(); // Convert the given logical position to native position const xy_pos_t pos = { @@ -106,8 +103,7 @@ void GcodeSuite::G30() { #endif } - // Restore the active tool - TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index)); + probe.use_probing_tool(false); } #endif // HAS_BED_PROBE diff --git a/Marlin/src/gcode/probe/M401_M402.cpp b/Marlin/src/gcode/probe/M401_M402.cpp index 33895749193f..7114cad9e8ca 100644 --- a/Marlin/src/gcode/probe/M401_M402.cpp +++ b/Marlin/src/gcode/probe/M401_M402.cpp @@ -38,30 +38,33 @@ * With BLTOUCH_HS_MODE: * H Report the current BLTouch HS mode state and exit * S Set High Speed (HS) Mode and exit without deploy + * + * R Remain in place after deploying (and before activating) the probe */ void GcodeSuite::M401() { - const bool seenH = parser.seen_test('H'), - seenS = parser.seen('S'); - if (seenH || seenS) { - #ifdef BLTOUCH_HS_MODE + #ifdef BLTOUCH_HS_MODE + const bool seenH = parser.seen_test('H'), + seenS = parser.seen('S'); + if (seenH || seenS) { if (seenS) bltouch.high_speed_mode = parser.value_bool(); SERIAL_ECHO_START(); SERIAL_ECHOPGM("BLTouch HS mode "); serialprintln_onoff(bltouch.high_speed_mode); - #endif - } - else { - probe.deploy(); - TERN_(PROBE_TARE, probe.tare()); - report_current_position(); - } + return; + } + #endif + + probe.deploy(parser.boolval('R')); + TERN_(PROBE_TARE, probe.tare()); + report_current_position(); } /** * M402: Deactivate and stow the Z probe + * R Remain in place after stowing (and before deactivating) the probe */ void GcodeSuite::M402() { - probe.stow(); + probe.stow(parser.boolval('R')); probe.move_z_after_probing(); report_current_position(); } diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index c951fc633364..edf0ddfdbf64 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -303,6 +303,24 @@ static bool serial_data_available(serial_index_t index) { inline int read_serial(const serial_index_t index) { return SERIAL_IMPL.read(index); } +#if (defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32)) && defined(USBCON) + + /** + * arduinoststm32's USB receive buffer is not well behaved when the buffer overflows + * + * This can happen when the host programs (such as Pronterface) automatically + * send M105 temperature requests. + */ + void GCodeQueue::flush_rx() { + // Flush receive buffer + LOOP_L_N(p, NUM_SERIAL) { + if (!serial_data_available(p)) continue; // No data for this port? Skip. + while (SERIAL_IMPL.available(p)) (void)read_serial(p); + } + } + +#endif // (ARDUINO_ARCH_STM32F4 || ARDUINO_ARCH_STM32) && USBCON + void GCodeQueue::gcode_line_error(FSTR_P const ferr, const serial_index_t serial_ind) { PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command SERIAL_ERROR_START(); diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 142283008001..19fb359e15aa 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -201,6 +201,12 @@ class GCodeQueue { */ static void flush_and_request_resend(const serial_index_t serial_ind); + #if (defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32)) && defined(USBCON) + static void flush_rx(); + #else + static void flush_rx() {} + #endif + /** * (Re)Set the current line number for the last received command */ diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index e0ad26027e60..48eebaa0e4d8 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -25,6 +25,7 @@ #if HAS_PID_HEATING #include "../gcode.h" +#include "../queue.h" // for flush_tx #include "../../lcd/marlinui.h" #include "../../module/temperature.h" @@ -85,6 +86,8 @@ void GcodeSuite::M303() { LCD_MESSAGE(MSG_PID_AUTOTUNE); thermalManager.PID_autotune(temp, hid, c, u); ui.reset_status(); + + queue.flush_rx(); } #endif // HAS_PID_HEATING diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index 928f375c3897..d0c005ea4eb1 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -33,8 +33,6 @@ * * E Extruder index. (Default: Active Extruder) * - * T Autotune the specified or active extruder. - * * Set MPC values manually for the specified or active extruder: * A Ambient heat transfer coefficient (no fan). * C Block heat capacity. @@ -42,6 +40,9 @@ * H Filament heat capacity per mm. * P Heater power. * R Sensor responsiveness (= transfer coefficient / heat capcity). + * + * With MPC_AUTOTUNE: + * T Autotune the specified or active extruder. */ void GcodeSuite::M306() { @@ -51,12 +52,14 @@ void GcodeSuite::M306() { return; } - if (parser.seen_test('T')) { - LCD_MESSAGE(MSG_MPC_AUTOTUNE); - thermalManager.MPC_autotune(e); - ui.reset_status(); - return; - } + #if ENABLED(MPC_AUTOTUNE) + if (parser.seen_test('T')) { + LCD_MESSAGE(MSG_MPC_AUTOTUNE); + thermalManager.MPC_autotune(e); + ui.reset_status(); + return; + } + #endif if (parser.seen("ACFPRH")) { MPC_t &mpc = thermalManager.temp_hotend[e].mpc; diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index bddc0554f569..60bc65356004 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -477,7 +477,7 @@ #endif // Aliases for LCD features -#if !DGUS_UI_IS(NONE) +#if !DGUS_UI_IS(NONE) || ENABLED(ANYCUBIC_LCD_VYPER) #define HAS_DGUS_LCD 1 #if DGUS_UI_IS(ORIGIN, FYSETC, HIPRECY, MKS) #define HAS_DGUS_LCD_CLASSIC 1 @@ -485,7 +485,7 @@ #endif // Extensible UI serial touch screens. (See src/lcd/extui) -#if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT) +#if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER, NEXTION_TFT) #define IS_EXTUI 1 #define EXTENSIBLE_UI #endif @@ -613,7 +613,9 @@ #undef TEMP_SENSOR_7 #undef SINGLENOZZLE #undef SWITCHING_EXTRUDER + #undef MECHANICAL_SWITCHING_EXTRUDER #undef SWITCHING_NOZZLE + #undef MECHANICAL_SWITCHING_NOZZLE #undef MIXING_EXTRUDER #undef HOTEND_IDLE_TIMEOUT #undef DISABLE_E @@ -622,19 +624,26 @@ #undef PREVENT_LENGTHY_EXTRUDE #undef FILAMENT_RUNOUT_SENSOR #undef FILAMENT_RUNOUT_DISTANCE_MM - #undef DISABLE_INACTIVE_EXTRUDER + #undef DISABLE_OTHER_EXTRUDERS #endif #define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N) #define E_TERN_(N) TERN_(HAS_MULTI_EXTRUDER, N) #define E_TERN0(N) TERN0(HAS_MULTI_EXTRUDER, N) +#if EITHER(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) + #define HAS_SWITCHING_EXTRUDER 1 +#endif +#if EITHER(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) + #define HAS_SWITCHING_NOZZLE 1 +#endif + #if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0 #define E_STEPPERS 2 #define E_MANUAL 1 -#elif ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS +#elif HAS_SWITCHING_EXTRUDER // One stepper for every two EXTRUDERS #if EXTRUDERS > 4 #define E_STEPPERS 3 @@ -643,7 +652,7 @@ #else #define E_STEPPERS 1 #endif - #if DISABLED(SWITCHING_NOZZLE) + #if !HAS_SWITCHING_NOZZLE #define HOTENDS E_STEPPERS #endif @@ -668,8 +677,8 @@ #endif // No inactive extruders with SWITCHING_NOZZLE or Průša MMU1 -#if ENABLED(SWITCHING_NOZZLE) || HAS_PRUSA_MMU1 - #undef DISABLE_INACTIVE_EXTRUDER +#if HAS_SWITCHING_NOZZLE || HAS_PRUSA_MMU1 + #undef DISABLE_OTHER_EXTRUDERS #endif // Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE @@ -785,8 +794,8 @@ #undef AVOID_OBSTACLES #undef ENDSTOPPULLUP_YMIN #undef ENDSTOPPULLUP_YMAX - #undef Y_MIN_ENDSTOP_INVERTING - #undef Y_MAX_ENDSTOP_INVERTING + #undef Y_MIN_ENDSTOP_HIT_STATE + #undef Y_MAX_ENDSTOP_HIT_STATE #undef Y2_DRIVER_TYPE #undef Y_ENABLE_ON #undef DISABLE_Y @@ -812,8 +821,8 @@ #else #undef ENDSTOPPULLUP_ZMIN #undef ENDSTOPPULLUP_ZMAX - #undef Z_MIN_ENDSTOP_INVERTING - #undef Z_MAX_ENDSTOP_INVERTING + #undef Z_MIN_ENDSTOP_HIT_STATE + #undef Z_MAX_ENDSTOP_HIT_STATE #undef Z2_DRIVER_TYPE #undef Z3_DRIVER_TYPE #undef Z4_DRIVER_TYPE @@ -832,8 +841,8 @@ #if !HAS_I_AXIS #undef ENDSTOPPULLUP_IMIN #undef ENDSTOPPULLUP_IMAX - #undef I_MIN_ENDSTOP_INVERTING - #undef I_MAX_ENDSTOP_INVERTING + #undef I_MIN_ENDSTOP_HIT_STATE + #undef I_MAX_ENDSTOP_HIT_STATE #undef I_ENABLE_ON #undef DISABLE_I #undef INVERT_I_DIR @@ -848,8 +857,8 @@ #if !HAS_J_AXIS #undef ENDSTOPPULLUP_JMIN #undef ENDSTOPPULLUP_JMAX - #undef J_MIN_ENDSTOP_INVERTING - #undef J_MAX_ENDSTOP_INVERTING + #undef J_MIN_ENDSTOP_HIT_STATE + #undef J_MAX_ENDSTOP_HIT_STATE #undef J_ENABLE_ON #undef DISABLE_J #undef INVERT_J_DIR @@ -864,8 +873,8 @@ #if !HAS_K_AXIS #undef ENDSTOPPULLUP_KMIN #undef ENDSTOPPULLUP_KMAX - #undef K_MIN_ENDSTOP_INVERTING - #undef K_MAX_ENDSTOP_INVERTING + #undef K_MIN_ENDSTOP_HIT_STATE + #undef K_MAX_ENDSTOP_HIT_STATE #undef K_ENABLE_ON #undef DISABLE_K #undef INVERT_K_DIR @@ -880,8 +889,8 @@ #if !HAS_U_AXIS #undef ENDSTOPPULLUP_UMIN #undef ENDSTOPPULLUP_UMAX - #undef U_MIN_ENDSTOP_INVERTING - #undef U_MAX_ENDSTOP_INVERTING + #undef U_MIN_ENDSTOP_HIT_STATE + #undef U_MAX_ENDSTOP_HIT_STATE #undef U_ENABLE_ON #undef DISABLE_U #undef INVERT_U_DIR @@ -896,8 +905,8 @@ #if !HAS_V_AXIS #undef ENDSTOPPULLUP_VMIN #undef ENDSTOPPULLUP_VMAX - #undef V_MIN_ENDSTOP_INVERTING - #undef V_MAX_ENDSTOP_INVERTING + #undef V_MIN_ENDSTOP_HIT_STATE + #undef V_MAX_ENDSTOP_HIT_STATE #undef V_ENABLE_ON #undef DISABLE_V #undef INVERT_V_DIR @@ -912,8 +921,8 @@ #if !HAS_W_AXIS #undef ENDSTOPPULLUP_WMIN #undef ENDSTOPPULLUP_WMAX - #undef W_MIN_ENDSTOP_INVERTING - #undef W_MAX_ENDSTOP_INVERTING + #undef W_MIN_ENDSTOP_HIT_STATE + #undef W_MAX_ENDSTOP_HIT_STATE #undef W_ENABLE_ON #undef DISABLE_W #undef INVERT_W_DIR @@ -925,6 +934,15 @@ #undef MAX_SOFTWARE_ENDSTOP_W #endif +#define _OR_HAS_DA(A) ENABLED(DISABLE_##A) || +#if MAP(_OR_HAS_DA, X, Y, Z, I, J, K, U, V, W) 0 + #define HAS_DISABLE_MAIN_AXES 1 +#endif +#if HAS_DISABLE_MAIN_AXES || ENABLED(DISABLE_E) + #define HAS_DISABLE_AXES 1 +#endif +#undef _OR_HAS_DA + #ifdef X2_DRIVER_TYPE #define HAS_X2_STEPPER 1 // Dual X Carriage isn't known yet. TODO: Consider moving it to Configuration.h. @@ -936,7 +954,7 @@ /** * Number of Primary Linear Axes (e.g., XYZ) - * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4) + * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2, Z2, Z3, Z4) */ #if NUM_AXES >= 3 #define PRIMARY_LINEAR_AXES 3 @@ -1064,7 +1082,7 @@ #endif // Switching extruder has its own servo? -#if ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR) +#if ENABLED(SWITCHING_EXTRUDER) && (!HAS_SWITCHING_NOZZLE || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR) #define DO_SWITCH_EXTRUDER 1 #endif @@ -1072,10 +1090,8 @@ * The BLTouch Probe emulates a servo probe * and uses "special" angles for its state. */ -#if ENABLED(BLTOUCH) - #ifndef Z_PROBE_SERVO_NR - #define Z_PROBE_SERVO_NR 0 - #endif +#if ENABLED(BLTOUCH) && !defined(Z_PROBE_SERVO_NR) + #define Z_PROBE_SERVO_NR 0 #endif /** @@ -1101,6 +1117,14 @@ #define HAS_BED_PROBE 1 #endif +// Probing tool change +#if !HAS_MULTI_EXTRUDER + #undef PROBING_TOOL +#endif +#if HAS_BED_PROBE && defined(PROBING_TOOL) + #define DO_TOOLCHANGE_FOR_PROBING 1 +#endif + /** * Fill in undefined Filament Sensor options */ @@ -1195,6 +1219,97 @@ #endif #endif // FILAMENT_RUNOUT_SENSOR +#if ENABLED(FILAMENT_SWITCH_AND_MOTION) + #if NUM_MOTION_SENSORS >= 1 + #ifndef FIL_MOTION1_STATE + #define FIL_MOTION1_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION1_PULLUP + #define FIL_MOTION1_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION1_PULLDOWN + #define FIL_MOTION1_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 2 + #ifndef FIL_MOTION2_STATE + #define FIL_MOTION2_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION2_PULLUP + #define FIL_MOTION2_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION2_PULLDOWN + #define FIL_MOTION2_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 3 + #ifndef FIL_MOTION3_STATE + #define FIL_MOTION3_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION3_PULLUP + #define FIL_MOTION3_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION3_PULLDOWN + #define FIL_MOTION3_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 4 + #ifndef FIL_MOTION4_STATE + #define FIL_MOTION4_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION4_PULLUP + #define FIL_MOTION4_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION4_PULLDOWN + #define FIL_MOTION4_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 5 + #ifndef FIL_MOTION5_STATE + #define FIL_MOTION5_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION5_PULLUP + #define FIL_MOTION5_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION5_PULLDOWN + #define FIL_MOTION5_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 6 + #ifndef FIL_MOTION6_STATE + #define FIL_MOTION6_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION6_PULLUP + #define FIL_MOTION6_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION6_PULLDOWN + #define FIL_MOTION6_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 7 + #ifndef FIL_MOTION7_STATE + #define FIL_MOTION7_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION7_PULLUP + #define FIL_MOTION7_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION7_PULLDOWN + #define FIL_MOTION7_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif + #if NUM_MOTION_SENSORS >= 8 + #ifndef FIL_MOTION8_STATE + #define FIL_MOTION8_STATE FIL_RUNOUT_STATE + #endif + #ifndef FIL_MOTION8_PULLUP + #define FIL_MOTION8_PULLUP FIL_RUNOUT_PULLUP + #endif + #ifndef FIL_MOTION8_PULLDOWN + #define FILMOTION8_PULLDOWN FIL_RUNOUT_PULLDOWN + #endif + #endif +#endif // FILAMENT_SWITCH_AND_MOTION + // Homing to Min or Max #if X_HOME_DIR > 0 #define X_HOME_TO_MAX 1 @@ -1462,6 +1577,10 @@ #define HAS_PID_DEBUG 1 #endif +#if DISABLED(MPC_AUTOTUNE) + #undef MPC_AUTOTUNE_MENU +#endif + /** * TFT Displays * diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index ff2e54e393da..329562672238 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -30,26 +30,26 @@ #define AXIS_RELATIVE_MODES {} #endif -#ifdef SWITCHING_NOZZLE_E1_SERVO_NR +#if defined(SWITCHING_NOZZLE_E1_SERVO_NR) && DISABLED(MECHANICAL_SWITCHING_NOZZLE) #define SWITCHING_NOZZLE_TWO_SERVOS 1 #endif // Determine NUM_SERVOS if none was supplied #ifndef NUM_SERVOS #define NUM_SERVOS 0 - #if ANY(HAS_Z_SERVO_PROBE, CHAMBER_VENT, SWITCHING_TOOLHEAD, SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SPINDLE_SERVO) - #if NUM_SERVOS <= Z_PROBE_SERVO_NR - #undef NUM_SERVOS - #define NUM_SERVOS (Z_PROBE_SERVO_NR + 1) - #endif - #if NUM_SERVOS <= CHAMBER_VENT_SERVO_NR - #undef NUM_SERVOS - #define NUM_SERVOS (CHAMBER_VENT_SERVO_NR + 1) - #endif - #if NUM_SERVOS <= SWITCHING_TOOLHEAD_SERVO_NR - #undef NUM_SERVOS - #define NUM_SERVOS (SWITCHING_TOOLHEAD_SERVO_NR + 1) - #endif + #if HAS_Z_SERVO_PROBE && NUM_SERVOS <= Z_PROBE_SERVO_NR + #undef NUM_SERVOS + #define NUM_SERVOS (Z_PROBE_SERVO_NR + 1) + #endif + #if ENABLED(CHAMBER_VENT) && NUM_SERVOS <= CHAMBER_VENT_SERVO_NR + #undef NUM_SERVOS + #define NUM_SERVOS (CHAMBER_VENT_SERVO_NR + 1) + #endif + #if ENABLED(SWITCHING_TOOLHEAD) && NUM_SERVOS <= SWITCHING_TOOLHEAD_SERVO_NR + #undef NUM_SERVOS + #define NUM_SERVOS (SWITCHING_TOOLHEAD_SERVO_NR + 1) + #endif + #if ENABLED(SWITCHING_NOZZLE) #if NUM_SERVOS <= SWITCHING_NOZZLE_SERVO_NR #undef NUM_SERVOS #define NUM_SERVOS (SWITCHING_NOZZLE_SERVO_NR + 1) @@ -58,6 +58,8 @@ #undef NUM_SERVOS #define NUM_SERVOS (SWITCHING_NOZZLE_E1_SERVO_NR + 1) #endif + #endif + #if ENABLED(SWITCHING_EXTRUDER) #if NUM_SERVOS <= SWITCHING_EXTRUDER_SERVO_NR #undef NUM_SERVOS #define NUM_SERVOS (SWITCHING_EXTRUDER_SERVO_NR + 1) @@ -66,12 +68,12 @@ #undef NUM_SERVOS #define NUM_SERVOS (SWITCHING_EXTRUDER_E23_SERVO_NR + 1) #endif - #if NUM_SERVOS <= SPINDLE_SERVO_NR - #undef NUM_SERVOS - #define NUM_SERVOS (SPINDLE_SERVO_NR + 1) - #endif #endif -#endif + #if ENABLED(SPINDLE_SERVO) && NUM_SERVOS <= SPINDLE_SERVO_NR + #undef NUM_SERVOS + #define NUM_SERVOS (SPINDLE_SERVO_NR + 1) + #endif +#endif // !defined(NUM_SERVOS) // Convenience override for a BLTouch alone #if ENABLED(BLTOUCH) && NUM_SERVOS == 1 @@ -91,7 +93,7 @@ #undef ARC_SUPPORT #undef CALIBRATION_MEASURE_YMAX #undef CALIBRATION_MEASURE_YMIN - #undef DISABLE_INACTIVE_Y + #undef DISABLE_IDLE_Y #undef HOME_Y_BEFORE_X #undef INPUT_SHAPING_Y #undef QUICK_HOME @@ -106,7 +108,7 @@ #undef CALIBRATION_MEASURE_ZMAX #undef CALIBRATION_MEASURE_ZMIN #undef CNC_WORKSPACE_PLANES - #undef DISABLE_INACTIVE_Z + #undef DISABLE_IDLE_Z #undef ENABLE_LEVELING_FADE_HEIGHT #undef HOME_Z_FIRST #undef HOMING_Z_WITH_PROBE @@ -122,7 +124,7 @@ #if !HAS_I_AXIS #undef CALIBRATION_MEASURE_IMAX #undef CALIBRATION_MEASURE_IMIN - #undef DISABLE_INACTIVE_I + #undef DISABLE_IDLE_I #undef SAFE_BED_LEVELING_START_I #undef STEALTHCHOP_I #undef STEP_STATE_I @@ -131,7 +133,7 @@ #if !HAS_J_AXIS #undef CALIBRATION_MEASURE_JMAX #undef CALIBRATION_MEASURE_JMIN - #undef DISABLE_INACTIVE_J + #undef DISABLE_IDLE_J #undef SAFE_BED_LEVELING_START_J #undef STEALTHCHOP_J #undef STEP_STATE_J @@ -140,7 +142,7 @@ #if !HAS_K_AXIS #undef CALIBRATION_MEASURE_KMAX #undef CALIBRATION_MEASURE_KMIN - #undef DISABLE_INACTIVE_K + #undef DISABLE_IDLE_K #undef SAFE_BED_LEVELING_START_K #undef STEALTHCHOP_K #undef STEP_STATE_K @@ -149,7 +151,7 @@ #if !HAS_U_AXIS #undef CALIBRATION_MEASURE_UMAX #undef CALIBRATION_MEASURE_UMIN - #undef DISABLE_INACTIVE_U + #undef DISABLE_IDLE_U #undef SAFE_BED_LEVELING_START_U #undef STEALTHCHOP_U #undef STEP_STATE_U @@ -158,7 +160,7 @@ #if !HAS_V_AXIS #undef CALIBRATION_MEASURE_VMAX #undef CALIBRATION_MEASURE_VMIN - #undef DISABLE_INACTIVE_V + #undef DISABLE_IDLE_V #undef SAFE_BED_LEVELING_START_V #undef STEALTHCHOP_V #undef STEP_STATE_V @@ -167,7 +169,7 @@ #if !HAS_W_AXIS #undef CALIBRATION_MEASURE_WMAX #undef CALIBRATION_MEASURE_WMIN - #undef DISABLE_INACTIVE_W + #undef DISABLE_IDLE_W #undef SAFE_BED_LEVELING_START_W #undef STEALTHCHOP_W #undef STEP_STATE_W @@ -178,6 +180,7 @@ #define NO_VOLUMETRICS #undef ADVANCED_PAUSE_FEATURE #undef AUTOTEMP + #undef DISABLE_IDLE_E #undef EXTRUDER_RUNOUT_PREVENT #undef FILAMENT_LOAD_UNLOAD_GCODES #undef FWRETRACT @@ -192,6 +195,43 @@ #undef WATCH_TEMP_PERIOD #endif +#if ENABLED(DISABLE_X) && !defined(DISABLE_IDLE_X) + #define DISABLE_IDLE_X +#endif +#if ENABLED(DISABLE_Y) && !defined(DISABLE_IDLE_Y) + #define DISABLE_IDLE_Y +#endif +#if ENABLED(DISABLE_Z) && !defined(DISABLE_IDLE_Z) + #define DISABLE_IDLE_Z +#endif +#if ENABLED(DISABLE_I) && !defined(DISABLE_IDLE_I) + #define DISABLE_IDLE_I +#endif +#if ENABLED(DISABLE_J) && !defined(DISABLE_IDLE_J) + #define DISABLE_IDLE_J +#endif +#if ENABLED(DISABLE_K) && !defined(DISABLE_IDLE_K) + #define DISABLE_IDLE_K +#endif +#if ENABLED(DISABLE_U) && !defined(DISABLE_IDLE_U) + #define DISABLE_IDLE_U +#endif +#if ENABLED(DISABLE_V) && !defined(DISABLE_IDLE_V) + #define DISABLE_IDLE_V +#endif +#if ENABLED(DISABLE_W) && !defined(DISABLE_IDLE_W) + #define DISABLE_IDLE_W +#endif +#if ENABLED(DISABLE_E) && !defined(DISABLE_IDLE_E) + #define DISABLE_IDLE_E +#endif + +#define _OR_HAS_DI(A) || BOTH(HAS_##A##_AXIS, DISABLE_IDLE_##A) +#if BOTH(HAS_EXTRUDERS, DISABLE_IDLE_E) MAP(_OR_HAS_DI, X, Y, Z, I, J, K, U, V, W) + #define HAS_DISABLE_IDLE_AXES 1 +#endif +#undef _OR_HAS_DI + #if HOTENDS <= 7 #undef E7_AUTO_FAN_PIN #if HOTENDS <= 6 @@ -1208,7 +1248,7 @@ // Input shaping #if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y) - #define HAS_SHAPING 1 + #define HAS_ZV_SHAPING 1 #endif // Toolchange Event G-code @@ -1217,3 +1257,9 @@ #undef TC_GCODE_USE_GLOBAL_Y #undef TC_GCODE_USE_GLOBAL_Z #endif + +// Multi-Stepping Limit +#ifndef MULTISTEPPING_LIMIT + #define MULTISTEPPING_LIMIT 128 + #define MULTISTEPPING_LIMIT_WARNING 1 +#endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 249aa5c30e63..4bbb43a2169d 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -914,19 +914,19 @@ */ #if ENABLED(X_DUAL_ENDSTOPS) #if X_HOME_TO_MAX - #ifndef X2_MAX_ENDSTOP_INVERTING + #ifndef X2_MAX_ENDSTOP_HIT_STATE #if X2_USE_ENDSTOP == _XMIN_ - #define X2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _XMAX_ - #define X2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _YMIN_ - #define X2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _YMAX_ - #define X2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _ZMIN_ - #define X2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _ZMAX_ - #define X2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(X2_MAX) @@ -936,19 +936,19 @@ #endif #endif #else - #ifndef X2_MIN_ENDSTOP_INVERTING + #ifndef X2_MIN_ENDSTOP_HIT_STATE #if X2_USE_ENDSTOP == _XMIN_ - #define X2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _XMAX_ - #define X2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _YMIN_ - #define X2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _YMAX_ - #define X2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _ZMIN_ - #define X2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif X2_USE_ENDSTOP == _ZMAX_ - #define X2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(X2_MIN) @@ -958,11 +958,11 @@ #endif #endif #endif - #ifndef X2_MAX_ENDSTOP_INVERTING - #define X2_MAX_ENDSTOP_INVERTING false + #ifndef X2_MAX_ENDSTOP_HIT_STATE + #define X2_MAX_ENDSTOP_HIT_STATE HIGH #endif - #ifndef X2_MIN_ENDSTOP_INVERTING - #define X2_MIN_ENDSTOP_INVERTING false + #ifndef X2_MIN_ENDSTOP_HIT_STATE + #define X2_MIN_ENDSTOP_HIT_STATE HIGH #endif #endif @@ -971,19 +971,19 @@ */ #if ENABLED(Y_DUAL_ENDSTOPS) #if Y_HOME_TO_MAX - #ifndef Y2_MAX_ENDSTOP_INVERTING + #ifndef Y2_MAX_ENDSTOP_HIT_STATE #if Y2_USE_ENDSTOP == _XMIN_ - #define Y2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _XMAX_ - #define Y2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _YMIN_ - #define Y2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _YMAX_ - #define Y2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _ZMIN_ - #define Y2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _ZMAX_ - #define Y2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Y2_MAX) @@ -993,19 +993,19 @@ #endif #endif #else - #ifndef Y2_MIN_ENDSTOP_INVERTING + #ifndef Y2_MIN_ENDSTOP_HIT_STATE #if Y2_USE_ENDSTOP == _XMIN_ - #define Y2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _XMAX_ - #define Y2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _YMIN_ - #define Y2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _YMAX_ - #define Y2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _ZMIN_ - #define Y2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Y2_USE_ENDSTOP == _ZMAX_ - #define Y2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Y2_MIN) @@ -1015,11 +1015,11 @@ #endif #endif #endif - #ifndef Y2_MAX_ENDSTOP_INVERTING - #define Y2_MAX_ENDSTOP_INVERTING false + #ifndef Y2_MAX_ENDSTOP_HIT_STATE + #define Y2_MAX_ENDSTOP_HIT_STATE HIGH #endif - #ifndef Y2_MIN_ENDSTOP_INVERTING - #define Y2_MIN_ENDSTOP_INVERTING false + #ifndef Y2_MIN_ENDSTOP_HIT_STATE + #define Y2_MIN_ENDSTOP_HIT_STATE HIGH #endif #endif @@ -1029,19 +1029,19 @@ #if ENABLED(Z_MULTI_ENDSTOPS) #if Z_HOME_TO_MAX - #ifndef Z2_MAX_ENDSTOP_INVERTING + #ifndef Z2_MAX_ENDSTOP_HIT_STATE #if Z2_USE_ENDSTOP == _XMIN_ - #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _XMAX_ - #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _YMIN_ - #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _YMAX_ - #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _ZMIN_ - #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _ZMAX_ - #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Z2_MAX) @@ -1051,19 +1051,19 @@ #endif #endif #else - #ifndef Z2_MIN_ENDSTOP_INVERTING + #ifndef Z2_MIN_ENDSTOP_HIT_STATE #if Z2_USE_ENDSTOP == _XMIN_ - #define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _XMAX_ - #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _YMIN_ - #define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _YMAX_ - #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _ZMIN_ - #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Z2_USE_ENDSTOP == _ZMAX_ - #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Z2_MIN) @@ -1073,28 +1073,28 @@ #endif #endif #endif - #ifndef Z2_MAX_ENDSTOP_INVERTING - #define Z2_MAX_ENDSTOP_INVERTING false + #ifndef Z2_MAX_ENDSTOP_HIT_STATE + #define Z2_MAX_ENDSTOP_HIT_STATE HIGH #endif - #ifndef Z2_MIN_ENDSTOP_INVERTING - #define Z2_MIN_ENDSTOP_INVERTING false + #ifndef Z2_MIN_ENDSTOP_HIT_STATE + #define Z2_MIN_ENDSTOP_HIT_STATE HIGH #endif #if NUM_Z_STEPPERS >= 3 #if Z_HOME_TO_MAX - #ifndef Z3_MAX_ENDSTOP_INVERTING + #ifndef Z3_MAX_ENDSTOP_HIT_STATE #if Z3_USE_ENDSTOP == _XMIN_ - #define Z3_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _XMAX_ - #define Z3_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _YMIN_ - #define Z3_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _YMAX_ - #define Z3_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _ZMIN_ - #define Z3_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _ZMAX_ - #define Z3_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Z3_MAX) @@ -1104,19 +1104,19 @@ #endif #endif #else - #ifndef Z3_MIN_ENDSTOP_INVERTING + #ifndef Z3_MIN_ENDSTOP_HIT_STATE #if Z3_USE_ENDSTOP == _XMIN_ - #define Z3_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _XMAX_ - #define Z3_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _YMIN_ - #define Z3_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _YMAX_ - #define Z3_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _ZMIN_ - #define Z3_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Z3_USE_ENDSTOP == _ZMAX_ - #define Z3_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Z3_MIN) @@ -1126,29 +1126,29 @@ #endif #endif #endif - #ifndef Z3_MAX_ENDSTOP_INVERTING - #define Z3_MAX_ENDSTOP_INVERTING false + #ifndef Z3_MAX_ENDSTOP_HIT_STATE + #define Z3_MAX_ENDSTOP_HIT_STATE HIGH #endif - #ifndef Z3_MIN_ENDSTOP_INVERTING - #define Z3_MIN_ENDSTOP_INVERTING false + #ifndef Z3_MIN_ENDSTOP_HIT_STATE + #define Z3_MIN_ENDSTOP_HIT_STATE HIGH #endif #endif #if NUM_Z_STEPPERS >= 4 #if Z_HOME_TO_MAX - #ifndef Z4_MAX_ENDSTOP_INVERTING + #ifndef Z4_MAX_ENDSTOP_HIT_STATE #if Z4_USE_ENDSTOP == _XMIN_ - #define Z4_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _XMAX_ - #define Z4_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _YMIN_ - #define Z4_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _YMAX_ - #define Z4_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _ZMIN_ - #define Z4_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _ZMAX_ - #define Z4_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Z4_MAX) @@ -1158,19 +1158,19 @@ #endif #endif #else - #ifndef Z4_MIN_ENDSTOP_INVERTING + #ifndef Z4_MIN_ENDSTOP_HIT_STATE #if Z4_USE_ENDSTOP == _XMIN_ - #define Z4_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _XMAX_ - #define Z4_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _YMIN_ - #define Z4_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _YMAX_ - #define Z4_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _ZMIN_ - #define Z4_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE #elif Z4_USE_ENDSTOP == _ZMAX_ - #define Z4_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE #endif #endif #if !PIN_EXISTS(Z4_MIN) @@ -1180,11 +1180,11 @@ #endif #endif #endif - #ifndef Z4_MAX_ENDSTOP_INVERTING - #define Z4_MAX_ENDSTOP_INVERTING false + #ifndef Z4_MAX_ENDSTOP_HIT_STATE + #define Z4_MAX_ENDSTOP_HIT_STATE HIGH #endif - #ifndef Z4_MIN_ENDSTOP_INVERTING - #define Z4_MIN_ENDSTOP_INVERTING false + #ifndef Z4_MIN_ENDSTOP_HIT_STATE + #define Z4_MIN_ENDSTOP_HIT_STATE HIGH #endif #endif @@ -1487,43 +1487,6 @@ #endif #endif -#if !defined(DISABLE_INACTIVE_X) && ENABLED(DISABLE_X) - #define DISABLE_INACTIVE_X -#endif -#if !defined(DISABLE_INACTIVE_Y) && ENABLED(DISABLE_Y) - #define DISABLE_INACTIVE_Y -#endif -#if !defined(DISABLE_INACTIVE_Z) && ENABLED(DISABLE_Z) - #define DISABLE_INACTIVE_Z -#endif -#if !defined(DISABLE_INACTIVE_I) && ENABLED(DISABLE_I) - #define DISABLE_INACTIVE_I -#endif -#if !defined(DISABLE_INACTIVE_J) && ENABLED(DISABLE_J) - #define DISABLE_INACTIVE_J -#endif -#if !defined(DISABLE_INACTIVE_K) && ENABLED(DISABLE_K) - #define DISABLE_INACTIVE_K -#endif -#if !defined(DISABLE_INACTIVE_U) && ENABLED(DISABLE_U) - #define DISABLE_INACTIVE_U -#endif -#if !defined(DISABLE_INACTIVE_V) && ENABLED(DISABLE_V) - #define DISABLE_INACTIVE_V -#endif -#if !defined(DISABLE_INACTIVE_W) && ENABLED(DISABLE_W) - #define DISABLE_INACTIVE_W -#endif -#if !defined(DISABLE_INACTIVE_EXTRUDER) && ENABLED(DISABLE_E) - #define DISABLE_INACTIVE_EXTRUDER -#endif -#if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_EXTRUDER) - #define HAS_DISABLE_INACTIVE_AXIS 1 -#endif -#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_I, DISABLE_J, DISABLE_K, DISABLE_U, DISABLE_V, DISABLE_W, DISABLE_E) - #define HAS_DISABLE_AXIS 1 -#endif - // Extruder steppers and solenoids #if HAS_EXTRUDERS @@ -2212,6 +2175,14 @@ #undef TMC_UART_IS #undef ANY_SERIAL_IS +#if defined(__AVR_ARCH__) && defined(TMC_SPI_MISO) && defined(TMC_SPI_MOSI) && defined(TMC_SPI_SCK) + // Check that the pins are the solitary supported SPI hardware pins of the (AVR) platform. + // Otherwise we are forced to enable software SPI. + #if TMC_SPI_MISO != MISO || TMC_SPI_MOSI != MOSI || TMC_SPI_SCK != SCK + #define TMC_USE_SW_SPI + #endif +#endif + // Clean up unused ESP_WIFI pins #ifdef ESP_WIFI_MODULE_COM #if !SERIAL_IN_USE(ESP_WIFI_MODULE_COM) @@ -2499,7 +2470,7 @@ #if EITHER(PIDTEMP, PIDTEMPBED) #define DWIN_PID_TUNE 1 #endif - #if EITHER(DWIN_PID_TUNE, MPCTEMP) && DISABLED(DISABLE_TUNING_GRAPH) + #if EITHER(DWIN_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) #define SHOW_TUNING_GRAPH 1 #endif #endif @@ -2564,10 +2535,21 @@ #if ANY(HAS_AUTO_FAN_0, HAS_AUTO_FAN_1, HAS_AUTO_FAN_2, HAS_AUTO_FAN_3, HAS_AUTO_FAN_4, HAS_AUTO_FAN_5, HAS_AUTO_FAN_6, HAS_AUTO_FAN_7, HAS_AUTO_CHAMBER_FAN, HAS_AUTO_COOLER_FAN) #define HAS_AUTO_FAN 1 -#endif -#define _FANOVERLAP(A,B) (A##_AUTO_FAN_PIN == E##B##_AUTO_FAN_PIN) -#if HAS_AUTO_FAN && (_FANOVERLAP(CHAMBER,0) || _FANOVERLAP(CHAMBER,1) || _FANOVERLAP(CHAMBER,2) || _FANOVERLAP(CHAMBER,3) || _FANOVERLAP(CHAMBER,4) || _FANOVERLAP(CHAMBER,5) || _FANOVERLAP(CHAMBER,6) || _FANOVERLAP(CHAMBER,7)) - #define AUTO_CHAMBER_IS_E 1 + #define _FANOVERLAP(I,T) (T##_AUTO_FAN_PIN == E##I##_AUTO_FAN_PIN) + #if HAS_AUTO_CHAMBER_FAN + #define _CHFANOVERLAP(I) || _FANOVERLAP(I,CHAMBER) + #if (0 REPEAT(8, _CHFANOVERLAP)) + #define AUTO_CHAMBER_IS_E 1 + #endif + #undef _CHFANOVERLAP + #endif + #if HAS_AUTO_COOLER_FAN + #define _COFANOVERLAP(I) || _FANOVERLAP(I,COOLER) + #if (0 REPEAT(8, _COFANOVERLAP)) + #define AUTO_COOLER_IS_E 1 + #endif + #undef _COFANOVERLAP + #endif #endif // Fans check @@ -2612,6 +2594,9 @@ #if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E #undef AUTO_POWER_CHAMBER_FAN #endif +#if !HAS_AUTO_COOLER_FAN || AUTO_COOLER_IS_E + #undef AUTO_POWER_COOLER_FAN +#endif // Print Cooling fans (limit) #ifdef NUM_M106_FANS @@ -2620,19 +2605,14 @@ #define MAX_FANS 8 // Max supported fans #endif -#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN) -#define _HAS_FAN(F) (PIN_EXISTS(FAN##F) \ +#define _IS_E_AUTO(N,F) (PIN_EXISTS(E##N##_AUTO_FAN) && E##N##_AUTO_FAN_PIN == FAN##F##_PIN) +#define _HAS_FAN(F) (F < MAX_FANS && PIN_EXISTS(FAN##F) \ && CONTROLLER_FAN_PIN != FAN##F##_PIN \ - && _NOT_E_AUTO(0,F) \ - && _NOT_E_AUTO(1,F) \ - && _NOT_E_AUTO(2,F) \ - && _NOT_E_AUTO(3,F) \ - && _NOT_E_AUTO(4,F) \ - && _NOT_E_AUTO(5,F) \ - && _NOT_E_AUTO(6,F) \ - && _NOT_E_AUTO(7,F) \ - && F < MAX_FANS) -#if PIN_EXISTS(FAN) + && !_IS_E_AUTO(0,F) && !_IS_E_AUTO(1,F) \ + && !_IS_E_AUTO(2,F) && !_IS_E_AUTO(3,F) \ + && !_IS_E_AUTO(4,F) && !_IS_E_AUTO(5,F) \ + && !_IS_E_AUTO(6,F) && !_IS_E_AUTO(7,F)) +#if _HAS_FAN(0) #define HAS_FAN0 1 #endif #if _HAS_FAN(1) @@ -2664,7 +2644,7 @@ #endif /** - * Up to 3 PWM fans + * Up to 8 PWM fans */ #ifndef FAN_INVERTING #define FAN_INVERTING false @@ -2818,54 +2798,24 @@ #define HAS_MICROSTEPS 1 #endif -/** - * Heater signal inversion defaults - */ - -#if HAS_HEATER_0 && !defined(HEATER_0_INVERTING) - #define HEATER_0_INVERTING false -#endif -#if HAS_HEATER_1 && !defined(HEATER_1_INVERTING) - #define HEATER_1_INVERTING false -#endif -#if HAS_HEATER_2 && !defined(HEATER_2_INVERTING) - #define HEATER_2_INVERTING false -#endif -#if HAS_HEATER_3 && !defined(HEATER_3_INVERTING) - #define HEATER_3_INVERTING false -#endif -#if HAS_HEATER_4 && !defined(HEATER_4_INVERTING) - #define HEATER_4_INVERTING false -#endif -#if HAS_HEATER_5 && !defined(HEATER_5_INVERTING) - #define HEATER_5_INVERTING false -#endif -#if HAS_HEATER_6 && !defined(HEATER_6_INVERTING) - #define HEATER_6_INVERTING false -#endif -#if HAS_HEATER_7 && !defined(HEATER_7_INVERTING) - #define HEATER_7_INVERTING false -#endif - /** * Helper Macros for heaters and extruder fan */ - -#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING) +#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ ENABLED(HEATER_0_INVERTING)) #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) - #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ HEATER_1_INVERTING) + #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ ENABLED(HEATER_1_INVERTING)) #if HOTENDS > 2 - #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ HEATER_2_INVERTING) + #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ ENABLED(HEATER_2_INVERTING)) #if HOTENDS > 3 - #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, (v) ^ HEATER_3_INVERTING) + #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, (v) ^ ENABLED(HEATER_3_INVERTING)) #if HOTENDS > 4 - #define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, (v) ^ HEATER_4_INVERTING) + #define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, (v) ^ ENABLED(HEATER_4_INVERTING)) #if HOTENDS > 5 - #define WRITE_HEATER_5(v) WRITE(HEATER_5_PIN, (v) ^ HEATER_5_INVERTING) + #define WRITE_HEATER_5(v) WRITE(HEATER_5_PIN, (v) ^ ENABLED(HEATER_5_INVERTING)) #if HOTENDS > 6 - #define WRITE_HEATER_6(v) WRITE(HEATER_6_PIN, (v) ^ HEATER_6_INVERTING) + #define WRITE_HEATER_6(v) WRITE(HEATER_6_PIN, (v) ^ ENABLED(HEATER_6_INVERTING)) #if HOTENDS > 7 - #define WRITE_HEATER_7(v) WRITE(HEATER_7_PIN, (v) ^ HEATER_7_INVERTING) + #define WRITE_HEATER_7(v) WRITE(HEATER_7_PIN, (v) ^ ENABLED(HEATER_7_INVERTING)) #endif // HOTENDS > 7 #endif // HOTENDS > 6 #endif // HOTENDS > 5 @@ -2879,10 +2829,6 @@ #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v) #endif -#ifndef MIN_POWER - #define MIN_POWER 0 -#endif - /** * Heated bed requires settings */ @@ -2893,10 +2839,7 @@ #ifndef MAX_BED_POWER #define MAX_BED_POWER 255 #endif - #ifndef HEATER_BED_INVERTING - #define HEATER_BED_INVERTING false - #endif - #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, (v) ^ HEATER_BED_INVERTING) + #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, (v) ^ ENABLED(HEATER_BED_INVERTING)) #endif /** @@ -2909,10 +2852,7 @@ #ifndef MAX_CHAMBER_POWER #define MAX_CHAMBER_POWER 255 #endif - #ifndef HEATER_CHAMBER_INVERTING - #define HEATER_CHAMBER_INVERTING false - #endif - #define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING) + #define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ ENABLED(HEATER_CHAMBER_INVERTING)) #endif /** @@ -2922,10 +2862,7 @@ #ifndef MAX_COOLER_POWER #define MAX_COOLER_POWER 255 #endif - #ifndef COOLER_INVERTING - #define COOLER_INVERTING true - #endif - #define WRITE_HEATER_COOLER(v) WRITE(COOLER_PIN, (v) ^ COOLER_INVERTING) + #define WRITE_HEATER_COOLER(v) WRITE(COOLER_PIN, (v) ^ ENABLED(COOLER_INVERTING)) #endif #if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER || HAS_COOLER @@ -3156,14 +3093,14 @@ // Probing points may be verified at compile time within the radius // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(PRINTABLE_RADIUS),"bad probe point!") // so that may be added to SanityCheck.h in the future. - #define _MESH_MIN_X (X_MIN_BED + MESH_INSET) - #define _MESH_MIN_Y (Y_MIN_BED + MESH_INSET) + #define _MESH_MIN_X (X_MIN_BED + (MESH_INSET)) + #define _MESH_MIN_Y (Y_MIN_BED + (MESH_INSET)) #define _MESH_MAX_X (X_MAX_BED - (MESH_INSET)) #define _MESH_MAX_Y (Y_MAX_BED - (MESH_INSET)) #else // Boundaries for Cartesian probing based on set limits - #define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS)) // UBL is careful not to probe off the bed. It does not - #define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS)) // need NOZZLE_TO_PROBE_OFFSET in the mesh dimensions + #define _MESH_MIN_X (_MAX(X_MIN_BED + (MESH_INSET), X_MIN_POS)) // UBL is careful not to probe off the bed. It doesn't + #define _MESH_MIN_Y (_MAX(Y_MIN_BED + (MESH_INSET), Y_MIN_POS)) // need NOZZLE_TO_PROBE_OFFSET in the mesh dimensions. #define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS)) #define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS)) #endif @@ -3188,13 +3125,9 @@ #undef MESH_MAX_Y #endif -#define _POINT_COUNT (defined(PROBE_PT_1_X) + defined(PROBE_PT_2_X) + defined(PROBE_PT_3_X) + defined(PROBE_PT_1_Y) + defined(PROBE_PT_2_Y) + defined(PROBE_PT_3_Y)) -#if _POINT_COUNT == 6 - #define HAS_FIXED_3POINT 1 -#elif _POINT_COUNT > 0 - #error "For 3-Point Leveling all XY points must be defined (or none for the defaults)." +#if NEEDS_THREE_PROBE_POINTS && defined(PROBE_PT_1) + #define HAS_FIXED_3POINT 1 // Points are defined for ABL/UBL. Else calculated in probe.get_three_points. #endif -#undef _POINT_COUNT /** * Buzzer/Speaker @@ -3329,10 +3262,11 @@ // Number of VFAT entries used. Each entry has 13 UTF-16 characters #if ANY(SCROLL_LONG_FILENAMES, HAS_DWIN_E3V2, TFT_COLOR_UI) - #define MAX_VFAT_ENTRIES (5) + #define VFAT_ENTRIES_LIMIT 5 #else - #define MAX_VFAT_ENTRIES (2) + #define VFAT_ENTRIES_LIMIT 2 #endif +#define MAX_VFAT_ENTRIES 20 // by VFAT specs to fit LFN of length 255 // Nozzle park for Delta #if BOTH(NOZZLE_PARK_FEATURE, DELTA) @@ -3346,14 +3280,17 @@ #if defined(TARGET_LPC1768) && IS_RRD_FG_SC && (SD_SCK_PIN == LCD_PINS_D4) #define SDCARD_SORT_ALPHA // Keep one directory level in RAM. Changing directory levels // may still glitch the screen, but LCD updates clean it up. - #undef SDSORT_LIMIT - #undef SDSORT_USES_RAM - #undef SDSORT_USES_STACK - #undef SDSORT_CACHE_NAMES - #define SDSORT_LIMIT 64 - #define SDSORT_USES_RAM true - #define SDSORT_USES_STACK false - #define SDSORT_CACHE_NAMES true + #if SDSORT_LIMIT > 64 || !SDSORT_USES_RAM || SDSORT_USES_STACK || !SDSORT_CACHE_NAMES + #undef SDSORT_LIMIT + #undef SDSORT_USES_RAM + #undef SDSORT_USES_STACK + #undef SDSORT_CACHE_NAMES + #define SDSORT_LIMIT 64 + #define SDSORT_USES_RAM true + #define SDSORT_USES_STACK false + #define SDSORT_CACHE_NAMES true + #define SDSORT_CACHE_LPC1768_WARNING 1 + #endif #ifndef FOLDER_SORTING #define FOLDER_SORTING -1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 02e7dba54b90..ce657f24a63d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -658,6 +658,8 @@ #error "EXTRA_LIN_ADVANCE_K is now ADVANCE_K_EXTRA." #elif defined(POLAR_SEGMENTS_PER_SECOND) || defined(DELTA_SEGMENTS_PER_SECOND) || defined(SCARA_SEGMENTS_PER_SECOND) || defined(TPARA_SEGMENTS_PER_SECOND) #error "(POLAR|DELTA|SCARA|TPARA)_SEGMENTS_PER_SECOND is now DEFAULT_SEGMENTS_PER_SECOND." +#elif defined(TMC_SW_MOSI) || defined(TMC_SW_MISO) || defined(TMC_SW_SCK) + #error "TMC_SW_(MOSI|MISO|SCK) is now TMC_SPI_(MOSI|MISO|SCK)." #elif ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) && !defined(DGUS_LCD_UI) #error "DGUS_LCD_UI_[TYPE] is now set using DGUS_LCD_UI TYPE." #elif defined(DELTA_PRINTABLE_RADIUS) @@ -672,10 +674,32 @@ #error "EXPERIMENTAL_SCURVE is no longer needed and should be removed." #elif defined(BABYSTEP_ZPROBE_GFX_OVERLAY) #error "BABYSTEP_ZPROBE_GFX_OVERLAY is now BABYSTEP_GFX_OVERLAY." -#elif defined(DISABLE_INACTIVE_E) - #error "DISABLE_INACTIVE_E is now set with DISABLE_INACTIVE_EXTRUDER." +#elif defined(DISABLE_INACTIVE_EXTRUDER) + #error "DISABLE_INACTIVE_EXTRUDER is now DISABLE_OTHER_EXTRUDERS." #elif defined(INVERT_X_STEP_PIN) || defined(INVERT_Y_STEP_PIN) || defined(INVERT_Z_STEP_PIN) || defined(INVERT_I_STEP_PIN) || defined(INVERT_J_STEP_PIN) || defined(INVERT_K_STEP_PIN) || defined(INVERT_U_STEP_PIN) || defined(INVERT_V_STEP_PIN) || defined(INVERT_W_STEP_PIN) || defined(INVERT_E_STEP_PIN) #error "INVERT_*_STEP_PIN true is now STEP_STATE_* LOW, and INVERT_*_STEP_PIN false is now STEP_STATE_* HIGH." +#elif defined(PROBE_PT_1_X) || defined(PROBE_PT_1_Y) || defined(PROBE_PT_2_X) || defined(PROBE_PT_2_Y) || defined(PROBE_PT_3_X) || defined(PROBE_PT_3_Y) + #error "PROBE_PT_[123]_[XY] is now defined using PROBE_PT_[123] with an array { x, y }." +#elif defined(SQUARE_WAVE_STEPPING) + #error "SQUARE_WAVE_STEPPING is now EDGE_STEPPING." +#elif defined(FAN_PIN) + #error "FAN_PIN is now FAN0_PIN." +#elif defined(X_MIN_ENDSTOP_INVERTING) || defined(Y_MIN_ENDSTOP_INVERTING) || defined(Z_MIN_ENDSTOP_INVERTING) \ + || defined(I_MIN_ENDSTOP_INVERTING) || defined(J_MIN_ENDSTOP_INVERTING) || defined(K_MIN_ENDSTOP_INVERTING) \ + || defined(U_MIN_ENDSTOP_INVERTING) || defined(V_MIN_ENDSTOP_INVERTING) || defined(W_MIN_ENDSTOP_INVERTING) \ + || defined(X_MAX_ENDSTOP_INVERTING) || defined(Y_MAX_ENDSTOP_INVERTING) || defined(Z_MAX_ENDSTOP_INVERTING) \ + || defined(I_MAX_ENDSTOP_INVERTING) || defined(J_MAX_ENDSTOP_INVERTING) || defined(K_MAX_ENDSTOP_INVERTING) \ + || defined(U_MAX_ENDSTOP_INVERTING) || defined(V_MAX_ENDSTOP_INVERTING) || defined(W_MAX_ENDSTOP_INVERTING) \ + || defined(Z_MIN_PROBE_ENDSTOP_INVERTING) + #error "*_ENDSTOP_INVERTING false/true is now set with *_ENDSTOP_HIT_STATE HIGH/LOW." +#elif defined(DISABLE_INACTIVE_X) || defined(DISABLE_INACTIVE_Y) || defined(DISABLE_INACTIVE_Z) \ + || defined(DISABLE_INACTIVE_I) || defined(DISABLE_INACTIVE_J) || defined(DISABLE_INACTIVE_K) \ + || defined(DISABLE_INACTIVE_U) || defined(DISABLE_INACTIVE_V) || defined(DISABLE_INACTIVE_W) || defined(DISABLE_INACTIVE_E) + #error "DISABLE_INACTIVE_[XYZIJKUVWE] is now DISABLE_IDLE_[XYZIJKUVWE]." +#elif defined(DEFAULT_STEPPER_DEACTIVE_TIME) + #error "DEFAULT_STEPPER_DEACTIVE_TIME is now DEFAULT_STEPPER_TIMEOUT_SEC." +#elif defined(TFT_SHARED_SPI) + #error "TFT_SHARED_SPI is now TFT_SHARED_IO." #endif // L64xx stepper drivers have been removed @@ -712,6 +736,17 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #undef _ISMAX_1 #undef _ISSNS_1 +/** + * Hephestos 2 Heated Bed Kit requirements + */ +#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) + #if TEMP_SENSOR_BED != 70 + #error "HEPHESTOS2_HEATED_BED_KIT requires TEMP_SENSOR_BED 70." + #elif DISABLED(HEATER_BED_INVERTING) + #error "HEPHESTOS2_HEATED_BED_KIT requires HEATER_BED_INVERTING." + #endif +#endif + /** * Probe temp compensation requirements */ @@ -996,7 +1031,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS * SD File Sorting */ #if ENABLED(SDCARD_SORT_ALPHA) - #if SDSORT_LIMIT > 256 + #if NONE(EXTENSIBLE_UI, HAS_MARLINUI_MENU, DWIN_CREALITY_LCD, DWIN_CREALITY_LCD_JYERSUI, DWIN_LCD_PROUI) + #error "SDCARD_SORT_ALPHA requires an LCD that supports it. (It doesn't apply to M20, etc.)" + #elif SDSORT_LIMIT > 256 #error "SDSORT_LIMIT must be 256 or smaller." #elif SDSORT_LIMIT < 10 #error "SDSORT_LIMIT should be greater than 9 to be useful." @@ -1011,10 +1048,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #if ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) #if SDSORT_CACHE_VFATS < 2 #error "SDSORT_CACHE_VFATS must be 2 or greater!" - #elif SDSORT_CACHE_VFATS > MAX_VFAT_ENTRIES + #elif SDSORT_CACHE_VFATS > VFAT_ENTRIES_LIMIT #undef SDSORT_CACHE_VFATS - #define SDSORT_CACHE_VFATS MAX_VFAT_ENTRIES - #warning "SDSORT_CACHE_VFATS was reduced to MAX_VFAT_ENTRIES!" + #define SDSORT_CACHE_VFATS VFAT_ENTRIES_LIMIT + #define SDSORT_CACHE_VFATS_WARNING 1 #endif #endif #endif @@ -1148,11 +1185,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #if ENABLED(NOZZLE_PARK_FEATURE) constexpr float npp[] = NOZZLE_PARK_POINT; - static_assert(COUNT(npp) == XYZ, "NOZZLE_PARK_POINT requires X, Y, and Z values."); + static_assert(COUNT(npp) == _MIN(NUM_AXES, XYZ), "NOZZLE_PARK_POINT requires coordinates for enabled axes, but only up to X,Y,Z."); constexpr xyz_pos_t npp_xyz = NOZZLE_PARK_POINT; static_assert(WITHIN(npp_xyz.x, X_MIN_POS, X_MAX_POS), "NOZZLE_PARK_POINT.X is out of bounds (X_MIN_POS, X_MAX_POS)."); - static_assert(WITHIN(npp_xyz.y, Y_MIN_POS, Y_MAX_POS), "NOZZLE_PARK_POINT.Y is out of bounds (Y_MIN_POS, Y_MAX_POS)."); - static_assert(WITHIN(npp_xyz.z, Z_MIN_POS, Z_MAX_POS), "NOZZLE_PARK_POINT.Z is out of bounds (Z_MIN_POS, Z_MAX_POS)."); + static_assert(TERN1(HAS_Y_AXIS, WITHIN(npp_xyz.y, Y_MIN_POS, Y_MAX_POS)), "NOZZLE_PARK_POINT.Y is out of bounds (Y_MIN_POS, Y_MAX_POS)."); + static_assert(TERN1(HAS_Z_AXIS, WITHIN(npp_xyz.z, Z_MIN_POS, Z_MAX_POS)), "NOZZLE_PARK_POINT.Z is out of bounds (Z_MIN_POS, Z_MAX_POS)."); #endif /** @@ -1269,20 +1306,34 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS /** * A Dual Nozzle carriage with switching servo */ -#if ENABLED(SWITCHING_NOZZLE) - #if ENABLED(DUAL_X_CARRIAGE) +#if BOTH(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) + #error "Enable only one of SWITCHING_NOZZLE or MECHANICAL_SWITCHING_NOZZLE." +#elif ENABLED(MECHANICAL_SWITCHING_NOZZLE) + #if EXTRUDERS != 2 + #error "MECHANICAL_SWITCHING_NOZZLE requires exactly 2 EXTRUDERS." + #elif ENABLED(DUAL_X_CARRIAGE) + #error "MECHANICAL_SWITCHING_NOZZLE and DUAL_X_CARRIAGE are incompatible." + #elif ENABLED(SINGLENOZZLE) + #error "MECHANICAL_SWITCHING_NOZZLE and SINGLENOZZLE are incompatible." + #elif HAS_PRUSA_MMU2 + #error "MECHANICAL_SWITCHING_NOZZLE and PRUSA_MMU2(S) are incompatible." + #elif !defined(EVENT_GCODE_TOOLCHANGE_T0) + #error "MECHANICAL_SWITCHING_NOZZLE requires EVENT_GCODE_TOOLCHANGE_T0." + #elif !defined(EVENT_GCODE_TOOLCHANGE_T1) + #error "MECHANICAL_SWITCHING_NOZZLE requires EVENT_GCODE_TOOLCHANGE_T1." + #endif +#elif ENABLED(SWITCHING_NOZZLE) + #if EXTRUDERS != 2 + #error "SWITCHING_NOZZLE requires exactly 2 EXTRUDERS." + #elif ENABLED(DUAL_X_CARRIAGE) #error "SWITCHING_NOZZLE and DUAL_X_CARRIAGE are incompatible." #elif ENABLED(SINGLENOZZLE) #error "SWITCHING_NOZZLE and SINGLENOZZLE are incompatible." #elif HAS_PRUSA_MMU2 #error "SWITCHING_NOZZLE and PRUSA_MMU2(S) are incompatible." - #elif EXTRUDERS != 2 - #error "SWITCHING_NOZZLE requires exactly 2 EXTRUDERS." #elif NUM_SERVOS < 1 #error "SWITCHING_NOZZLE requires NUM_SERVOS >= 1." - #endif - - #ifndef SWITCHING_NOZZLE_SERVO_NR + #elif !defined(SWITCHING_NOZZLE_SERVO_NR) #error "SWITCHING_NOZZLE requires SWITCHING_NOZZLE_SERVO_NR." #elif SWITCHING_NOZZLE_SERVO_NR == 0 && !PIN_EXISTS(SERVO0) #error "SERVO0_PIN must be defined for your SWITCHING_NOZZLE." @@ -1293,7 +1344,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #elif SWITCHING_NOZZLE_SERVO_NR == 3 && !PIN_EXISTS(SERVO3) #error "SERVO3_PIN must be defined for your SWITCHING_NOZZLE." #endif - #ifdef SWITCHING_NOZZLE_E1_SERVO_NR #if SWITCHING_NOZZLE_E1_SERVO_NR == SWITCHING_NOZZLE_SERVO_NR #error "SWITCHING_NOZZLE_E1_SERVO_NR must be different from SWITCHING_NOZZLE_SERVO_NR." @@ -1307,14 +1357,26 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "SERVO3_PIN must be defined for your SWITCHING_NOZZLE." #endif #endif -#endif +#endif // SWITCHING_NOZZLE /** * Single Stepper Dual Extruder with switching servo */ -#if ENABLED(SWITCHING_EXTRUDER) +#if BOTH(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) + #error "Enable only one of SWITCHING_EXTRUDER or MECHANICAL_SWITCHING_EXTRUDER." +#elif ENABLED(MECHANICAL_SWITCHING_EXTRUDER) + #if EXTRUDERS < 2 + #error "MECHANICAL_SWITCHING_EXTRUDER requires EXTRUDERS >= 2." + #elif !defined(EVENT_GCODE_TOOLCHANGE_T0) + #error "MECHANICAL_SWITCHING_EXTRUDER requires EVENT_GCODE_TOOLCHANGE_T0." + #elif !defined(EVENT_GCODE_TOOLCHANGE_T1) + #error "MECHANICAL_SWITCHING_EXTRUDER requires EVENT_GCODE_TOOLCHANGE_T1." + #endif +#elif ENABLED(SWITCHING_EXTRUDER) #if NUM_SERVOS < 1 #error "SWITCHING_EXTRUDER requires NUM_SERVOS >= 1." + #elif !defined(SWITCHING_EXTRUDER_SERVO_NR) + #error "SWITCHING_EXTRUDER requires SWITCHING_EXTRUDER_SERVO_NR." #elif SWITCHING_EXTRUDER_SERVO_NR == 0 && !PIN_EXISTS(SERVO0) #error "SERVO0_PIN must be defined for your SWITCHING_EXTRUDER." #elif SWITCHING_EXTRUDER_SERVO_NR == 1 && !PIN_EXISTS(SERVO1) @@ -1338,8 +1400,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #elif SWITCHING_EXTRUDER_E23_SERVO_NR == SWITCHING_EXTRUDER_SERVO_NR #error "SWITCHING_EXTRUDER_E23_SERVO_NR should be a different extruder from SWITCHING_EXTRUDER_SERVO_NR." #endif + #elif EXTRUDERS < 2 + #error "SWITCHING_EXTRUDER requires EXTRUDERS >= 2." #endif -#endif +#endif // SWITCHING_EXTRUDER /** * Mixing Extruder requirements @@ -1351,12 +1415,12 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "You must set MIXING_STEPPERS >= 2 for a mixing extruder." #elif ENABLED(FILAMENT_WIDTH_SENSOR) #error "MIXING_EXTRUDER is incompatible with FILAMENT_WIDTH_SENSOR. Comment out this line to use it anyway." - #elif ENABLED(SWITCHING_EXTRUDER) - #error "Please select either MIXING_EXTRUDER or SWITCHING_EXTRUDER, not both." + #elif HAS_SWITCHING_EXTRUDER + #error "MIXING_EXTRUDER is incompatible with (MECHANICAL_)SWITCHING_EXTRUDER." #elif ENABLED(SINGLENOZZLE) #error "MIXING_EXTRUDER is incompatible with SINGLENOZZLE." - #elif ENABLED(DISABLE_INACTIVE_EXTRUDER) - #error "MIXING_EXTRUDER is incompatible with DISABLE_INACTIVE_EXTRUDER." + #elif ENABLED(DISABLE_OTHER_EXTRUDERS) + #error "MIXING_EXTRUDER is incompatible with DISABLE_OTHER_EXTRUDERS." #elif HAS_FILAMENT_RUNOUT_DISTANCE #error "MIXING_EXTRUDER is incompatible with FILAMENT_RUNOUT_DISTANCE_MM." #endif @@ -1370,8 +1434,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "E_DUAL_STEPPER_DRIVERS can only be used with EXTRUDERS set to 1." #elif ENABLED(MIXING_EXTRUDER) #error "E_DUAL_STEPPER_DRIVERS is incompatible with MIXING_EXTRUDER." - #elif ENABLED(SWITCHING_EXTRUDER) - #error "E_DUAL_STEPPER_DRIVERS is incompatible with SWITCHING_EXTRUDER." + #elif HAS_SWITCHING_EXTRUDER + #error "E_DUAL_STEPPER_DRIVERS is incompatible with (MECHANICAL_)SWITCHING_EXTRUDER." #endif #endif @@ -1531,6 +1595,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS */ #if BOTH(PIDTEMP, MPCTEMP) #error "Only enable PIDTEMP or MPCTEMP, but not both." + #undef MPCTEMP + #undef MPC_AUTOTUNE + #undef MPC_EDIT_MENU + #undef MPC_AUTOTUNE_MENU #endif #if ENABLED(MPC_INCLUDE_FAN) @@ -1837,19 +1905,19 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #endif #if ENABLED(INVERTED_PROBE_STATE) - #if !Z_MIN_PROBE_ENDSTOP_INVERTING - #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_INVERTING set to true." + #if Z_MIN_PROBE_ENDSTOP_HIT_STATE != LOW + #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_HIT_STATE LOW." #endif - #elif Z_MIN_PROBE_ENDSTOP_INVERTING - #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_INVERTING set to false." + #elif Z_MIN_PROBE_ENDSTOP_HIT_STATE != HIGH + #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_HIT_STATE HIGH." #endif #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if ENABLED(INVERTED_PROBE_STATE) - #if !Z_MIN_ENDSTOP_INVERTING - #error "BLTOUCH requires Z_MIN_ENDSTOP_INVERTING set to true." + #if Z_MIN_ENDSTOP_HIT_STATE != LOW + #error "BLTOUCH requires Z_MIN_ENDSTOP_HIT_STATE LOW." #endif - #elif Z_MIN_ENDSTOP_INVERTING - #error "BLTOUCH requires Z_MIN_ENDSTOP_INVERTING set to false." + #elif Z_MIN_ENDSTOP_HIT_STATE != HIGH + #error "BLTOUCH requires Z_MIN_ENDSTOP_HIT_STATE HIGH." #endif #endif @@ -1877,19 +1945,19 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "TOUCH_MI_PROBE currently requires an LCD controller or EMERGENCY_PARSER." #endif #if ENABLED(INVERTED_PROBE_STATE) - #if !Z_MIN_PROBE_ENDSTOP_INVERTING - #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_INVERTING set to true." + #if Z_MIN_PROBE_ENDSTOP_HIT_STATE != LOW + #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_HIT_STATE LOW." #endif - #elif Z_MIN_PROBE_ENDSTOP_INVERTING - #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_INVERTING set to false." + #elif Z_MIN_PROBE_ENDSTOP_HIT_STATE != HIGH + #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_HIT_STATE HIGH." #endif #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if ENABLED(INVERTED_PROBE_STATE) - #if !Z_MIN_ENDSTOP_INVERTING - #error "TOUCH_MI_PROBE requires Z_MIN_ENDSTOP_INVERTING set to true." + #if Z_MIN_ENDSTOP_HIT_STATE != LOW + #error "TOUCH_MI_PROBE requires Z_MIN_ENDSTOP_HIT_STATE LOW." #endif - #elif Z_MIN_ENDSTOP_INVERTING - #error "TOUCH_MI_PROBE requires Z_MIN_ENDSTOP_INVERTING set to false." + #elif Z_MIN_ENDSTOP_HIT_STATE != HIGH + #error "TOUCH_MI_PROBE requires Z_MIN_ENDSTOP_HIT_STATE HIGH." #endif #endif #endif // TOUCH_MI_PROBE @@ -1919,17 +1987,17 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS */ #if ENABLED(SENSORLESS_PROBING) #if ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS) - #error "SENSORLESS_PROBING requires TMC2130/2160/2209/5130/5160 drivers on X, Y, and Z." + #error "SENSORLESS_PROBING requires TMC2130/2160/2209/5130/5160 drivers on X, Y, and Z and {X|Y|Z}_STALL_SENSITIVITY." #elif !Z_SENSORLESS - #error "SENSORLESS_PROBING requires a TMC2130/2160/2209/5130/5160 driver on Z." + #error "SENSORLESS_PROBING requires a TMC2130/2160/2209/5130/5160 driver on Z and Z_STALL_SENSITIVITY." #endif #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if DISABLED(USE_ZMIN_PLUG) #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires USE_ZMIN_PLUG to be enabled." #elif !HAS_Z_MIN #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined." - #elif Z_MIN_PROBE_ENDSTOP_INVERTING != Z_MIN_ENDSTOP_INVERTING - #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING." + #elif Z_MIN_PROBE_ENDSTOP_HIT_STATE != Z_MIN_ENDSTOP_HIT_STATE + #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_HIT_STATE to match Z_MIN_PROBE_ENDSTOP_HIT_STATE." #endif #elif !HAS_Z_MIN_PROBE_PIN #error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled." @@ -2075,6 +2143,12 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #endif +#define _POINT_COUNT (defined(PROBE_PT_1) + defined(PROBE_PT_2) + defined(PROBE_PT_3)) +#if _POINT_COUNT != 0 && _POINT_COUNT != 3 + #error "For 3-Point Procedures all XY points must be defined (or none for the defaults)." +#endif +#undef _POINT_COUNT + #if ALL(HAS_LEVELING, RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28) #error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both." #endif @@ -2233,10 +2307,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS /** * Make sure DISABLE_[XYZ] compatible with selected homing options */ -#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_I, DISABLE_J, DISABLE_K, DISABLE_U, DISABLE_V, DISABLE_W) - #if EITHER(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING) - #error "DISABLE_[XYZIJKUVW] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." - #endif +#if HAS_DISABLE_MAIN_AXES && EITHER(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING) + #error "DISABLE_[XYZIJKUVW] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." #endif /** @@ -2328,21 +2400,21 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS */ #if HAS_AUTO_FAN #if HAS_FAN0 - #if PIN_EXISTS(E0_AUTO_FAN) && E0_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN." - #elif PIN_EXISTS(E1_AUTO_FAN) && E1_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set E1_AUTO_FAN_PIN equal to FAN_PIN." - #elif PIN_EXISTS(E2_AUTO_FAN) && E2_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set E2_AUTO_FAN_PIN equal to FAN_PIN." - #elif PIN_EXISTS(E3_AUTO_FAN) && E3_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set E3_AUTO_FAN_PIN equal to FAN_PIN." + #if PIN_EXISTS(E0_AUTO_FAN) && E0_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E0_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PIN_EXISTS(E1_AUTO_FAN) && E1_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E1_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PIN_EXISTS(E2_AUTO_FAN) && E2_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E2_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PIN_EXISTS(E3_AUTO_FAN) && E3_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E3_AUTO_FAN_PIN equal to FAN0_PIN." #endif #endif #endif #if HAS_FAN0 - #if CONTROLLER_FAN_PIN == FAN_PIN - #error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN." + #if CONTROLLER_FAN_PIN == FAN0_PIN + #error "You cannot set CONTROLLER_FAN_PIN equal to FAN0_PIN." #elif ENABLED(FAN_SOFT_PWM_REQUIRED) && DISABLED(FAN_SOFT_PWM) #error "FAN_SOFT_PWM is required for your board. Enable it to continue." #endif @@ -2384,8 +2456,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #if NEED_CASE_LIGHT_PIN #if !PIN_EXISTS(CASE_LIGHT) #error "CASE_LIGHT_ENABLE requires CASE_LIGHT_PIN, CASE_LIGHT_USE_NEOPIXEL, or CASE_LIGHT_USE_RGB_LED." - #elif CASE_LIGHT_PIN == FAN_PIN - #error "CASE_LIGHT_PIN conflicts with FAN_PIN. Resolve before continuing." + #elif CASE_LIGHT_PIN == FAN0_PIN + #error "CASE_LIGHT_PIN conflicts with FAN0_PIN. Resolve before continuing." #endif #endif @@ -2623,6 +2695,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #endif // HOTENDS > 2 #endif // HAS_MULTI_HOTEND +#if DO_TOOLCHANGE_FOR_PROBING && PROBING_TOOL >= EXTRUDERS + #error "PROBING_TOOL must be a valid tool index." +#endif + /** * Pins must be set for temp sensors, with some other feature requirements. */ @@ -2733,8 +2809,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "MULTI_NOZZLE_DUPLICATION is incompatible with DUAL_X_CARRIAGE." #elif ENABLED(MIXING_EXTRUDER) #error "MULTI_NOZZLE_DUPLICATION is incompatible with MIXING_EXTRUDER." - #elif ENABLED(SWITCHING_EXTRUDER) - #error "MULTI_NOZZLE_DUPLICATION is incompatible with SWITCHING_EXTRUDER." + #elif HAS_SWITCHING_EXTRUDER + #error "MULTI_NOZZLE_DUPLICATION is incompatible with (MECHANICAL_)SWITCHING_EXTRUDER." #elif HOTENDS < 2 #error "MULTI_NOZZLE_DUPLICATION requires 2 or more hotends." #endif @@ -2994,24 +3070,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS * Auto Fan check for PWM pins */ #if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255 - #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255." - #if HAS_AUTO_FAN_0 - static_assert(_TEST_PWM(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_1 - static_assert(_TEST_PWM(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_2 - static_assert(_TEST_PWM(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_3 - static_assert(_TEST_PWM(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_4 - static_assert(_TEST_PWM(E4_AUTO_FAN_PIN), "E4" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_5 - static_assert(_TEST_PWM(E5_AUTO_FAN_PIN), "E5" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_6 - static_assert(_TEST_PWM(E6_AUTO_FAN_PIN), "E6" AF_ERR_SUFF); - #elif HAS_AUTO_FAN_7 - static_assert(_TEST_PWM(E7_AUTO_FAN_PIN), "E7" AF_ERR_SUFF); - #endif + #define AF_ASSERT(N) OPTCODE(HAS_AUTO_FAN_##N, static_assert(_TEST_PWM(E##N##_AUTO_FAN_PIN), "E" STRINGIFY(N) "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255.")) + REPEAT(8, AF_ASSERT) + #undef AF_ASSERT #endif /** @@ -3058,14 +3119,13 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS /** * Make sure features that need to write to the SD card can */ -#if ENABLED(SDCARD_READONLY) && ANY(POWER_LOSS_RECOVERY, BINARY_FILE_TRANSFER, SDCARD_EEPROM_EMULATION) - #undef SDCARD_READONLY +#if ENABLED(SDCARD_READONLY) #if ENABLED(POWER_LOSS_RECOVERY) - #warning "Either disable SDCARD_READONLY or disable POWER_LOSS_RECOVERY." + #error "Either disable SDCARD_READONLY or disable POWER_LOSS_RECOVERY." #elif ENABLED(BINARY_FILE_TRANSFER) - #warning "Either disable SDCARD_READONLY or disable BINARY_FILE_TRANSFER." + #error "Either disable SDCARD_READONLY or disable BINARY_FILE_TRANSFER." #elif ENABLED(SDCARD_EEPROM_EMULATION) - #warning "Either disable SDCARD_READONLY or disable SDCARD_EEPROM_EMULATION." + #error "Either disable SDCARD_READONLY or disable SDCARD_EEPROM_EMULATION." #endif #endif @@ -3091,7 +3151,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS + (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \ + (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \ + (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \ - + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \ + + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35, ANYCUBIC_LCD_VYPER) \ + DGUS_UI_IS(ORIGIN) + DGUS_UI_IS(FYSETC) + DGUS_UI_IS(HIPRECY) + DGUS_UI_IS(MKS) + DGUS_UI_IS(RELOADED) + DGUS_UI_IS(IA_CREALITY) \ + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \ + COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \ @@ -3205,6 +3265,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #endif #endif +#if ENABLED(ANYCUBIC_LCD_VYPER) + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_2), "zh_CN") == 0, "LCD_LANGUAGE_2 must be set to zh_CN for ANYCUBIC_LCD_VYPER."); +#endif + #if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) && SD_CONNECTION_IS(LCD) #error "SDCARD_CONNECTION cannot be set to LCD for the enabled TFT. No available SD card reader." #endif @@ -3304,8 +3368,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #else #if HAS_DGUS_LCD #error "The DGUS LCD requires LCD_SERIAL_PORT to be defined." - #elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON) - #error "The ANYCUBIC LCD requires LCD_SERIAL_PORT to be defined." + #elif ANY(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER) + #error "ANYCUBIC_LCD_* requires LCD_SERIAL_PORT to be defined." #elif ENABLED(MALYAN_LCD) #error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined." #elif ENABLED(NEXTION_LCD) @@ -3400,17 +3464,17 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "TMC2208 or TMC2209 on E6 requires E6_HARDWARE_SERIAL or E6_SERIAL_(RX|TX)_PIN." #elif INVALID_TMC_UART(E7) #error "TMC2208 or TMC2209 on E7 requires E7_HARDWARE_SERIAL or E7_SERIAL_(RX|TX)_PIN." -#elif HAS_I_AXIS && INVALID_TMC_UART(I) +#elif INVALID_TMC_UART(I) #error "TMC2208 or TMC2209 on I requires I_HARDWARE_SERIAL or I_SERIAL_(RX|TX)_PIN." -#elif HAS_J_AXIS && INVALID_TMC_UART(J) +#elif INVALID_TMC_UART(J) #error "TMC2208 or TMC2209 on J requires J_HARDWARE_SERIAL or J_SERIAL_(RX|TX)_PIN." -#elif HAS_K_AXIS && INVALID_TMC_UART(K) +#elif INVALID_TMC_UART(K) #error "TMC2208 or TMC2209 on K requires K_HARDWARE_SERIAL or K_SERIAL_(RX|TX)_PIN." -#elif HAS_U_AXIS && INVALID_TMC_UART(U) +#elif INVALID_TMC_UART(U) #error "TMC2208 or TMC2209 on U requires U_HARDWARE_SERIAL or U_SERIAL_(RX|TX)_PIN." -#elif HAS_V_AXIS && INVALID_TMC_UART(V) +#elif INVALID_TMC_UART(V) #error "TMC2208 or TMC2209 on V requires V_HARDWARE_SERIAL or V_SERIAL_(RX|TX)_PIN." -#elif HAS_W_AXIS && INVALID_TMC_UART(W) +#elif INVALID_TMC_UART(W) #error "TMC2208 or TMC2209 on W requires W_HARDWARE_SERIAL or W_SERIAL_(RX|TX)_PIN." #endif @@ -3503,17 +3567,17 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS INVALID_TMC_MS(E6) #elif !TMC_MICROSTEP_IS_VALID(E7) INVALID_TMC_MS(E7) -#elif HAS_I_AXIS && !TMC_MICROSTEP_IS_VALID(I) +#elif !TMC_MICROSTEP_IS_VALID(I) INVALID_TMC_MS(I) -#elif HAS_J_AXIS && !TMC_MICROSTEP_IS_VALID(J) +#elif !TMC_MICROSTEP_IS_VALID(J) INVALID_TMC_MS(J) -#elif HAS_K_AXIS && !TMC_MICROSTEP_IS_VALID(K) +#elif !TMC_MICROSTEP_IS_VALID(K) INVALID_TMC_MS(K) -#elif HAS_U_AXIS && !TMC_MICROSTEP_IS_VALID(U) +#elif !TMC_MICROSTEP_IS_VALID(U) INVALID_TMC_MS(U) -#elif HAS_V_AXIS && !TMC_MICROSTEP_IS_VALID(V) +#elif !TMC_MICROSTEP_IS_VALID(V) INVALID_TMC_MS(V) -#elif HAS_W_AXIS && !TMC_MICROSTEP_IS_VALID(W) +#elif !TMC_MICROSTEP_IS_VALID(W) INVALID_TMC_MS(W) #endif #undef INVALID_TMC_MS @@ -3530,67 +3594,43 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS // towers to +Z and the individual homing of each tower. This restriction can be removed once a means of // clearing the stallGuard activated status is found. - // Stall detection DIAG = HIGH : TMC2209 - // Stall detection DIAG = LOW : TMC2130/TMC2160/TMC2660/TMC5130/TMC5160 - #define X_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(X,TMC2209) - #define Y_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Y,TMC2209) - #define Z_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Z,TMC2209) - #if HAS_I_AXIS - #define I_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(I,TMC2209) - #endif - #if HAS_J_AXIS - #define J_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(J,TMC2209) - #endif - #if HAS_K_AXIS - #define K_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(K,TMC2209) - #endif - #if HAS_U_AXIS - #define U_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(U,TMC2209) - #endif - #if HAS_V_AXIS - #define V_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(V,TMC2209) - #endif - #if HAS_W_AXIS - #define W_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(W,TMC2209) - #endif - #if NONE(SPI_ENDSTOPS, ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS) #if X_SENSORLESS && X_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_XMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) when homing to X_MIN." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) for X_MIN homing." #elif X_SENSORLESS && X_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_XMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) when homing to X_MAX." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) for X_MAX homing." #elif Y_SENSORLESS && Y_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_YMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) when homing to Y_MIN." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) for Y_MIN homing." #elif Y_SENSORLESS && Y_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_YMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) when homing to Y_MAX." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) for Y_MAX homing." #elif Z_SENSORLESS && Z_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_ZMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) when homing to Z_MIN." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) for Z_MIN homing." #elif Z_SENSORLESS && Z_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_ZMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) when homing to Z_MAX." - #elif ALL(HAS_I_AXIS, I_SENSORLESS, I_HOME_TO_MIN) && DISABLED(ENDSTOPPULLUP_IMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMIN (or ENDSTOPPULLUPS) when homing to I_MIN." - #elif ALL(HAS_I_AXIS, I_SENSORLESS, I_HOME_TO_MAX) && DISABLED(ENDSTOPPULLUP_IMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMAX (or ENDSTOPPULLUPS) when homing to I_MAX." - #elif ALL(HAS_J_AXIS, J_SENSORLESS, J_HOME_TO_MIN) && DISABLED(ENDSTOPPULLUP_JMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMIN (or ENDSTOPPULLUPS) when homing to J_MIN." - #elif ALL(HAS_J_AXIS, J_SENSORLESS, J_HOME_TO_MAX) && DISABLED(ENDSTOPPULLUP_JMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMAX (or ENDSTOPPULLUPS) when homing to J_MAX." - #elif ALL(HAS_K_AXIS, K_SENSORLESS, K_HOME_TO_MIN) && DISABLED(ENDSTOPPULLUP_KMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMIN (or ENDSTOPPULLUPS) when homing to K_MIN." - #elif ALL(HAS_K_AXIS, K_SENSORLESS, K_HOME_TO_MAX) && DISABLED(ENDSTOPPULLUP_KMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMAX (or ENDSTOPPULLUPS) when homing to K_MAX." - #elif HAS_U_AXIS && U_SENSORLESS && U_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_UMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMIN (or ENDSTOPPULLUPS) when homing to U_MIN." - #elif HAS_U_AXIS && U_SENSORLESS && U_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_UMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMAX (or ENDSTOPPULLUPS) when homing to U_MAX." - #elif HAS_V_AXIS && V_SENSORLESS && V_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_VMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMIN (or ENDSTOPPULLUPS) when homing to V_MIN." - #elif HAS_V_AXIS && V_SENSORLESS && V_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_VMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMAX (or ENDSTOPPULLUPS) when homing to V_MAX." - #elif HAS_W_AXIS && W_SENSORLESS && W_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_WMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMIN (or ENDSTOPPULLUPS) when homing to W_MIN." - #elif HAS_W_AXIS && W_SENSORLESS && W_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_WMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMAX (or ENDSTOPPULLUPS) when homing to W_MAX." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) for Z_MAX homing." + #elif I_SENSORLESS && I_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_IMIN) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMIN (or ENDSTOPPULLUPS) for I_MIN homing." + #elif I_SENSORLESS && I_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_IMAX) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMAX (or ENDSTOPPULLUPS) for I_MAX homing." + #elif J_SENSORLESS && J_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_JMIN) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMIN (or ENDSTOPPULLUPS) for J_MIN homing." + #elif J_SENSORLESS && J_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_JMAX) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMAX (or ENDSTOPPULLUPS) for J_MAX homing." + #elif K_SENSORLESS && K_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_KMIN) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMIN (or ENDSTOPPULLUPS) for K_MIN homing." + #elif K_SENSORLESS && K_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_KMAX) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMAX (or ENDSTOPPULLUPS) for K_MAX homing." + #elif U_SENSORLESS && U_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_UMIN) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMIN (or ENDSTOPPULLUPS) for U_MIN homing." + #elif U_SENSORLESS && U_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_UMAX) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMAX (or ENDSTOPPULLUPS) for U_MAX homing." + #elif V_SENSORLESS && V_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_VMIN) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMIN (or ENDSTOPPULLUPS) for V_MIN homing." + #elif V_SENSORLESS && V_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_VMAX) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMAX (or ENDSTOPPULLUPS) for V_MAX homing." + #elif W_SENSORLESS && W_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_WMIN) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMIN (or ENDSTOPPULLUPS) for W_MIN homing." + #elif W_SENSORLESS && W_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_WMAX) + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMAX (or ENDSTOPPULLUPS) for W_MAX homing." #endif #endif @@ -3599,117 +3639,172 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #if ENABLED(QUICK_HOME) #warning "SPI_ENDSTOPS may be unreliable with QUICK_HOME. Adjust back-offs for better results." #endif - #else - #if X_SENSORLESS && X_HOME_TO_MIN && X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING - #if X_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = true when homing to X_MIN." - #else - #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to X_MIN." - #endif - #elif X_SENSORLESS && X_HOME_TO_MAX && X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING - #if X_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = true when homing to X_MAX." - #else - #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to X_MAX." - #endif - #elif Y_SENSORLESS && Y_HOME_TO_MIN && Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING - #if Y_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = true when homing to Y_MIN." - #else - #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MIN." - #endif - #elif Y_SENSORLESS && Y_HOME_TO_MAX && Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING - #if Y_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = true when homing to Y_MAX." - #else - #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MAX." - #endif - #elif Z_SENSORLESS && Z_HOME_TO_MIN && Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING - #if Z_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = true when homing to Z_MIN." - #else - #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MIN." - #endif - #elif Z_SENSORLESS && Z_HOME_TO_MAX && Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING - #if Z_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = true when homing to Z_MAX." - #else - #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MAX." - #endif - #elif ALL(HAS_I_AXIS, I_SENSORLESS, I_HOME_TO_MIN) && I_MIN_ENDSTOP_INVERTING != I_ENDSTOP_INVERTING - #if I_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_INVERTING = true when homing to I_MIN." - #else - #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to I_MIN." - #endif - #elif ALL(HAS_I_AXIS, I_SENSORLESS, I_HOME_TO_MAX) && I_MAX_ENDSTOP_INVERTING != I_ENDSTOP_INVERTING - #if I_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires I_MAX_ENDSTOP_INVERTING = true when homing to I_MAX." - #else - #error "SENSORLESS_HOMING requires I_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to I_MAX." - #endif - #elif ALL(HAS_J_AXIS, J_SENSORLESS, J_HOME_TO_MIN) && J_MIN_ENDSTOP_INVERTING != J_ENDSTOP_INVERTING - #if J_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_INVERTING = true when homing to J_MIN." - #else - #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to J_MIN." - #endif - #elif ALL(HAS_J_AXIS, J_SENSORLESS, J_HOME_TO_MAX) && J_MAX_ENDSTOP_INVERTING != J_ENDSTOP_INVERTING - #if J_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires J_MAX_ENDSTOP_INVERTING = true when homing to J_MAX." - #else - #error "SENSORLESS_HOMING requires J_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to J_MAX." + #else // !SPI_ENDSTOPS + // Stall detection DIAG = HIGH : TMC2209 + // Stall detection DIAG = LOW : TMC2130/TMC2160/TMC2660/TMC5130/TMC5160 + #if X_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(X,TMC2209) + #if X_HOME_TO_MIN && X_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_HIT_STATE HIGH for X_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_HIT_STATE LOW for X_MIN homing." + #endif + #elif X_HOME_TO_MAX && X_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_HIT_STATE HIGH for X_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_HIT_STATE LOW for X_MAX homing." + #endif #endif - #elif ALL(HAS_K_AXIS, K_SENSORLESS, K_HOME_TO_MIN) && K_MIN_ENDSTOP_INVERTING != K_ENDSTOP_INVERTING - #if K_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_INVERTING = true when homing to K_MIN." - #else - #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to K_MIN." + #undef _HIT_STATE + #endif + + #if Y_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(Y,TMC2209) + #if Y_HOME_TO_MIN && Y_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_HIT_STATE HIGH for Y_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_HIT_STATE LOW for Y_MIN homing." + #endif + #elif Y_HOME_TO_MAX && Y_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires Y_MAY_ENDSTOP_HIT_STATE HIGH for Y_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires Y_MAY_ENDSTOP_HIT_STATE LOW for Y_MAX homing." + #endif #endif - #elif ALL(HAS_K_AXIS, K_SENSORLESS, K_HOME_TO_MAX) && K_MAX_ENDSTOP_INVERTING != K_ENDSTOP_INVERTING - #if K_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires K_MAX_ENDSTOP_INVERTING = true when homing to K_MAX." - #else - #error "SENSORLESS_HOMING requires K_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to K_MAX." + #undef _HIT_STATE + #endif + + #if Z_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(Z,TMC2209) + #if Z_HOME_TO_MIN && Z_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_HIT_STATE HIGH for Z_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_HIT_STATE LOW for Z_MIN homing." + #endif + #elif Z_HOME_TO_MAX && Z_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires Z_MAZ_ENDSTOP_HIT_STATE HIGH for Z_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires Z_MAZ_ENDSTOP_HIT_STATE LOW for Z_MAX homing." + #endif #endif - #elif ALL(HAS_U_AXIS, U_SENSORLESS, U_HOME_TO_MIN) && U_MIN_ENDSTOP_INVERTING != U_ENDSTOP_INVERTING - #if U_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_INVERTING = true when homing to U_MIN." - #else - #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to U_MIN." + #undef _HIT_STATE + #endif + + #if I_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(I,TMC2209) + #if I_HOME_TO_MIN && I_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_HIT_STATE HIGH for I_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_HIT_STATE LOW for I_MIN homing." + #endif + #elif I_HOME_TO_MAX && I_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires I_MAI_ENDSTOP_HIT_STATE HIGH for I_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires I_MAI_ENDSTOP_HIT_STATE LOW for I_MAX homing." + #endif #endif - #elif ALL(HAS_U_AXIS, U_SENSORLESS, U_HOME_TO_MAX) && U_MAX_ENDSTOP_INVERTING != U_ENDSTOP_INVERTING - #if U_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires U_MAX_ENDSTOP_INVERTING = true when homing to U_MAX." - #else - #error "SENSORLESS_HOMING requires U_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to U_MAX." + #undef _HIT_STATE + #endif + + #if J_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(J,TMC2209) + #if J_HOME_TO_MIN && J_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_HIT_STATE HIGH for J_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_HIT_STATE LOW for J_MIN homing." + #endif + #elif J_HOME_TO_MAX && J_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires J_MAJ_ENDSTOP_HIT_STATE HIGH for J_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires J_MAJ_ENDSTOP_HIT_STATE LOW for J_MAX homing." + #endif #endif - #elif ALL(HAS_V_AXIS, V_SENSORLESS, V_HOME_TO_MIN) && V_MIN_ENDSTOP_INVERTING != V_ENDSTOP_INVERTING - #if V_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_INVERTING = true when homing to V_MIN." - #else - #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to V_MIN." + #undef _HIT_STATE + #endif + + #if K_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(K,TMC2209) + #if K_HOME_TO_MIN && K_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_HIT_STATE HIGH for K_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_HIT_STATE LOW for K_MIN homing." + #endif + #elif K_HOME_TO_MAX && K_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires K_MAK_ENDSTOP_HIT_STATE HIGH for K_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires K_MAK_ENDSTOP_HIT_STATE LOW for K_MAX homing." + #endif #endif - #elif ALL(HAS_V_AXIS, V_SENSORLESS, V_HOME_TO_MAX) && V_MAX_ENDSTOP_INVERTING != V_ENDSTOP_INVERTING - #if V_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires V_MAX_ENDSTOP_INVERTING = true when homing to V_MAX." - #else - #error "SENSORLESS_HOMING requires V_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to V_MAX." + #undef _HIT_STATE + #endif + + #if U_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(U,TMC2209) + #if U_HOME_TO_MIN && U_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_HIT_STATE HIGH for U_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_HIT_STATE LOW for U_MIN homing." + #endif + #elif U_HOME_TO_MAX && U_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires U_MAU_ENDSTOP_HIT_STATE HIGH for U_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires U_MAU_ENDSTOP_HIT_STATE LOW for U_MAX homing." + #endif #endif - #elif ALL(HAS_W_AXIS, W_SENSORLESS, W_HOME_TO_MIN) && W_MIN_ENDSTOP_INVERTING != W_ENDSTOP_INVERTING - #if W_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_INVERTING = true when homing to W_MIN." - #else - #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to W_MIN." + #undef _HIT_STATE + #endif + + #if V_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(V,TMC2209) + #if V_HOME_TO_MIN && V_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_HIT_STATE HIGH for V_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_HIT_STATE LOW for V_MIN homing." + #endif + #elif V_HOME_TO_MAX && V_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires V_MAV_ENDSTOP_HIT_STATE HIGH for V_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires V_MAV_ENDSTOP_HIT_STATE LOW for V_MAX homing." + #endif #endif - #elif ALL(HAS_W_AXIS, W_SENSORLESS, W_HOME_TO_MAX0) && W_MAX_ENDSTOP_INVERTING != W_ENDSTOP_INVERTING - #if W_ENDSTOP_INVERTING - #error "SENSORLESS_HOMING requires W_MAX_ENDSTOP_INVERTING = true when homing to W_MAX." - #else - #error "SENSORLESS_HOMING requires W_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to W_MAX." + #undef _HIT_STATE + #endif + + #if W_SENSORLESS + #define _HIT_STATE AXIS_DRIVER_TYPE(W,TMC2209) + #if W_HOME_TO_MIN && W_MIN_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_HIT_STATE HIGH for W_MIN homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_HIT_STATE LOW for W_MIN homing." + #endif + #elif W_HOME_TO_MAX && W_MAX_ENDSTOP_HIT_STATE != _HIT_STATE + #if _HIT_STATE + #error "SENSORLESS_HOMING requires W_MAW_ENDSTOP_HIT_STATE HIGH for W_MAX homing with TMC2209." + #else + #error "SENSORLESS_HOMING requires W_MAW_ENDSTOP_HIT_STATE LOW for W_MAX homing." + #endif #endif + #undef _HIT_STATE #endif - #endif + + #endif // !SPI_ENDSTOPS #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z) #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z." @@ -3719,15 +3814,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, Z, I, J, K, U, V, or W axes." #endif - #undef X_ENDSTOP_INVERTING - #undef Y_ENDSTOP_INVERTING - #undef Z_ENDSTOP_INVERTING - #undef I_ENDSTOP_INVERTING - #undef J_ENDSTOP_INVERTING - #undef K_ENDSTOP_INVERTING - #undef U_ENDSTOP_INVERTING - #undef V_ENDSTOP_INVERTING - #undef W_ENDSTOP_INVERTING #endif // Sensorless probing requirements @@ -4144,11 +4230,11 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #elif !(defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP)) #error "SPINDLE_LASER_USE_PWM equation constant(s) missing." #elif _PIN_CONFLICT(X_MIN) - #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MIN_PIN." + #error "SPINDLE_LASER_PWM_PIN conflicts with X_MIN_PIN." #elif _PIN_CONFLICT(X_MAX) - #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MAX_PIN." + #error "SPINDLE_LASER_PWM_PIN conflicts with X_MAX_PIN." #elif _PIN_CONFLICT(Z_STEP) - #error "SPINDLE_LASER_USE_PWM pin conflicts with Z_STEP_PIN." + #error "SPINDLE_LASER_PWM_PIN conflicts with Z_STEP_PIN." #elif _PIN_CONFLICT(CASE_LIGHT) #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN." #elif _PIN_CONFLICT(E0_AUTO_FAN) @@ -4168,7 +4254,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #elif _PIN_CONFLICT(E7_AUTO_FAN) #error "SPINDLE_LASER_PWM_PIN conflicts with E7_AUTO_FAN_PIN." #elif _PIN_CONFLICT(FAN) - #error "SPINDLE_LASER_PWM_PIN conflicts with FAN_PIN." + #error "SPINDLE_LASER_PWM_PIN conflicts with FAN0_PIN." #elif _PIN_CONFLICT(FAN1) #error "SPINDLE_LASER_PWM_PIN conflicts with FAN1_PIN." #elif _PIN_CONFLICT(FAN2) @@ -4196,7 +4282,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #undef _PIN_CONFLICT #ifdef LASER_SAFETY_TIMEOUT_MS - static_assert(LASER_SAFETY_TIMEOUT_MS < (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL, "LASER_SAFETY_TIMEOUT_MS must be less than DEFAULT_STEPPER_DEACTIVE_TIME (" STRINGIFY(DEFAULT_STEPPER_DEACTIVE_TIME) " seconds)"); + static_assert(LASER_SAFETY_TIMEOUT_MS < (DEFAULT_STEPPER_TIMEOUT_SEC) * 1000UL, "LASER_SAFETY_TIMEOUT_MS must be less than DEFAULT_STEPPER_TIMEOUT_SEC (" STRINGIFY(DEFAULT_STEPPER_TIMEOUT_SEC) " seconds)"); #endif #endif @@ -4227,16 +4313,20 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); /** * Touch Screen Calibration */ -#if !MB(LINUX_RAMPS) && ENABLED(TFT_TOUCH_DEVICE_XPT2046) && DISABLED(TOUCH_SCREEN_CALIBRATION) \ +#if !MB(SIMULATED) && ENABLED(TFT_TOUCH_DEVICE_XPT2046) && DISABLED(TOUCH_SCREEN_CALIBRATION) \ && !(defined(TOUCH_CALIBRATION_X) && defined(TOUCH_CALIBRATION_Y) && defined(TOUCH_OFFSET_X) && defined(TOUCH_OFFSET_Y)) #error "TOUCH_CALIBRATION_[XY] and TOUCH_OFFSET_[XY] are required for resistive touch screens with TOUCH_SCREEN_CALIBRATION disabled." #endif /** - * Sanity check for WIFI + * Sanity check WiFi options */ -#if EITHER(ESP3D_WIFISUPPORT, WIFISUPPORT) && DISABLED(ARDUINO_ARCH_ESP32) - #error "ESP3D_WIFISUPPORT or WIFISUPPORT requires an ESP32 MOTHERBOARD." +#if ENABLED(ESP3D_WIFISUPPORT) && DISABLED(ARDUINO_ARCH_ESP32) + #error "ESP3D_WIFISUPPORT requires an ESP32 MOTHERBOARD." +#elif ENABLED(WEBSUPPORT) && NONE(ARDUINO_ARCH_ESP32, WIFISUPPORT) + #error "WEBSUPPORT requires WIFISUPPORT and an ESP32 MOTHERBOARD." +#elif BOTH(ESP3D_WIFISUPPORT, WIFISUPPORT) + #error "Enable only one of ESP3D_WIFISUPPORT or WIFISUPPORT." #endif /** @@ -4382,6 +4472,8 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "DGUS_LCD_UI RELOADED requires BABYSTEP_ALWAYS_AVAILABLE." #elif DISABLED(BABYSTEP_ZPROBE_OFFSET) #error "DGUS_LCD_UI RELOADED requires BABYSTEP_ZPROBE_OFFSET." + #elif ENABLED(HOME_AFTER_DEACTIVATE) + #error "DGUS_LCD_UI RELOADED requires HOME_AFTER_DEACTIVATE to be disabled." #elif ENABLED(AUTO_BED_LEVELING_UBL) && DISABLED(UBL_SAVE_ACTIVE_ON_M500) #warning "Without UBL_SAVE_ACTIVE_ON_M500, your mesh will not be saved when using the touchscreen." #endif @@ -4421,7 +4513,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); /** * Input Shaping requirements */ -#if HAS_SHAPING +#if HAS_ZV_SHAPING #if ENABLED(DELTA) #error "Input Shaping is not compatible with DELTA kinematics." #elif ENABLED(SCARA) @@ -4471,6 +4563,9 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif #endif +// Multi-Stepping Limit +static_assert(WITHIN(MULTISTEPPING_LIMIT, 1, 128) && IS_POWER_OF_2(MULTISTEPPING_LIMIT), "MULTISTEPPING_LIMIT must be 1, 2, 4, 8, 16, 32, 64, or 128."); + // Misc. Cleanup #undef _TEST_PWM #undef _NUM_AXES_STR diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 0b60d5926131..2140a73690fb 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 "2023-02-27" + #define STRING_DISTRIBUTION_DATE "2023-04-01" #endif /** diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 1d1426936f95..82aadf7d77b1 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -715,7 +715,7 @@ #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.)" #endif -#if PRINTCOUNTER_SYNC +#if ENABLED(PRINTCOUNTER_SYNC) #warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save." #endif @@ -777,6 +777,13 @@ #warning "Define MK3_FAN_PINS to swap hotend and part cooling fan pins. (Define NO_MK3_FAN_PINS_WARNING to suppress this warning.)" #endif +/** + * GD32 is not exactly like STM32 + */ +#if MB(SOVOL_V131, TRIGORILLA_V006) + #warning "GD32 based controllers may not be fully compatible with STM32 platforms. Please report any issues." +#endif + /** * BD Sensor should always include BABYSTEPPING */ @@ -794,6 +801,17 @@ /** * Input Shaping */ -#if HAS_SHAPING && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) +#if HAS_ZV_SHAPING && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) #warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental." #endif + +#if MULTISTEPPING_LIMIT_WARNING + #warning "MULTISTEPPING_LIMIT has been automatically set to 128. Use a lower value if the machine is slow to respond." +#endif + +#if SDSORT_CACHE_VFATS_WARNING + #warning "SDSORT_CACHE_VFATS has been reduced to VFAT_ENTRIES_LIMIT." +#endif +#if SDSORT_CACHE_LPC1768_WARNING + #warning "SDCARD_SORT_ALPHA sub-options overridden for LPC1768 with DOGM LCD SCK overlap." +#endif diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 9093fa3eab9e..416c07c8f72b 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -521,7 +521,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const else if (axis_should_home(axis)) while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?'); else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis)) - lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" ")); + lcd_put_u8str(TERN0(HAS_Z_AXIS, axis == Z_AXIS) ? F(" ") : F(" ")); else lcd_put_u8str(value); } @@ -998,11 +998,12 @@ void MarlinUI::draw_status_screen() { #endif // LCD_WIDTH >= 20 - lcd_moveto(LCD_WIDTH - 8, 1); - _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink); - - #if HAS_LEVELING && !HAS_HEATED_BED - lcd_put_lchar(planner.leveling_active || blink ? '_' : ' '); + #if HAS_Z_AXIS + lcd_moveto(LCD_WIDTH - 8, 1); + _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink); + #if HAS_LEVELING && !HAS_HEATED_BED + lcd_put_lchar(planner.leveling_active || blink ? '_' : ' '); + #endif #endif #endif // LCD_HEIGHT > 2 diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_fr_na.h b/Marlin/src/lcd/dogm/fontdata/langdata_fr_na.h new file mode 100644 index 000000000000..218f042a20e8 --- /dev/null +++ b/Marlin/src/lcd/dogm/fontdata/langdata_fr_na.h @@ -0,0 +1,10 @@ +/** + * Generated automatically by buildroot/share/fonts/uxggenpages.sh + * Contents will be REPLACED by future processing! + * Use genallfont.sh to generate font data for updated languages. + */ +#pragma once + +#include "langdata.h" + +static const uxg_fontinfo_t g_fontinfo_fr_na[] PROGMEM = {}; diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_hu.h b/Marlin/src/lcd/dogm/fontdata/langdata_hu.h index 450662a8c9d1..c0175be874ee 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_hu.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_hu.h @@ -7,10 +7,4 @@ #include "langdata.h" -const u8g_fntpgm_uint8_t fontpage_2_241_241[31] U8G_FONT_SECTION("fontpage_2_241_241") = { - 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xF1,0xF1,0x00,0x08,0x00,0x00, - 0x00,0x05,0x08,0x08,0x06,0x00,0x00,0x48,0x90,0x00,0x88,0x88,0x88,0x88,0x70}; - -static const uxg_fontinfo_t g_fontinfo_hu[] PROGMEM = { - FONTDATA_ITEM(2, 241, 241, fontpage_2_241_241), // 'ű' -- 'ű' -}; +static const uxg_fontinfo_t g_fontinfo_hu[] PROGMEM = {}; diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_pl.h b/Marlin/src/lcd/dogm/fontdata/langdata_pl.h index e89a6c159a4e..e9365a69c23c 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_pl.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_pl.h @@ -27,6 +27,9 @@ const u8g_fntpgm_uint8_t fontpage_2_218_219[47] U8G_FONT_SECTION("fontpage_2_218 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xDA,0xDB,0x00,0x0A,0x00,0x00, 0x00,0x05,0x0A,0x0A,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x80,0x70,0x08,0x88, 0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x78,0x80,0x70,0x08,0xF0}; +const u8g_fntpgm_uint8_t fontpage_2_250_250[31] U8G_FONT_SECTION("fontpage_2_250_250") = { + 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xFA,0xFA,0x00,0x08,0x00,0x00, + 0x00,0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0xF8,0x10,0x20,0x40,0xF8}; const u8g_fntpgm_uint8_t fontpage_2_252_252[30] U8G_FONT_SECTION("fontpage_2_252_252") = { 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0x00,0x07,0x00,0x00, 0x00,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x00,0xF8,0x10,0x20,0x40,0xF8}; @@ -37,5 +40,6 @@ static const uxg_fontinfo_t g_fontinfo_pl[] PROGMEM = { FONTDATA_ITEM(2, 153, 153, fontpage_2_153_153), // 'ę' -- 'ę' FONTDATA_ITEM(2, 193, 196, fontpage_2_193_196), // 'Ł' -- 'ń' FONTDATA_ITEM(2, 218, 219, fontpage_2_218_219), // 'Ś' -- 'ś' + FONTDATA_ITEM(2, 250, 250, fontpage_2_250_250), // 'ź' -- 'ź' FONTDATA_ITEM(2, 252, 252, fontpage_2_252_252), // 'ż' -- 'ż' }; diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_sv.h b/Marlin/src/lcd/dogm/fontdata/langdata_sv.h new file mode 100644 index 000000000000..cf6328766e32 --- /dev/null +++ b/Marlin/src/lcd/dogm/fontdata/langdata_sv.h @@ -0,0 +1,10 @@ +/** + * Generated automatically by buildroot/share/fonts/uxggenpages.sh + * Contents will be REPLACED by future processing! + * Use genallfont.sh to generate font data for updated languages. + */ +#pragma once + +#include "langdata.h" + +static const uxg_fontinfo_t g_fontinfo_sv[] PROGMEM = {}; diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h b/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h index 664fa5f4bfe9..60316a147987 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h @@ -7,9 +7,6 @@ #include "langdata.h" -const u8g_fntpgm_uint8_t fontpage_64_157_157[26] U8G_FONT_SECTION("fontpage_64_157_157") = { - 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x9D,0x9D,0x00,0x07,0x00,0x00, - 0x00,0x05,0x03,0x03,0x06,0x00,0x04,0xD8,0x48,0x90}; const u8g_fntpgm_uint8_t fontpage_69_191_191[28] U8G_FONT_SECTION("fontpage_69_191_191") = { 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xBF,0xBF,0x00,0x05,0x00,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x08,0x18,0x28,0x48,0xF8}; @@ -382,10 +379,6 @@ const u8g_fntpgm_uint8_t fontpage_172_232_232[45] U8G_FONT_SECTION("fontpage_172 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xE8,0xE8,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x7B,0xC0,0x4A,0x40,0x4A,0x40,0x7B,0xC0,0x04, 0x80,0xFF,0xE0,0x11,0x00,0xFB,0xE0,0x4A,0x40,0x4A,0x40,0x7B,0xC0}; -const u8g_fntpgm_uint8_t fontpage_172_244_244[45] U8G_FONT_SECTION("fontpage_172_244_244") = { - 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xF4,0xF4,0x00,0x0A,0xFF,0x00, - 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x01,0x00,0xEF,0xE0,0xA5,0x40,0xAF,0xE0,0xA4, - 0x40,0xA7,0xC0,0xE4,0x40,0x07,0xC0,0x04,0x40,0x07,0xC0,0x0C,0x60}; const u8g_fntpgm_uint8_t fontpage_173_222_222[45] U8G_FONT_SECTION("fontpage_173_222_222") = { 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xDE,0xDE,0x00,0x0A,0xFF,0x00, 0x00,0x0A,0x0B,0x16,0x0C,0x01,0xFF,0xFF,0xC0,0x80,0x40,0x80,0x40,0x9E,0x40,0x92, @@ -744,10 +737,6 @@ const u8g_fntpgm_uint8_t fontpage_202_244_244[45] U8G_FONT_SECTION("fontpage_202 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xF4,0xF4,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x11,0x00,0xFF,0xE0,0x55,0x40,0x7C,0x80,0x39, 0x40,0x56,0x20,0x7F,0xC0,0x04,0x00,0x27,0x80,0x24,0x00,0xFF,0xE0}; -const u8g_fntpgm_uint8_t fontpage_203_135_135[45] U8G_FONT_SECTION("fontpage_203_135_135") = { - 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x87,0x87,0x00,0x0A,0xFF,0x00, - 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x08,0x00,0x04,0x00,0xFF,0xE0,0x11,0x00,0x11, - 0x00,0x11,0x00,0x0A,0x00,0x0A,0x00,0x04,0x00,0x1B,0x00,0xE0,0xE0}; const u8g_fntpgm_uint8_t fontpage_203_153_153[45] U8G_FONT_SECTION("fontpage_203_153_153") = { 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x99,0x99,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x20,0x80,0xAC,0x80,0x72,0x80,0x20,0x80,0xFC, @@ -1050,10 +1039,6 @@ const u8g_fntpgm_uint8_t fontpage_246_201_201[45] U8G_FONT_SECTION("fontpage_246 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xC9,0xC9,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x42,0x00,0x7B,0xE0,0x94,0x80,0x7F,0xC0,0x04, 0x00,0xFF,0xE0,0x01,0x00,0x7F,0xC0,0x11,0x00,0x09,0x00,0x03,0x00}; -const u8g_fntpgm_uint8_t fontpage_247_128_128[45] U8G_FONT_SECTION("fontpage_247_128_128") = { - 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x0A,0xFF,0x00, - 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x42,0x00,0x7B,0xE0,0x94,0x80,0x27,0xC0,0x50, - 0x40,0x4F,0x40,0x49,0x40,0x4F,0x40,0x49,0x40,0x4F,0x40,0x40,0xC0}; const u8g_fntpgm_uint8_t fontpage_247_177_177[45] U8G_FONT_SECTION("fontpage_247_177_177") = { 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xB1,0xB1,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x21,0x00,0x3D,0xE0,0x4A,0x80,0x94,0x40,0x7F, @@ -1465,7 +1450,6 @@ const u8g_fntpgm_uint8_t fontpage_510_154_154[30] U8G_FONT_SECTION("fontpage_510 0x00,0x02,0x07,0x07,0x0C,0x06,0x01,0xC0,0xC0,0x00,0x00,0x00,0xC0,0xC0}; static const uxg_fontinfo_t g_fontinfo_zh_CN[] PROGMEM = { - FONTDATA_ITEM(64, 157, 157, fontpage_64_157_157), // '”' -- '”' FONTDATA_ITEM(69, 191, 191, fontpage_69_191_191), // '⊿' -- '⊿' FONTDATA_ITEM(156, 128, 128, fontpage_156_128_128), // '一' -- '一' FONTDATA_ITEM(156, 137, 139, fontpage_156_137_139), // '三' -- '下' @@ -1553,7 +1537,6 @@ static const uxg_fontinfo_t g_fontinfo_zh_CN[] PROGMEM = { FONTDATA_ITEM(171, 183, 183, fontpage_171_183_183), // '喷' -- '喷' FONTDATA_ITEM(172, 180, 180, fontpage_172_180_180), // '嘴' -- '嘴' FONTDATA_ITEM(172, 232, 232, fontpage_172_232_232), // '器' -- '器' - FONTDATA_ITEM(172, 244, 244, fontpage_172_244_244), // '噴' -- '噴' FONTDATA_ITEM(173, 222, 222, fontpage_173_222_222), // '回' -- '回' FONTDATA_ITEM(173, 224, 224, fontpage_173_224_224), // '因' -- '因' FONTDATA_ITEM(173, 250, 250, fontpage_173_250_250), // '固' -- '固' @@ -1642,7 +1625,6 @@ static const uxg_fontinfo_t g_fontinfo_zh_CN[] PROGMEM = { FONTDATA_ITEM(202, 240, 240, fontpage_202_240_240), // '数' -- '数' FONTDATA_ITEM(202, 242, 242, fontpage_202_242_242), // '敲' -- '敲' FONTDATA_ITEM(202, 244, 244, fontpage_202_244_244), // '整' -- '整' - FONTDATA_ITEM(203, 135, 135, fontpage_203_135_135), // '文' -- '文' FONTDATA_ITEM(203, 153, 153, fontpage_203_153_153), // '料' -- '料' FONTDATA_ITEM(203, 156, 156, fontpage_203_156_156), // '斜' -- '斜' FONTDATA_ITEM(203, 173, 173, fontpage_203_173_173), // '断' -- '断' @@ -1718,7 +1700,6 @@ static const uxg_fontinfo_t g_fontinfo_zh_CN[] PROGMEM = { FONTDATA_ITEM(245, 239, 239, fontpage_245_239_239), // '端' -- '端' FONTDATA_ITEM(246, 172, 172, fontpage_246_172_172), // '第' -- '第' FONTDATA_ITEM(246, 201, 201, fontpage_246_201_201), // '等' -- '等' - FONTDATA_ITEM(247, 128, 128, fontpage_247_128_128), // '简' -- '简' FONTDATA_ITEM(247, 177, 177, fontpage_247_177_177), // '箱' -- '箱' FONTDATA_ITEM(248, 251, 251, fontpage_248_251_251), // '类' -- '类' FONTDATA_ITEM(250, 162, 162, fontpage_250_162_162), // '索' -- '索' diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h b/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h index 093629cd16fa..c132a0de706b 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h @@ -343,12 +343,10 @@ const u8g_fntpgm_uint8_t fontpage_178_167_167[45] U8G_FONT_SECTION("fontpage_178 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xA7,0xA7,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x04,0x00,0x04,0x00,0x04,0x00,0xFF,0xE0,0x04, 0x00,0x04,0x00,0x0A,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0xC0,0x60}; -const u8g_fntpgm_uint8_t fontpage_178_169_170[73] U8G_FONT_SECTION("fontpage_178_169_170") = { - 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xA9,0xAA,0x00,0x0A,0xFF,0x00, +const u8g_fntpgm_uint8_t fontpage_178_169_169[45] U8G_FONT_SECTION("fontpage_178_169_169") = { + 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xA9,0xA9,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0xFF, - 0xE0,0x04,0x00,0x0A,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0xC0,0x60,0x0B,0x0B,0x16, - 0x0C,0x00,0xFF,0x04,0x00,0x04,0x00,0x04,0x00,0xFF,0xE0,0x04,0x00,0x0A,0x00,0x0A, - 0x00,0x11,0x00,0x19,0x00,0x24,0x80,0xC4,0x60}; + 0xE0,0x04,0x00,0x0A,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0xC0,0x60}; const u8g_fntpgm_uint8_t fontpage_178_177_177[45] U8G_FONT_SECTION("fontpage_178_177_177") = { 0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xB1,0xB1,0x00,0x0A,0xFF,0x00, 0x00,0x0B,0x0B,0x16,0x0C,0x00,0xFF,0x24,0x00,0x24,0x00,0x3F,0xC0,0x44,0x00,0x04, @@ -1302,7 +1300,7 @@ static const uxg_fontinfo_t g_fontinfo_zh_TW[] PROGMEM = { FONTDATA_ITEM(178, 154, 154, fontpage_178_154_154), // '多' -- '多' FONTDATA_ITEM(178, 160, 160, fontpage_178_160_160), // '夠' -- '夠' FONTDATA_ITEM(178, 167, 167, fontpage_178_167_167), // '大' -- '大' - FONTDATA_ITEM(178, 169, 170, fontpage_178_169_170), // '天' -- '太' + FONTDATA_ITEM(178, 169, 169, fontpage_178_169_169), // '天' -- '天' FONTDATA_ITEM(178, 177, 177, fontpage_178_177_177), // '失' -- '失' FONTDATA_ITEM(179, 203, 203, fontpage_179_203_203), // '始' -- '始' FONTDATA_ITEM(181, 146, 146, fontpage_181_146_146), // '媒' -- '媒' diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 091c531abb92..22e71251ff13 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -96,9 +96,10 @@ DRAWBIT_HOTEND, DRAWBIT_BED = HOTENDS, DRAWBIT_CHAMBER, - DRAWBIT_CUTTER + DRAWBIT_CUTTER, + DRAWBIT_COUNT }; - IF<(DRAWBIT_CUTTER > 7), uint16_t, uint8_t>::type draw_bits; + bits_t(DRAWBIT_COUNT) draw_bits; #endif #if ANIM_HOTEND diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index f1bf9d032ec8..efc010ca8960 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -501,26 +501,26 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, void MarlinUI::touch_calibration_screen() { uint16_t x, y; - calibrationState calibration_stage = touch_calibration.get_calibration_state(); + calibrationState stage = touch_calibration.get_calibration_state(); - if (calibration_stage == CALIBRATION_NONE) { + if (stage == CALIBRATION_NONE) { // start and clear screen defer_status_screen(true); - calibration_stage = touch_calibration.calibration_start(); + stage = touch_calibration.calibration_start(); tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1); tftio.WriteMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT)); } else { // clear last cross - x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; - y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; + x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; + y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; drawCross(x, y, TFT_MARLINBG_COLOR); } FSTR_P str = nullptr; - if (calibration_stage < CALIBRATION_SUCCESS) { + if (stage < CALIBRATION_SUCCESS) { // handle current state - switch (calibration_stage) { + switch (stage) { case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break; case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break; case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break; @@ -528,13 +528,13 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, default: break; } - x = touch_calibration.calibration_points[calibration_stage].x; - y = touch_calibration.calibration_points[calibration_stage].y; + x = touch_calibration.calibration_points[stage].x; + y = touch_calibration.calibration_points[stage].y; drawCross(x, y, TFT_MARLINUI_COLOR); } else { // end calibration - str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED); + str = stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED); defer_status_screen(false); touch_calibration.calibration_end(); TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true); @@ -548,7 +548,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, } while (u8g.nextPage()); drawing_screen = false; safe_delay(250); - if (calibration_stage == CALIBRATION_SUCCESS) { + if (stage == CALIBRATION_SUCCESS) { safe_delay(500); ui.goto_previous_screen(); } diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 08d928684a6f..459b00ae1b1e 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -411,7 +411,7 @@ void Scroll_Menu(const uint8_t dir) { } inline uint16_t nr_sd_menu_items() { - return card.get_num_Files() + !card.flag.workDirIsRoot; + return card.get_num_items() + !card.flag.workDirIsRoot; } void Erase_Menu_Text(const uint8_t line) { @@ -1830,9 +1830,9 @@ void MarlinUI::refresh() { /* Nothing to see here */ } void Init_Shift_Name() { const bool is_subdir = !card.flag.workDirIsRoot; const int8_t filenum = select_file.now - 1 - is_subdir; // Skip "Back" and ".." - const uint16_t fileCnt = card.get_num_Files(); + const int16_t fileCnt = card.get_num_items(); if (WITHIN(filenum, 0, fileCnt - 1)) { - card.getfilename_sorted(SD_ORDER(filenum, fileCnt)); + card.selectFileByIndexSorted(filenum); char * const name = card.longest_filename(); make_name_without_ext(shift_name, name, 100); } @@ -1857,7 +1857,7 @@ void Draw_SDItem(const uint16_t item, int16_t row=-1) { return; } - card.getfilename_sorted(SD_ORDER(item - is_subdir, card.get_num_Files())); + card.selectFileByIndexSorted(item - is_subdir); char * const name = card.longest_filename(); #if ENABLED(SCROLL_LONG_FILENAMES) @@ -2223,7 +2223,7 @@ void HMI_SelectFile() { } else { const uint16_t filenum = select_file.now - 1 - hasUpDir; - card.getfilename_sorted(SD_ORDER(filenum, card.get_num_Files())); + card.selectFileByIndexSorted(filenum); // Enter that folder! if (card.flag.filenameIsDir) { diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 3f13fe8b3bdc..285723e27896 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -38,7 +38,6 @@ #include "../../../module/planner.h" #include "../../../module/settings.h" #include "../../../libs/buzzer.h" -#include "../../../inc/Conditionals_post.h" //#define DEBUG_OUT 1 #include "../../../core/debug_out.h" @@ -808,7 +807,7 @@ void CrealityDWINClass::Draw_SD_Item(uint8_t item, uint8_t row) { if (item == 0) Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? F("Back") : F("..")); else { - card.getfilename_sorted(SD_ORDER(item - 1, card.get_num_Files())); + card.selectFileByIndexSorted(item - 1); char * const filename = card.longest_filename(); size_t max = MENU_CHAR_LIMIT; size_t pos = strlen(filename), len = pos; @@ -832,7 +831,7 @@ void CrealityDWINClass::Draw_SD_List(bool removed/*=false*/) { scrollpos = 0; process = File; if (card.isMounted() && !removed) { - LOOP_L_N(i, _MIN(card.get_num_Files() + 1, TROWS)) + LOOP_L_N(i, _MIN(card.get_num_items() + 1, TROWS)) Draw_SD_Item(i, i); } else { @@ -3862,7 +3861,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Back, F("Cancel")); else { thermalManager.setTargetHotend(0, 0); - thermalManager.set_fan_speed(0, 0); + TERN_(HAS_FAN, thermalManager.set_fan_speed(0, 0)); Redraw_Menu(false, true, true); } break; @@ -4282,7 +4281,7 @@ void CrealityDWINClass::File_Control() { EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) { if (selection > 0) { - card.getfilename_sorted(SD_ORDER(selection - 1, card.get_num_Files())); + card.selectFileByIndexSorted(selection - 1); char * const filename = card.longest_filename(); size_t len = strlen(filename); size_t pos = len; @@ -4301,7 +4300,7 @@ void CrealityDWINClass::File_Control() { } return; } - if (encoder_diffState == ENCODER_DIFF_CW && selection < card.get_num_Files()) { + if (encoder_diffState == ENCODER_DIFF_CW && selection < card.get_num_items()) { DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); if (selection > 0) { DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); @@ -4341,7 +4340,7 @@ void CrealityDWINClass::File_Control() { } } else { - card.getfilename_sorted(SD_ORDER(selection - 1, card.get_num_Files())); + card.selectFileByIndexSorted(selection - 1); if (card.flag.filenameIsDir) { card.cd(card.filename); Draw_SD_List(); @@ -4474,7 +4473,7 @@ void CrealityDWINClass::Popup_Control() { case ETemp: if (selection == 0) { thermalManager.setTargetHotend(EXTRUDE_MINTEMP, 0); - thermalManager.set_fan_speed(0, MAX_FAN_SPEED); + TERN_(HAS_FAN, thermalManager.set_fan_speed(0, MAX_FAN_SPEED)); Draw_Menu(PreheatHotend); } else diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 12d16887d1e1..778bed633590 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -195,7 +195,7 @@ void MarlinUI::draw_status_message(const bool blink) { } const bool hash_changed = hash != old_hash; old_hash = hash; - return hash_changed || !ui.did_first_redraw; + return hash_changed || !did_first_redraw; }; #if ENABLED(STATUS_MESSAGE_SCROLLING) diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 205913ca694a..680173bd12f7 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -61,77 +61,60 @@ #define STATUS_CHR_WIDTH 14 #define STATUS_CHR_HEIGHT 28 +bool old_is_printing; + // // Before homing, blink '123' <-> '???'. // Homed but unknown... '123' <-> ' '. // Homed and known, display constantly. // -FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const uint16_t x, const uint16_t y) { - - #if ENABLED(DWIN_MARLINUI_PORTRAIT) - - uint8_t vallen = utf8_strlen(value); - if (!ui.did_first_redraw) { - dwin_string.set('X' + axis); - DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (vallen * 14 - 14) / 2, y + 2, S(dwin_string.string())); - } - - dwin_string.set(); - if (blink) - dwin_string.add(value); - else if (!TEST(axes_homed, axis)) - while (const char c = *value++) dwin_string.add(c <= '.' ? c : '?'); - else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !TEST(axes_trusted, axis)) - dwin_string.add(TERN1(DWIN_MARLINUI_PORTRAIT, axis == Z_AXIS) ? PSTR(" ") : PSTR(" ")); - else - dwin_string.add(value); - - // For E_TOTAL there may be some characters to cover up - if (BOTH(DWIN_MARLINUI_PORTRAIT, LCD_SHOW_E_TOTAL) && axis == X_AXIS) - dwin_string.add(F(" ")); - - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string())); - - #else // !DWIN_MARLINUI_PORTRAIT - - if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) { - dwin_string.set('X' + axis); - DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); - } - - dwin_string.set(); - if (blink) - dwin_string.add(value); - else { - if (!TEST(axes_homed, axis)) - while (const char c = *value++) dwin_string.add(c <= '.' ? c : '?'); - else { - #if NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) - if (!TEST(axes_trusted, axis)) - dwin_string.add(TERN1(DWIN_MARLINUI_PORTRAIT, axis == Z_AXIS) ? PSTR(" ") : PSTR(" ")); - else - #endif - dwin_string.add(value); - } - } - - // For E_TOTAL there may be some characters to cover up - if (ENABLED(LCD_SHOW_E_TOTAL) && (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) && axis == X_AXIS) - dwin_string.add(F(" ")); - - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string())); +void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const uint16_t x, const uint16_t y) { + const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning(); + if (x_redraw) { + dwin_string.set('X' + axis); + DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, + #if ENABLED(DWIN_MARLINUI_PORTRAIT) + x + (utf8_strlen(value) * 14 - 14) / 2, y + 2 + #else + x, y + #endif + , S(dwin_string.string()) + ); + } - #endif // !DWIN_MARLINUI_PORTRAIT + dwin_string.set(); + if (blink) + dwin_string.add(value); + else if (!TEST(axes_homed, axis)) + while (const char c = *value++) dwin_string.add(c <= '.' ? c : '?'); + else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !TEST(axes_trusted, axis)) + dwin_string.add(TERN1(DWIN_MARLINUI_PORTRAIT, axis == Z_AXIS) ? PSTR(" ") : PSTR(" ")); + else + dwin_string.add(value); + + // For E_TOTAL there may be some characters to cover up + if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS)) + dwin_string.add(F(" ")); + + DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, + #if ENABLED(DWIN_MARLINUI_PORTRAIT) + x, y + 32 + #else + x + 32, y + 4 + #endif + , S(dwin_string.string()) + ); } #if ENABLED(LCD_SHOW_E_TOTAL) - FORCE_INLINE void _draw_e_value(const_float_t value, const uint16_t x, const uint16_t y) { + void _draw_e_value(const_float_t value, const uint16_t x, const uint16_t y) { const uint8_t scale = value >= 100000.0f ? 10 : 1; // show cm after 99,999mm + const bool e_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning(); #if ENABLED(DWIN_MARLINUI_PORTRAIT) - if (!ui.did_first_redraw) { + if (e_redraw) { // Extra spaces to erase previous value dwin_string.set(F("E ")); DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string())); @@ -145,7 +128,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #else // !DWIN_MARLINUI_PORTRAIT - if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) { + if (e_redraw) { dwin_string.set(F("E ")); DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); } @@ -160,26 +143,27 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #endif // LCD_SHOW_E_TOTAL -// -// Fan Icon and Percentage -// -FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) { - const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2; - const uint8_t fan_pct = thermalManager.scaledFanSpeedPercent(0); - const bool fan_on = !!fan_pct; - if (fan_on) { - DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); - dwin_string.set(i8tostr3rj(fan_pct)); - dwin_string.add('%'); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); - } - else { - DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one) - DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y); - dwin_string.set(F(" ")); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); +#if HAS_FAN + // + // Fan Icon and Percentage + // + FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) { + const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2; + const bool fan_on = !!thermalManager.scaledFanSpeed(0); + if (fan_on) { + DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); + dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0))); + dwin_string.add('%'); + DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + } + else { + DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one) + DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y); + dwin_string.set(F(" ")); + DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + } } -} +#endif /** * Draw a single heater icon with current and target temperature, at the given XY @@ -207,72 +191,56 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x #endif #endif - #if HAS_HOTEND && HAS_HEATED_BED - float tc, tt; - bool c_draw, t_draw, i_draw, ta; - const bool isBed = heater < 0; - if (isBed) { + celsius_float_t tc = 0, tt = 0; + bool isBed = (DISABLED(HAS_HOTEND) && ENABLED(HAS_HEATED_BED)) || (BOTH(HAS_HOTEND, HAS_HEATED_BED) && heater < 0), + ta = false, c_draw, t_draw, i_draw; + c_draw = t_draw = i_draw = !ui.did_first_redraw; + if (isBed) { + #if HAS_HEATED_BED tc = thermalManager.degBed(); tt = thermalManager.degTargetBed(); ta = thermalManager.isHeatingBed(); - c_draw = tc != old_bed_temp; - t_draw = tt != old_bed_target; - i_draw = ta != old_bed_on; + c_draw |= tc != old_bed_temp; + t_draw |= tt != old_bed_target; + i_draw |= ta != old_bed_on; old_bed_temp = tc; old_bed_target = tt; old_bed_on = ta; - } - else { + #if HAS_LEVELING + i_draw |= planner.leveling_active != old_leveling_on; + old_leveling_on = planner.leveling_active; + #endif + #endif + } + else { + #if HAS_HOTEND tc = thermalManager.degHotend(heater); tt = thermalManager.degTargetHotend(heater); ta = thermalManager.isHeatingHotend(heater); - c_draw = tc != old_temp[heater]; - t_draw = tt != old_target[heater]; - i_draw = ta != old_on[heater]; + c_draw |= tc != old_temp[heater]; + t_draw |= tt != old_target[heater]; + i_draw |= ta != old_on[heater]; old_temp[heater] = tc; old_target[heater] = tt; old_on[heater] = ta; - } - #elif HAS_HOTEND - constexpr bool isBed = false; - const float tc = thermalManager.degHotend(heater), tt = thermalManager.degTargetHotend(heater); - const uint8_t ta = thermalManager.isHeatingHotend(heater); - bool c_draw = tc != old_temp[heater], t_draw = tt != old_target[heater], i_draw = ta != old_on[heater]; - old_temp[heater] = tc; old_target[heater] = tt; old_on[heater] = ta; - #elif HAS_HEATED_BED - constexpr bool isBed = true; - const float tc = thermalManager.degBed(), tt = thermalManager.degTargetBed(); - const uint8_t ta = thermalManager.isHeatingBed(); - bool c_draw = tc != old_bed_temp, t_draw = tt != old_bed_target, i_draw = ta != old_bed_on; - old_bed_temp = tc; old_bed_target = tt; old_bed_on = ta; - #else - bool c_draw = false, t_draw = false, i_draw = false; - constexpr float tc = 0, tt = 0; - constexpr uint8_t ta = 0; - #endif - - #if HAS_HEATED_BED && HAS_LEVELING - if (isBed) { - i_draw |= (planner.leveling_active != old_leveling_on); - old_leveling_on = planner.leveling_active; - } - #endif + #endif + } // Draw target temperature, if needed - if (!ui.did_first_redraw || t_draw) { + if (t_draw) { dwin_string.set(i16tostr3rj(tt + 0.5)); dwin_string.add(LCD_STR_DEGREE); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string())); } // Draw heater icon with on / off / leveled states - if (!ui.did_first_redraw || i_draw) { + if (i_draw) { const uint8_t ico = isBed ? (TERN0(HAS_LEVELING, planner.leveling_active) ? ICON_BedLevelOff : ICON_BedOff) : ICON_HotendOff; DWIN_ICON_Show(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2); } // Draw current temperature, if needed - if (!ui.did_first_redraw || c_draw) { + if (c_draw) { dwin_string.set(i16tostr3rj(tc + 0.5)); dwin_string.add(LCD_STR_DEGREE); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string())); @@ -334,7 +302,6 @@ void MarlinUI::draw_status_screen() { #if HAS_HEATED_BED _draw_heater_status(H_BED, hx, STATUS_HEATERS_Y); #endif - #if HAS_FAN _draw_fan_status(LCD_PIXEL_WIDTH - STATUS_CHR_WIDTH * 5, STATUS_FAN_Y); #endif @@ -414,7 +381,7 @@ void MarlinUI::draw_status_screen() { } DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string())); } - else if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) { + else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) { dwin_string.set(F(" ")); DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string())); } @@ -470,7 +437,7 @@ void MarlinUI::draw_status_screen() { draw_status_message(blink); ui.did_first_redraw = true; - ui.old_is_printing = print_job_timer.isRunning(); + old_is_printing = print_job_timer.isRunning(); } #endif // IS_DWIN_MARLINUI diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 6be56b0dedd2..adc6fca72aa6 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -266,7 +266,7 @@ MenuClass *MaxAccelMenu = nullptr; MenuClass *MaxJerkMenu = nullptr; #endif MenuClass *StepsMenu = nullptr; -#if ENABLED(MPCTEMP) +#if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) MenuClass *HotendMPCMenu = nullptr; #endif #if ENABLED(PIDTEMP) @@ -844,7 +844,7 @@ void SetMediaAutoMount() { } inline uint16_t nr_sd_menu_items() { - return _MIN(card.get_num_Files() + !card.flag.workDirIsRoot, MENU_MAX_ITEMS); + return _MIN(card.get_num_items() + !card.flag.workDirIsRoot, MENU_MAX_ITEMS); } void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { @@ -891,7 +891,7 @@ void onClickSDItem() { if (hasUpDir && CurrentMenu->selected == 1) return SDCard_Up(); else { const uint16_t filenum = CurrentMenu->selected - 1 - hasUpDir; - card.getfilename_sorted(SD_ORDER(filenum, card.get_num_Files())); + card.selectFileByIndexSorted(filenum); // Enter that folder! if (card.flag.filenameIsDir) return SDCard_Folder(card.filename); @@ -934,7 +934,7 @@ void onClickSDItem() { last_itemselected = selected; if (selected >= 1 + hasUpDir) { const int8_t filenum = selected - 1 - hasUpDir; // Skip "Back" and ".." - card.getfilename_sorted(SD_ORDER(filenum, card.get_num_Files())); + card.selectFileByIndexSorted(filenum); make_name_without_ext(shift_name, card.longest_filename(), LONG_FILENAME_LENGTH); shift_len = strlen(shift_name); shift_amt = 0; @@ -959,7 +959,7 @@ void onDrawFileName(MenuItemClass* menuitem, int8_t line) { } else { uint8_t icon; - card.getfilename_sorted(SD_ORDER(menuitem->pos - is_subdir - 1, card.get_num_Files())); + card.selectFileByIndexSorted(menuitem->pos - is_subdir - 1); make_name_without_ext(shift_name, card.longest_filename()); icon = card.flag.filenameIsDir ? ICON_Folder : card.fileIsBinary() ? ICON_Binary : ICON_File; Draw_Menu_Line(line, icon, shift_name); @@ -1480,46 +1480,59 @@ void DWIN_LevelingDone() { DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); - #if ENABLED(MPCTEMP) - - switch (HMI_value.pidresult) { + switch (HMI_value.pidresult) { + default: return; + #if ENABLED(MPC_AUTOTUNE) case MPCTEMP_START: - _maxtemp = thermalManager.hotend_maxtemp[0]; - _target = 200; DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); break; - case PIDTEMPBED_START: - _maxtemp = BED_MAXTEMP; - _target = HMI_data.BedPidT; + #endif + #if EITHER(PIDTEMP, PIDTEMPBED) + TERN_(PIDTEMP, case PIDTEMP_START:) + TERN_(PIDTEMPBED, case PIDTEMPBED_START:) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); break; - default: return; - } - - #else // PID + #endif + } - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); - DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + switch (HMI_value.pidresult) { + default: break; + #if EITHER(PIDTEMP, MPC_AUTOTUNE) + TERN_(PIDTEMP, case PIDTEMP_START:) + TERN_(MPC_AUTOTUNE, case MPCTEMP_START:) + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); + break; + #endif + #if ENABLED(PIDTEMPBED) + case PIDTEMPBED_START: + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); + break; + #endif + } - switch (HMI_value.pidresult) { + switch (HMI_value.pidresult) { + default: break; + #if ENABLED(MPC_AUTOTUNE) + case MPCTEMP_START: + _maxtemp = thermalManager.hotend_maxtemp[0]; + _target = 200; + break; + #endif + #if ENABLED(PIDTEMP) case PIDTEMP_START: _maxtemp = thermalManager.hotend_maxtemp[0]; _target = HMI_data.HotendPidT; - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); break; + #endif + #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: _maxtemp = BED_MAXTEMP; _target = HMI_data.BedPidT; - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); break; - default: return; - } - - #endif // PID + #endif + } plot.Draw(gfrm, _maxtemp, _target); DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); @@ -1587,7 +1600,7 @@ void DWIN_LevelingDone() { #endif // DWIN_PID_TUNE -#if ENABLED(MPCTEMP) +#if ENABLED(MPC_AUTOTUNE) void DWIN_MPCTuning(tempcontrol_t result) { HMI_value.pidresult = result; @@ -1607,7 +1620,7 @@ void DWIN_LevelingDone() { break; case MPC_INTERRUPTED: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE STR_MPC_AUTOTUNE_INTERRUPTED)); + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE_INTERRUPTED)); ui.reset_alert_level(); break; case MPC_DONE: @@ -1622,7 +1635,7 @@ void DWIN_LevelingDone() { } } -#endif // MPCTEMP +#endif // MPC_AUTOTUNE // Started a Print Job void DWIN_Print_Started() { @@ -3090,8 +3103,8 @@ void Draw_AdvancedSettings_Menu() { #if ENABLED(PIDTEMP) MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, Draw_HotendPID_Menu); #endif - #if ENABLED(MPCTEMP) - MENU_ITEM_F(ICON_MPCNozzle, STR_MPC_AUTOTUNE " Settings", onDrawSubMenu, Draw_HotendMPC_Menu); + #if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) + MENU_ITEM_F(ICON_MPCNozzle, "MPC Settings", onDrawSubMenu, Draw_HotendMPC_Menu); #endif #if ENABLED(PIDTEMPBED) MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, Draw_BedPID_Menu); @@ -3524,37 +3537,45 @@ void Draw_Steps_Menu() { #endif -#if ENABLED(MPCTEMP) +#if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - void HotendMPC() { thermalManager.MPC_autotune(active_extruder); } - void SetHeaterPower() { SetPFloatOnClick(1, 200, 1); } - void SetBlkHeatCapacity() { SetPFloatOnClick(0, 40, 2); } - void SetSensorRespons() { SetPFloatOnClick(0, 1, 4); } - void SetAmbientXfer() { SetPFloatOnClick(0, 1, 4); } - #if ENABLED(MPC_INCLUDE_FAN) - void onDrawFanAdj(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } - void ApplyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(MenuData.Value / POW(10, 4)); } - void SetFanAdj() { SetFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), ApplyFanAdj); } + #if ENABLED(MPC_AUTOTUNE_MENU) + void HotendMPC() { thermalManager.MPC_autotune(active_extruder); } + #endif + #if ENABLED(MPC_EDIT_MENU) + void SetHeaterPower() { SetPFloatOnClick(1, 200, 1); } + void SetBlkHeatCapacity() { SetPFloatOnClick(0, 40, 2); } + void SetSensorResponse() { SetPFloatOnClick(0, 1, 4); } + void SetAmbientXfer() { SetPFloatOnClick(0, 1, 4); } + #if ENABLED(MPC_INCLUDE_FAN) + void onDrawFanAdj(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } + void ApplyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(MenuData.Value / POW(10, 4)); } + void SetFanAdj() { SetFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), ApplyFanAdj); } + #endif #endif void Draw_HotendMPC_Menu() { checkkey = Menu; - if (SET_MENU_F(HotendMPCMenu, STR_MPC_AUTOTUNE " Settings", 7)) { + if (SET_MENU_F(HotendMPCMenu, "MPC Settings", 7)) { MPC_t &mpc = thermalManager.temp_hotend[0].mpc; BACK_ITEM(Draw_AdvancedSettings_Menu); - MENU_ITEM(ICON_MPCNozzle, MSG_MPC_AUTOTUNE, onDrawMenuItem, HotendMPC); - EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, SetHeaterPower, &mpc.heater_power); - EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, SetBlkHeatCapacity, &mpc.block_heat_capacity); - EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, SetSensorRespons, &mpc.sensor_responsiveness); - EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, SetAmbientXfer, &mpc.ambient_xfer_coeff_fan0); - #if ENABLED(MPC_INCLUDE_FAN) - EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, SetFanAdj, &mpc.fan255_adjustment); + #if ENABLED(MPC_AUTOTUNE_MENU) + MENU_ITEM(ICON_MPCNozzle, MSG_MPC_AUTOTUNE, onDrawMenuItem, HotendMPC); + #endif + #if ENABLED(MPC_EDIT_MENU) + EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, SetHeaterPower, &mpc.heater_power); + EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, SetBlkHeatCapacity, &mpc.block_heat_capacity); + EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, SetSensorResponse, &mpc.sensor_responsiveness); + EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, SetAmbientXfer, &mpc.ambient_xfer_coeff_fan0); + #if ENABLED(MPC_INCLUDE_FAN) + EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, SetFanAdj, &mpc.fan255_adjustment); + #endif #endif } UpdateMenu(HotendMPCMenu); } -#endif // MPCTEMP +#endif // MPC_EDIT_MENU || MPC_AUTOTUNE_MENU #if ENABLED(PIDTEMPBED) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index 112df5cae144..26b77da5fb13 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -74,7 +74,7 @@ enum processID : uint8_t { NothingToDo }; -#if EITHER(DWIN_PID_TUNE, MPCTEMP) +#if EITHER(DWIN_PID_TUNE, MPC_AUTOTUNE) enum tempcontrol_t : uint8_t { #if DWIN_PID_TUNE @@ -85,7 +85,7 @@ enum processID : uint8_t { PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, #endif - #if ENABLED(MPCTEMP) + #if ENABLED(MPC_AUTOTUNE) MPC_DONE, MPCTEMP_START, MPC_TEMP_ERROR, @@ -229,7 +229,6 @@ void ParkHead(); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) void UBLMeshTilt(); - bool UBLValidMesh(); void UBLMeshSave(); void UBLMeshLoad(); #endif @@ -384,7 +383,9 @@ void Draw_Steps_Menu(); #endif // MPC -#if ENABLED(MPCTEMP) - void DWIN_MPCTuning(tempcontrol_t result); +#if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) void Draw_HotendMPC_Menu(); #endif +#if ENABLED(MPC_AUTOTUNE) + void DWIN_MPCTuning(tempcontrol_t result); +#endif diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index 0945d6977814..c3edba53dff5 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -89,7 +89,7 @@ void ESDiagClass::Draw() { void ESDiagClass::Update() { DWINUI::cursor.y = 80; - #define ES_REPORT(S) draw_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING) + #define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) #if HAS_X_MIN ES_REPORT(X_MIN); #endif diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index 39b328d80814..520ca587e335 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -94,12 +94,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -120,6 +120,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 285729cc15d2..dce503776bcf 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -72,14 +72,6 @@ void ChironTFT::Startup() { live_Zoffset = 0.0; file_menu = AC_menu_file; - // Setup pins for powerloss detection - // Two IO pins are connected on the Trigorilla Board - // On a power interruption the OUTAGECON_PIN goes low. - - #if ENABLED(POWER_LOSS_RECOVERY) - OUT_WRITE(OUTAGECON_PIN, HIGH); - #endif - // Filament runout is handled by Marlin settings in Configuration.h // opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present. // opt_enable FIL_RUNOUT_PULLUP diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h index c9a32e584dee..e0517ec640e0 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h @@ -76,7 +76,6 @@ class ChironTFT { static void CheckHeaters(); static void SendFileList(int8_t); static void SelectFile(); - static void InjectCommandandWait(PGM_P); static void ProcessPanelRequest(); static void PanelInfo(uint8_t); static void PanelAction(uint8_t); diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index afe88bf583d0..a2ad678ac62e 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -81,12 +81,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -106,6 +106,9 @@ namespace ExtUI { #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 } 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 774ba55e43a5..1bc52bfcaf6d 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -23,6 +23,8 @@ #if ENABLED(ANYCUBIC_LCD_I3MEGA) +//#define ANYCUBIC_LCD_DEBUG + #include "anycubic_i3mega_lcd.h" #include "../ui_api.h" diff --git a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp new file mode 100644 index 000000000000..38603f567915 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp @@ -0,0 +1,161 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * lcd/extui/anycubic_vyper/FileNavigator.cpp + */ + +/*************************************************************************** + * The AC panel wants files in block of 4 and can only display a flat list * + * This library allows full folder traversal. * + ***************************************************************************/ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(ANYCUBIC_LCD_VYPER) + +#include "FileNavigator.h" +#include "dgus_tft.h" + +using namespace ExtUI; + +namespace Anycubic { + + FileList FileNavigator::filelist; // Instance of the Marlin file API + char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path + uint16_t FileNavigator::lastindex; + uint8_t FileNavigator::folderdepth; + uint16_t FileNavigator::currentindex; // override the panel request + + FileNavigator filenavigator; + + FileNavigator::FileNavigator() { reset(); } + + void FileNavigator::reset() { + currentfoldername[0] = '\0'; + folderdepth = 0; + currentindex = 0; + lastindex = 0; + // Start at root folder + while (!filelist.isAtRootDir()) filelist.upDir(); + refresh(); + } + + void FileNavigator::refresh() { filelist.refresh(); } + + void FileNavigator::getFiles(uint16_t index) { + uint8_t files = 5; + if (index == 0) currentindex = 0; + + // Each time we change folder we reset the file index to 0 and keep track + // of the current position as the TFT panel isnt aware of folders trees. + if (index > 0) { + //--currentindex; // go back a file to take account off the .. we added to the root. + if (index > lastindex) + currentindex += files; + else + currentindex = currentindex < 5 ? 0 : currentindex - files; + } + lastindex = index; + + #if ACDEBUG(AC_FILE) + SERIAL_ECHOLNPGM("index=", index, " currentindex=", currentindex, " lastindex=", lastindex); + #endif + + uint8_t file_num = 0; + for (uint16_t _seek = currentindex; _seek < currentindex + files; _seek++) { + + #if ACDEBUG(AC_FILE) + SERIAL_ECHOLNPGM("_seek: ", _seek, " currentindex: ", currentindex, " files: ", files); + #endif + + if (filelist.seek(_seek)) { + //sendFile(); + + DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30); + + #if ACDEBUG(AC_FILE) + SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n"); + #endif + } + else { + #if ACDEBUG(AC_FILE) + SERIAL_ECHOLNPGM("over seek: ", _seek); + #endif + + DgusTFT::SendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30); + } + + file_num++; + } + } + + void FileNavigator::sendFile() { + // Send the file and folder info to the panel. + // This info will be returned when the file is selected. + // Permitted special characters in file name: -_*#~ + // Panel can display 22 characters per line. + if (!filelist.isDir()) + DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0); + } + + void FileNavigator::changeDIR(char *folder) { + #if ACDEBUG(AC_FILE) + SERIAL_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder); + #endif + if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth + strcat(currentfoldername, folder); + strcat(currentfoldername, "/"); + filelist.changeDir(folder); + refresh(); + folderdepth++; + currentindex = 0; + } + + void FileNavigator::upDIR() { + filelist.upDir(); + refresh(); + folderdepth--; + currentindex = 0; + // Remove the last child folder from the stored path + if (folderdepth == 0) { + currentfoldername[0] = '\0'; + reset(); + } + else { + char *pos = nullptr; + for (uint8_t f = 0; f < folderdepth; f++) + pos = strchr(currentfoldername, '/'); + + *(pos + 1) = '\0'; + } + #if ACDEBUG(AC_FILE) + SERIAL_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername); + #endif + } + + char* FileNavigator::getCurrentFolderName() { return currentfoldername; } + + uint16_t FileNavigator::getFileNum() { return filelist.count(); } +} + +#endif // ANYCUBIC_LCD_VYPER diff --git a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h new file mode 100644 index 000000000000..c39e66b63ec3 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h @@ -0,0 +1,57 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * lcd/extui/anycubic_vyper/FileNavigator.h + */ + +#include "dgus_tft_defs.h" +#include "../ui_api.h" + +using namespace ExtUI; + +namespace Anycubic { + class FileNavigator { + public: + FileNavigator(); + + static FileList filelist; + + void reset(); + void getFiles(uint16_t); + void upDIR(); + void changeDIR(char *); + void sendFile(); + void refresh(); + char * getCurrentFolderName(); + uint16_t getFileNum(); + + private: + + static char currentfoldername[MAX_PATH_LEN]; + static uint16_t lastindex; + static uint8_t folderdepth; + static uint16_t currentindex; + }; + extern FileNavigator filenavigator; +} diff --git a/Marlin/src/lcd/extui/anycubic_vyper/Tunes.cpp b/Marlin/src/lcd/extui/anycubic_vyper/Tunes.cpp new file mode 100644 index 000000000000..d7f0e4b6d4c9 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/Tunes.cpp @@ -0,0 +1,58 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * lcd/extui/anycubic_vyper/Tunes.cpp + */ + +/*********************************************************************** + * A Utility to play tunes using the buzzer in the printer controller. * + * See Tunes.h for note and tune definitions. * + ***********************************************************************/ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(ANYCUBIC_LCD_VYPER) + +#include "Tunes.h" +#include "../ui_api.h" + +namespace Anycubic { + + void PlayTune(const uint8_t beeperPin, const uint16_t *tune, const uint8_t speed=1) { + uint8_t pos = 1; + uint16_t wholenotelen = tune[0] / speed; + do { + uint16_t freq = tune[pos]; + uint16_t notelen = wholenotelen / tune[pos + 1]; + + ::tone(beeperPin, freq, notelen); + ExtUI::delay_ms(notelen); + pos += 2; + + if (pos >= MAX_TUNE_LENGTH) break; + } while (tune[pos] != n_END); + } + +} + +#endif // ANYCUBIC_LCD_VYPER diff --git a/Marlin/src/lcd/extui/anycubic_vyper/Tunes.h b/Marlin/src/lcd/extui/anycubic_vyper/Tunes.h new file mode 100644 index 000000000000..9a06768ac6e0 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/Tunes.h @@ -0,0 +1,220 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * lcd/extui/anycubic_vyper/Tunes.h + */ + +/************************************************************************** + * Notes definition from https://pages.mtu.edu/~suits/NoteFreqCalcs.html * + * * + * The format of a tune is: * + * {,,, ,, ... } * + * * + * 1) The first value is the length of a whole note in milliseconds * + * 2) Then a sequence of pitch and duration pairs * + * 3) Finally the END marker so your tunes can be any length up to * + * MAX_TUNE_LEN * + *************************************************************************/ + +#include + +#define MAX_TUNE_LENGTH 128 + +// Special notes! +#define n_P 0 // silence or pause +#define n_END 10000 // end of tune marker + +// Note duration divisors +#define l_T1 1 +#define l_T2 2 +#define l_T3 3 +#define l_T4 4 +#define l_T8 8 +#define l_T16 16 + +// Note Frequency +#define n_C0 16 +#define n_CS0 17 +#define n_D0 18 +#define n_DS0 19 +#define n_E0 21 +#define n_F0 22 +#define n_FS0 23 +#define n_G0 25 +#define n_GS0 26 +#define n_A0 28 +#define n_AS0 29 +#define n_B0 31 +#define n_C1 33 +#define n_CS1 35 +#define n_D1 37 +#define n_DS1 39 +#define n_E1 41 +#define n_F1 44 +#define n_FS1 46 +#define n_G1 49 +#define n_GS1 52 +#define n_A1 55 +#define n_AS1 58 +#define n_B1 62 +#define n_C2 65 +#define n_CS2 69 +#define n_D2 73 +#define n_DS2 78 +#define n_E2 82 +#define n_F2 87 +#define n_FS2 93 +#define n_G2 98 +#define n_GS2 104 +#define n_A2 110 +#define n_AS2 117 +#define n_B2 123 +#define n_C3 131 +#define n_CS3 139 +#define n_D3 147 +#define n_DS3 156 +#define n_E3 165 +#define n_F3 175 +#define n_FS3 185 +#define n_G3 196 +#define n_GS3 208 +#define n_A3 220 +#define n_AS3 233 +#define n_B3 247 +#define n_C4 262 +#define n_CS4 277 +#define n_D4 294 +#define n_DS4 311 +#define n_E4 330 +#define n_F4 349 +#define n_FS4 370 +#define n_G4 392 +#define n_GS4 415 +#define n_A4 440 +#define n_AS4 466 +#define n_B4 494 +#define n_C5 523 +#define n_CS5 554 +#define n_D5 587 +#define n_DS5 622 +#define n_E5 659 +#define n_F5 698 +#define n_FS5 740 +#define n_G5 784 +#define n_GS5 831 +#define n_A5 880 +#define n_AS5 932 +#define n_B5 988 +#define n_C6 1047 +#define n_CS6 1109 +#define n_D6 1175 +#define n_DS6 1245 +#define n_E6 1319 +#define n_F6 1397 +#define n_FS6 1480 +#define n_G6 1568 +#define n_GS6 1661 +#define n_A6 1760 +#define n_AS6 1865 +#define n_B6 1976 +#define n_C7 2093 +#define n_CS7 2217 +#define n_D7 2349 +#define n_DS7 2489 +#define n_E7 2637 +#define n_F7 2794 +#define n_FS7 2960 +#define n_G7 3136 +#define n_GS7 3322 +#define n_A7 3520 +#define n_AS7 3729 +#define n_B7 3951 +#define n_C8 4186 +#define n_CS8 4435 +#define n_D8 4699 +#define n_DS8 4978 +#define n_E8 5274 +#define n_F8 5587 +#define n_FS8 5920 +#define n_G8 6272 +#define n_GS8 6645 +#define n_A8 7040 +#define n_AS8 7459 +#define n_B8 7902 + +namespace Anycubic { + + void PlayTune(const uint8_t beeperPin, const uint16_t *tune, const uint8_t speed); + + // Only uncomment the tunes you are using to save memory + // This will help you write tunes! + // https://www.apronus.com/music/flashpiano.htm + + const uint16_t SOS[] = { + 250, + n_G6,l_T3, n_P,l_T3, n_G6,l_T3, n_P,l_T3, n_G6,l_T3, n_P,l_T1, + n_G6,l_T1, n_P,l_T3, n_G6,l_T1, n_P,l_T3, n_G6,l_T1, n_P,l_T1, + n_G6,l_T3, n_P,l_T3, n_G6,l_T3, n_P,l_T3, n_G6,l_T3, n_P,l_T1, + n_END + }; + + const uint16_t BeepBeep[] = { + 500, + n_C7,l_T8, n_P,l_T16, n_C7,l_T8, n_P,l_T8, + n_END + }; + + const uint16_t BeepBeepBeeep[] = { + 1000, + n_G7,l_T4, n_P,l_T16, n_G7,l_T4, n_P,l_T8, n_G7,l_T2, + n_END + }; + + const uint16_t Anycubic_PowerOn[] = { + 1000, + n_F7,l_T8, n_P,l_T8, n_C7,l_T8, n_P,l_T8, n_D7,l_T8, n_P,l_T8, + n_E7,l_T8, n_P,l_T8, n_D7,l_T4, n_P,l_T4, n_G7,l_T4, n_P,l_T4, + n_A7,l_T2, n_P,l_T1, + n_END + }; + + const uint16_t GB_PowerOn[] = { + 500, + n_C6,l_T4, n_P,l_T16, n_C7,l_T2, n_P,l_T8, + n_END + }; + + const uint16_t Heater_Timedout[] = { + 1000, + n_C6,l_T1, + n_END + }; + + const uint16_t FilamentOut[] = { + 1000, + n_AS7,l_T4, n_P,l_T16, n_FS7,l_T2, + n_END + }; + +} diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp new file mode 100644 index 000000000000..e9e80101f6cf --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -0,0 +1,3305 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * lcd/extui/anycubic_vyper/dgus_tft.cpp + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(ANYCUBIC_LCD_VYPER) + +#include "dgus_tft.h" +#include "Tunes.h" +#include "FileNavigator.h" + +#include "../../../gcode/queue.h" +#include "../../../sd/cardreader.h" +#include "../../../libs/numtostr.h" +#include "../../../MarlinCore.h" +#include "../../../core/serial.h" +#include "../../../module/stepper.h" +#include "../../../module/probe.h" + +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../../../feature/powerloss.h" +#endif + +#define DEBUG_OUT ACDEBUGLEVEL +#include "../../../core/debug_out.h" + +#include + +namespace Anycubic { + + const char MESSAGE_charu[] = {0xB4, 0xE6, 0xB4, 0xA2, 0xBF, 0xA8, 0xD2, 0xD1, 0xB2, 0xE5, 0xC8, 0xEB, 0x00}; // '忙'垄驴篓脪脩虏氓脠毛 + const char MESSAGE_bachu[] = {0xB4, 0xE6, 0xB4, 0xA2, 0xBF, 0xA8, 0xD2, 0xD1, 0xB0, 0xCE, 0xB3, 0xF6, 0x00}; + const char MESSAGE_wuka[] = {0xCE, 0xDE, 0xB4, 0xE6, 0xB4, 0xA2, 0xBF, 0xA8, 0x00}; + const char MESSAGE_lianji[] = {0xC1, 0xAA, 0xBB, 0xFA, 0xD6, 0xD0, 0x00}; + const char MESSAGE_tuoji[] = {0xCD, 0xD1, 0xBB, 0xFA, 0xB4, 0xF2, 0xD3, 0xA1, 0xD6, 0xD0, 0x00}; + const char MESSAGE_zanting[] = {0xB4, 0xF2, 0xD3, 0xA1, 0xD4, 0xDD, 0xCD, 0xA3, 0xD6, 0xD0, 0x00}; + const char MESSAGE_tingzhi[] = {0xCD, 0xA3, 0xD6, 0xB9, 0xB4, 0xF2, 0xD3, 0xA1, 0x00}; + const char MESSAGE_wancheng[] = {0xCD, 0xEA, 0xB3, 0xC9, 0xB4, 0xF2, 0xD3, 0xA1, 0x00}; + const char MESSAGE_hotend_heating[] = {0xB4, 0xF2, 0xD3, 0xA1, 0xCD, 0xB7, 0xD5, 0xFD, 0xD4, 0xDA, 0xBC, 0xD3, 0xC8, 0xC8, 0x00}; + const char MESSAGE_hotend_over[] = {0xB4, 0xF2, 0xD3, 0xA1, 0xCD, 0xB7, 0xBC, 0xD3, 0xC8, 0xC8, 0xCD, 0xEA, 0xB3, 0xC9, 0x00}; + const char MESSAGE_bed_heating[] = {0xC8, 0xC8, 0xB4, 0xB2, 0xD5, 0xFD, 0xD4, 0xDA, 0xBC, 0xD3, 0xC8, 0xC8, 0x00}; + const char MESSAGE_bed_over[] = {0xC8, 0xC8, 0xB4, 0xB2, 0xBC, 0xD3, 0xC8, 0xC8, 0xCD, 0xEA, 0xB3, 0xC9, 0x00}; + const char MESSAGE_ready[] = {0xD7, 0xBC, 0xB1, 0xB8, 0xBE, 0xCD, 0xD0, 0xF7, 0x00}; + const char MESSAGE_cold[] = {0xB4, 0xF2, 0xD3, 0xA1, 0xCD, 0xB7, 0xCE, 0xC2, 0xB6, 0xC8, 0xB9, 0xFD, 0xB5, 0xCD, 0x00}; + + const char *p_mesage[] = { MESSAGE_charu, MESSAGE_bachu, MESSAGE_wuka, MESSAGE_lianji, MESSAGE_tuoji, MESSAGE_zanting, + MESSAGE_tingzhi, MESSAGE_wancheng, MESSAGE_hotend_heating, MESSAGE_hotend_over, MESSAGE_bed_heating, + MESSAGE_bed_over, MESSAGE_ready, MESSAGE_cold }; + + DgusTFT::p_fun fun_array[] = { + DgusTFT::page1, DgusTFT::page2, DgusTFT::page3, DgusTFT::page4, DgusTFT::page5, DgusTFT::page6, + DgusTFT::page7, DgusTFT::page8, DgusTFT::page9, DgusTFT::page10, DgusTFT::page11, DgusTFT::page12, + DgusTFT::page13, DgusTFT::page14, DgusTFT::page15, DgusTFT::page16, DgusTFT::page17, DgusTFT::page18, + DgusTFT::page19, DgusTFT::page20, DgusTFT::page21, DgusTFT::page22, DgusTFT::page23, DgusTFT::page24, + DgusTFT::page25, DgusTFT::page26, DgusTFT::page27, DgusTFT::page28, DgusTFT::page29, DgusTFT::page30, + DgusTFT::page31, DgusTFT::page32 + #if HAS_LEVELING + , DgusTFT::page33 , DgusTFT::page34 + #endif + }; + + printer_state_t DgusTFT::printer_state; + paused_state_t DgusTFT::pause_state; + #if HAS_HOTEND + heater_state_t DgusTFT::hotend_state; + #endif + #if HAS_HEATED_BED + heater_state_t DgusTFT::hotbed_state; + #endif + char DgusTFT::selectedfile[MAX_PATH_LEN]; + char DgusTFT::panel_command[MAX_CMND_LEN]; + uint8_t DgusTFT::command_len; + file_menu_t DgusTFT::file_menu; + + bool DgusTFT::data_received; + uint8_t DgusTFT::data_buf[DATA_BUF_SIZE]; + uint8_t DgusTFT::data_index; + uint16_t DgusTFT::page_index_now, DgusTFT::page_index_last, DgusTFT::page_index_last_2; + uint8_t DgusTFT::message_index; + uint8_t DgusTFT::pop_up_index; + uint32_t DgusTFT::key_value; + uint8_t DgusTFT::lcd_txtbox_index; + uint8_t DgusTFT::lcd_txtbox_page; + int16_t DgusTFT::feedrate_back; + lcd_info_t DgusTFT::lcd_info, DgusTFT::lcd_info_back; + language_t DgusTFT::ui_language; + uint16_t page_index_saved; // flags to keep from bombing the host display + uint8_t pop_up_index_saved; + uint32_t key_value_saved; + + void DEBUG_PRINT_PAUSED_STATE(FSTR_P const msg, paused_state_t state); + void DEBUG_PRINT_PRINTER_STATE(FSTR_P const msg, printer_state_t state); + void DEBUG_PRINT_TIMER_EVENT(FSTR_P const msg, timer_event_t event); + void DEBUG_PRINT_MEDIA_EVENT(FSTR_P const msg, media_event_t event); + + DgusTFT Dgus; + + DgusTFT::DgusTFT() { + data_buf[0] = '\0'; + message_index = 100; + pop_up_index = 100; + page_index_now = page_index_last = page_index_last_2 = 1; + lcd_txtbox_index = 0; + feedrate_back = -1; + } + + void DgusTFT::Startup() { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("DgusTFT::Startup()"); + #endif + selectedfile[0] = '\0'; + panel_command[0] = '\0'; + command_len = 0; + printer_state = AC_printer_idle; + pause_state = AC_paused_idle; + TERN_(HAS_HOTEND, hotend_state = AC_heater_off); + TERN_(HAS_HEATED_BED, hotbed_state = AC_heater_off); + file_menu = AC_menu_file; + set_language(ui_language); // use language stored in EEPROM + + // Filament runout is handled by Marlin settings in Configuration.h + // opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present. + // opt_enable FIL_RUNOUT_PULLUP + + TFTSer.begin(115200); + + // Signal Board has reset + SendtoTFTLN(AC_msg_main_board_has_reset); + + // Enable levelling and Disable end stops during print + // as Z home places nozzle above the bed so we need to allow it past the end stops + injectCommands_P(AC_cmnd_enable_levelling); + + // Startup tunes are defined in Tunes.h + //PlayTune(BEEPER_PIN, Anycubic_PowerOn, 1); + //PlayTune(BEEPER_PIN, GB_PowerOn, 1); + #if ACDEBUGLEVEL + DEBUG_ECHOLNPGM("Startup AC Debug Level ", ACDEBUGLEVEL); + #endif + SendtoTFTLN(AC_msg_ready); + } + + void DgusTFT::ParamInit() { + + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("DgusTFT::ParamInit()"); + #endif + + if (lcd_info.language == CHS) + page_index_now = 1; + else if (lcd_info.language == ENG) + page_index_now = 121; + + LcdAudioSet(lcd_info.audio_on); + + #if ACDEBUG(AC_MARLIN) + if (lcd_info.language == CHS) + DEBUG_ECHOLNPGM("ParamInit lcd language: CHS"); + else if (lcd_info.language == ENG) + DEBUG_ECHOLNPGM("ParamInit lcd language: ENG"); + + if (lcd_info.audio_on) + DEBUG_ECHOLNPGM("ParamInit lcd audio: ON"); + else + DEBUG_ECHOLNPGM("ParamInit lcd audio: OFF"); + #endif + + RequestValueFromTFT(0x14); // get page ID + } + + void DgusTFT::IdleLoop() { + if (ReadTFTCommand()) { + ProcessPanelRequest(); + command_len = 0; + } + + #if ACDEBUG(AC_MARLIN) + if (key_value) { + DEBUG_ECHOLNPGM("IdleLoop page: ", page_index_now); + DEBUG_ECHOLNPGM("key: ", key_value); + } + #endif + + switch (page_index_now) { + case 115: page115(); break; + case 117: page117(); break; + //case 124: page124(); break; + //case 125: page125(); break; + case 170: page170(); break; + + #if ENABLED(POWER_LOSS_RECOVERY) + case 171: page171(); break; + case 173: page173(); break; + #endif + + #if HAS_LEVELING + case 175: page175(); break; + case 176: page176(); break; + #endif + + case 177 ... 198: { + #if 0 // ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("line: ", __LINE__); + DEBUG_ECHOLNPGM("func: ", page_index_now); + #endif + //page177_to_198(); + } break; + + case 199 ... 200: { + #if 0 // ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("line: ", __LINE__); + DEBUG_ECHOLNPGM("func: ", page_index_now); + #endif + page199_to_200(); + } break; + + case 201: case 204: page201(); break; + case 202: case 205: page202(); break; + case 203: case 206: page203(); break; + + default: + if (lcd_info.language == CHS) { + if (WITHIN(page_index_now, 1, 1 + COUNT(fun_array))) { + fun_array[page_index_now - 1](); + } + else { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("line: ", __LINE__); + DEBUG_ECHOLNPGM("fun doesn't exist: ", page_index_now); + #endif + } + } + else if (lcd_info.language == ENG) { + if (WITHIN(page_index_now, 121, 121 + COUNT(fun_array))) { + fun_array[page_index_now - 121](); // ENG page_index is 120 more than CHS + } + else { + SERIAL_ECHOLNPGM("lcd function doesn't exist"); + SERIAL_ECHOLNPGM("page_index_last: ", page_index_last); + SERIAL_ECHOLNPGM("page_index_last_2: ", page_index_last_2); + } + } + break; + } + + pop_up_manager(); + key_value = 0; + + CheckHeaters(); + } + + uint8_t FSHlength(FSTR_P FSHinput) { + PGM_P FSHinputPointer = reinterpret_cast(FSHinput); + uint8_t stringLength = 0; + while (pgm_read_byte(FSHinputPointer++)) stringLength++; + return stringLength; + } + + void DgusTFT::PrinterKilled(FSTR_P error_p, FSTR_P component_p) { + + // copy string in FLASH to RAM for strcmp_P + + uint8_t textLength = FSHlength(error_p); + char error[FSHlength(error_p) + 1]; + memcpy_P(error, error_p, textLength + 1); // +1 for the null terminator + + textLength = FSHlength(component_p); + char component[FSHlength(component_p) + 1]; + memcpy_P(component, component_p, textLength + 1); // +1 for the null terminator + + SendtoTFTLN(AC_msg_kill_lcd); + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("PrinterKilled()\nerror: ", error, "\ncomponent: ", component); + #endif + + if (strcmp_P(error, PSTR("Heating Failed")) == 0) { + + if (strcmp_P(component, PSTR("Bed")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_HEATER); + SERIAL_ECHOLNPGM("Check Bed heater"); + } + else if (strcmp_P(component, PSTR("E1")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_HEATER); + SERIAL_ECHOLNPGM("Check E1 heater"); + } + + } + else if (strcmp_P(error, PSTR("Err: MINTEMP")) == 0) { + + if (strcmp_P(component, PSTR("Bed")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_NTC); + SERIAL_ECHOLNPGM("Check Bed thermistor"); + } + else if (strcmp_P(component, PSTR("E1")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_NTC); + SERIAL_ECHOLNPGM("Check E1 thermistor"); + } + + } + else if (strcmp_P(error, PSTR("Err: MAXTEMP")) == 0) { + + if (strcmp_P(component, PSTR("Bed")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_NTC); + SERIAL_ECHOLNPGM("Check Bed thermistor"); + } + else if (strcmp_P(component, PSTR("E1")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_NTC); + SERIAL_ECHOLNPGM("Check E1 thermistor"); + } + + } + else if (strcmp_P(error, PSTR("THERMAL RUNAWAY")) == 0) { + + if (strcmp_P(component, PSTR("Bed")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_HEATER); + SERIAL_ECHOLNPGM("Check Bed thermal runaway"); + } + else if (strcmp_P(component, PSTR("E1")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_HEATER); + SERIAL_ECHOLNPGM("Check E1 thermal runaway"); + } + + } + else if (strcmp_P(error, PSTR("Homing Failed")) == 0) { + + if (strcmp_P(component, PSTR("X")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_X_ENDSTOP); + SERIAL_ECHOLNPGM("Check X endstop"); + } + else if (strcmp_P(component, PSTR("Y")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_Y_ENDSTOP); + SERIAL_ECHOLNPGM("Check Y endstop"); + } + else if (strcmp_P(component, PSTR("Z")) == 0) { + ChangePageOfTFT(PAGE_CHS_ABNORMAL_Z_ENDSTOP); + SERIAL_ECHOLNPGM("Check Z endstop"); + } + + } + + } + + void DgusTFT::set_descript_color(const uint16_t color, const uint8_t index/*=lcd_txtbox_index*/) { + SendColorToTFT(color, TXT_DESCRIPT_0 + 0x30 * (index - 1)); + } + + void DgusTFT::MediaEvent(media_event_t event) { + #if ACDEBUG(AC_MARLIN) + DEBUG_PRINT_MEDIA_EVENT(F("ProcessMediaStatus() "), event); + #endif + switch (event) { + case AC_media_inserted: + + filenavigator.reset(); + + lcd_txtbox_page = 0; + if (lcd_txtbox_index) { + set_descript_color(COLOR_BLUE); + lcd_txtbox_index = 0; + } + + SendFileList(lcd_txtbox_index); + + break; + + case AC_media_removed: + SendtoTFTLN(AC_msg_sd_card_removed); + + filenavigator.reset(); + + lcd_txtbox_page = 0; + if (lcd_txtbox_index) { + set_descript_color(COLOR_BLUE); + lcd_txtbox_index = 0; + } + + SendFileList(lcd_txtbox_index); + break; + + case AC_media_error: + SendtoTFTLN(AC_msg_no_sd_card); + break; + } + } + + void DgusTFT::TimerEvent(timer_event_t event) { + + #if ACDEBUG(AC_MARLIN) + DEBUG_PRINT_TIMER_EVENT(F("TimerEvent() "), event); + DEBUG_PRINT_PRINTER_STATE(F("Printer State: "), printer_state); + #endif + + switch (event) { + case AC_timer_started: + setSoftEndstopState(false); // disable endstops to print + printer_state = AC_printer_printing; + SendtoTFTLN(AC_msg_print_from_sd_card); + break; + + case AC_timer_paused: + //printer_state = AC_printer_paused; + //pause_state = AC_paused_idle; + SendtoTFTLN(AC_msg_paused); + break; + + case AC_timer_stopped: + if (printer_state != AC_printer_idle) { + if (printer_state == AC_printer_stopping_from_media_remove) { + ChangePageOfTFT(PAGE_NO_SD); + } + else { + printer_state = AC_printer_stopping; + + // Get Printing Time + uint32_t time = getProgress_seconds_elapsed() / 60; + char str_buf[20]; + sprintf(str_buf, "%s H ", utostr3(time / 60)); + sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); + SendTxtToTFT(str_buf, TXT_FINISH_TIME); + ChangePageOfTFT(PAGE_PRINT_FINISH); + SendtoTFTLN(AC_msg_print_complete); + pop_up_index = 100; + } + } + setSoftEndstopState(true); // enable endstops + break; + } + } + + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + + void DgusTFT::FilamentRunout() { + #if ACDEBUG(AC_MARLIN) + DEBUG_PRINT_PRINTER_STATE(F("FilamentRunout() printer_state "), printer_state); + + // 1 Signal filament out + SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); + //printer_state = AC_printer_filament_out; + + DEBUG_ECHOLNPGM("getFilamentRunoutState: ", getFilamentRunoutState()); + #endif + + pop_up_index = 15; // show filament lack. + + if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) { + PlayTune(BEEPER_PIN, FilamentOut, 1); + + feedrate_back = getFeedrate_percent(); + + if (isPrintingFromMedia()) { + pausePrint(); + printer_state = AC_printer_pausing; + pause_state = AC_paused_filament_lack; + } + } + } + + #endif // FILAMENT_RUNOUT_SENSOR + + void DgusTFT::ConfirmationRequest(const char * const msg) { + // M108 continue + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("HomingComplete, line: ", __LINE__); + DEBUG_ECHOLNPGM("ConfirmationRequest() ", msg); + DEBUG_PRINT_PRINTER_STATE(F("printer_state: " ), printer_state); + DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state); + #endif + + switch (printer_state) { + case AC_printer_pausing: { + if (strcmp_P(msg, MARLIN_msg_print_paused) == 0 || strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) { + if (pause_state != AC_paused_filament_lack) + ChangePageOfTFT(PAGE_STATUS1); // enable continue button + printer_state = AC_printer_paused; + } + } + break; + + #if ENABLED(POWER_LOSS_RECOVERY) + case AC_printer_resuming_from_power_outage: + #endif + case AC_printer_printing: + case AC_printer_paused: + // Heater timout, send acknowledgement + if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { + pause_state = AC_paused_heater_timed_out; + SendtoTFTLN(AC_msg_paused); // enable continue button + PlayTune(BEEPER_PIN, Heater_Timedout, 1); + } + // Reheat finished, send acknowledgement + else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("send M108 ", __LINE__); + #endif + injectCommands(F("M108")); + + if (pause_state != AC_paused_filament_lack) + pause_state = AC_paused_idle; + + SendtoTFTLN(AC_msg_paused); // enable continue button + } + // Filament Purging, send acknowledgement enter run mode + else if (strcmp_P(msg, MARLIN_msg_filament_purging) == 0) { + pause_state = AC_paused_purging_filament; + SendtoTFTLN(AC_msg_paused); // enable continue button + } + else if (strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("send M108 ", __LINE__); + #endif + injectCommands(F("M108")); + + if (pause_state != AC_paused_filament_lack) + pause_state = AC_paused_idle; + } + + break; + + default: break; + } + } + + void DgusTFT::StatusChange(const char * const msg) { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("StatusChange() ", msg); + DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state); + #endif + bool msg_matched = false; + + #if HAS_LEVELING + static uint8_t probe_cnt = 0; + #endif + + // The only way to get printer status is to parse messages + // Use the state to minimise the work we do here. + switch (printer_state) { + #if HAS_LEVELING + case AC_printer_probing: + + if (strncmp_P(msg, MARLIN_msg_probing_point, strlen_P(MARLIN_msg_probing_point)) == 0) + probe_cnt++; + + // If probing completes ok save the mesh and park + // Ignore the custom machine name + if (strcmp_P(msg + strlen(MACHINE_NAME), MARLIN_msg_ready) == 0) { + if (probe_cnt == GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y) { + probe_cnt = 0; + injectCommands(F("M500")); // G27 park nozzle + //ChangePageOfTFT(PAGE_PreLEVEL); + FakeChangePageOfTFT(PAGE_PreLEVEL); // Prevent UI refreshing too quickly when probing is done + printer_state = AC_printer_idle; + msg_matched = true; + } + } + + // If probing fails don't save the mesh raise the probe above the bad point + if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { + PlayTune(BEEPER_PIN, BeepBeepBeeep, 1); + injectCommands(F("G1 Z50 F500")); + ChangePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR); + SendtoTFTLN(AC_msg_probing_complete); + printer_state = AC_printer_idle; + msg_matched = true; + } + + if (strcmp_P(msg, MARLIN_msg_probe_preheat_start) == 0) + ChangePageOfTFT(PAGE_CHS_PROBE_PREHEATING); + + if (strcmp_P(msg, MARLIN_msg_probe_preheat_stop) == 0) + ChangePageOfTFT(PAGE_LEVELING); + + break; + #endif + + case AC_printer_printing: + if (strcmp_P(msg, MARLIN_msg_reheating) == 0) { + SendtoTFTLN(AC_msg_paused); // enable continue button + ChangePageOfTFT(PAGE_STATUS2); + msg_matched = true; + } + else if (strcmp_P(msg, MARLIN_msg_media_removed) == 0) { + msg_matched = true; + printer_state = AC_printer_stopping_from_media_remove; + } + else { + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("setFilamentRunoutState: ", __LINE__); + #endif + setFilamentRunoutState(false); + #endif + } + break; + + case AC_printer_pausing: + if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) { + if (pause_state != AC_paused_filament_lack) { + ChangePageOfTFT(PAGE_STATUS1); // show resume + pause_state = AC_paused_idle; + } + + printer_state = AC_printer_paused; + msg_matched = true; + } + break; + + case AC_printer_paused: + if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) { + if (pause_state != AC_paused_filament_lack) { + ChangePageOfTFT(PAGE_STATUS1); // show resume + pause_state = AC_paused_idle; + } + + printer_state = AC_printer_paused; + msg_matched = true; + } + break; + + case AC_printer_stopping: + if (strcmp_P(msg, MARLIN_msg_print_aborted) == 0) { + ChangePageOfTFT(PAGE_MAIN); + printer_state = AC_printer_idle; + msg_matched = true; + } + break; + + default: break; + } + + // If not matched earlier see if this was a heater message + if (!msg_matched) { + #if HAS_HOTEND + if (strcmp_P(msg, MARLIN_msg_extruder_heating) == 0) { + SendtoTFTLN(AC_msg_nozzle_heating); + hotend_state = AC_heater_temp_set; + return; + } + #endif + #if HAS_HEATED_BED + if (strcmp_P(msg, MARLIN_msg_bed_heating) == 0) { + SendtoTFTLN(AC_msg_bed_heating); + hotbed_state = AC_heater_temp_set; + } + #endif + } + } + + #if ENABLED(POWER_LOSS_RECOVERY) + + void DgusTFT::PowerLoss() { + // On: 5A A5 05 82 00 82 00 00 + // Off: 5A A5 05 82 00 82 00 64 + uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, 0x00, 0x82, 0x00, uint8_t(recovery.enabled ? 0x00 : 0x64) }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + } + + void DgusTFT::PowerLossRecovery() { + printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover. + } + + #endif // POWER_LOSS_RECOVERY + + void DgusTFT::HomingStart() { + if (!isPrintingFromMedia()) + ChangePageOfTFT(PAGE_CHS_HOMING); + } + + void DgusTFT::HomingComplete() { + if (lcd_info.language == ENG && page_index_last > 120) + page_index_last -= 120; + + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("HomingComplete, line: ", __LINE__); + DEBUG_ECHOLNPGM("page_index_last: ", page_index_last); + #endif + + if (!isPrintingFromMedia()) + ChangePageOfTFT(page_index_last); + } + + void DgusTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel + #if ACDEBUG(AC_SOME) + DEBUG_ECHOF(fstr); + #endif + PGM_P str = FTOP(fstr); + while (const char c = pgm_read_byte(str++)) TFTSer.write(c); + } + + void DgusTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) { + if (fstr) { + #if ACDEBUG(AC_SOME) + DEBUG_ECHOPGM("> "); + #endif + SendtoTFT(fstr); + #if ACDEBUG(AC_SOME) + SERIAL_EOL(); + #endif + } + TFTSer.println(); + } + + void DgusTFT::SendValueToTFT(const uint16_t value, const uint16_t address) { + uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(value >> 8), uint8_t(value & 0xFF) }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + } + + void DgusTFT::RequestValueFromTFT(const uint16_t address) { + uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), 0x01 }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + } + + void DgusTFT::SendTxtToTFT(const char *pdata, const uint16_t address) { + uint8_t data_len = strlen(pdata); + uint8_t data[] = { 0x5A, 0xA5, uint8_t(data_len + 5), 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF) }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + LOOP_L_N(i, data_len) TFTSer.write(pdata[i]); + TFTSer.write(0xFF); TFTSer.write(0xFF); + } + + void DgusTFT::SendColorToTFT(const uint16_t color, const uint16_t address) { + uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(color >> 8), uint8_t(color & 0xFF) }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + } + + void DgusTFT::SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) { + uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), number }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + } + + void DgusTFT::ChangePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("ChangePageOfTFT: ", page_index); + #endif + + uint32_t data_temp = 0; + + if (lcd_info.language == CHS) { + data_temp = page_index; + } + else if (lcd_info.language == ENG) { + switch (page_index) { + case PAGE_OUTAGE_RECOVERY: + data_temp = PAGE_ENG_OUTAGE_RECOVERY; break; + case PAGE_CHS_PROBE_PREHEATING: + data_temp = PAGE_ENG_PROBE_PREHEATING; break; + case PAGE_CHS_HOMING ... PAGE_ENG_HOMING: + data_temp = page_index + 12; break; + case PAGE_CHS_PROBE_PRECHECK ... PAGE_CHS_PROBE_PRECHECK_FAILED: + data_temp = page_index + 3; break; + default: + data_temp = page_index + 120; break; + } + } + + if (!no_send) { + uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x84, 0x5A, 0x01, uint8_t(data_temp >> 8), uint8_t(data_temp & 0xFF) }; + LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + } + + page_index_last_2 = page_index_last; + page_index_last = page_index_now; + page_index_now = data_temp; + + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("page_index_last_2: ", page_index_last_2); + DEBUG_ECHOLNPGM("page_index_last: ", page_index_last); + DEBUG_ECHOLNPGM("page_index_now: ", page_index_now); + #endif + } + + void DgusTFT::FakeChangePageOfTFT(const uint16_t page_index) { + #if ACDEBUG(AC_MARLIN) + if (page_index_saved != page_index_now) + DEBUG_ECHOLNPGM("FakeChangePageOfTFT: ", page_index); + #endif + ChangePageOfTFT(page_index, true); + } + + void DgusTFT::LcdAudioSet(const bool audio_on) { + // On: 5A A5 07 82 00 80 5A 00 00 1A + // Off: 5A A5 07 82 00 80 5A 00 00 12 + uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x80, 0x5A, 0x00, 0x00, uint8_t(audio_on ? 0x1A : 0x12) }; + LOOP_L_N(i, 10) TFTSer.write(data[i]); + } + + bool DgusTFT::ReadTFTCommand() { + static uint8_t length = 0, cnt = 0, tft_receive_steps = 0; + uint8_t data; + + if (0 == TFTSer.available() || data_received) return false; + + data = TFTSer.read(); + + if (tft_receive_steps == 0) { + if (data != 0x5A) { + cnt = 0; + length = 0; + data_index = 0; + data_received = false; + return false; + } + + while (!TFTSer.available()) TERN_(USE_WATCHDOG, hal.watchdog_refresh()); + + data = TFTSer.read(); + // MYSERIAL.write(data ); + if (data == 0xA5) tft_receive_steps = 2; + } + else if (tft_receive_steps == 2) { + length = data; + tft_receive_steps = 3; + data_index = 0; + cnt = 0; + } + else if (tft_receive_steps == 3) { + if (data_index >= (DATA_BUF_SIZE -1)) { + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("lcd uart buff overflow: ", data_index); + #endif + data_index = 0; + data_received = false; + return false; + } + data_buf[data_index++] = data; + cnt++; + if (cnt >= length) { // Receive complete + tft_receive_steps = 0; + cnt = 0; + data_index = 0; + data_received = true; + return true; + } + } + + return false; + } + + #if 0 + { + //SERIAL_ECHOLNPGM("ReadTFTCommand: ", millis()); + //return -1; + + bool command_ready = false; + uint8_t data = 0; + + while (TFTSer.available() > 0 && command_len < MAX_CMND_LEN) { + data = TFTSer.read(); + if (0 == command_len) { + // if + } + + panel_command[command_len] = + if (panel_command[command_len] == '\n') { + command_ready = true; + break; + } + command_len++; + } + + if (command_ready) { + panel_command[command_len] = 0x00; + #if ACDEBUG(AC_ALL) + DEBUG_ECHOLNPGM("< panel_command ", panel_command); + #endif + #if ACDEBUG(AC_SOME) + // Ignore status request commands + uint8_t req = atoi(&panel_command[1]); + if (req > 7 && req != 20) { + DEBUG_ECHOLNPGM("> ", panel_command); + DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + } + #endif + } + return command_ready; + } + #endif + + int8_t DgusTFT::Findcmndpos(const char * buff, const char q) { + for (int8_t pos = 0; pos < MAX_CMND_LEN; ++pos) + if (buff[pos] == q) return pos; + return -1; + } + + void DgusTFT::CheckHeaters() { + static uint32_t time_last = 0; + if (PENDING(millis(), time_last)) return; + time_last = millis() + 500; + + float temp = 0; + + #if HAS_HOTEND + // If the hotend temp is abnormal, confirm state before signalling panel + static uint8_t faultE0Duration = 0; + temp = getActualTemp_celsius(E0); + if (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) { + faultE0Duration++; + if (faultE0Duration >= AC_HEATER_FAULT_VALIDATION_TIME) { + SendtoTFTLN(AC_msg_nozzle_temp_abnormal); + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("Extruder temp abnormal! : ", temp); + #endif + faultE0Duration = 0; + } + } + #endif + + #if HAS_HEATED_BED + static uint8_t faultBedDuration = 0; + temp = getActualTemp_celsius(BED); + if (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) { + faultBedDuration++; + if (faultBedDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { + SendtoTFTLN(AC_msg_bed_temp_abnormal); + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("Bed temp abnormal! : ", temp); + #endif + faultBedDuration = 0; + } + } + #endif + + #if 0 + // Update panel with hotend heater status + if (hotend_state != AC_heater_temp_reached) { + if (WITHIN(getActualTemp_celsius(E0) - getTargetTemp_celsius(E0), -1, 1)) { + SendtoTFTLN(AC_msg_nozzle_heating_done); + hotend_state = AC_heater_temp_reached; + } + } + + // Update panel with bed heater status + if (hotbed_state != AC_heater_temp_reached) { + if (WITHIN(getActualTemp_celsius(BED) - getTargetTemp_celsius(BED), -0.5, 0.5)) { + SendtoTFTLN(AC_msg_bed_heating_done); + hotbed_state = AC_heater_temp_reached; + } + } + #endif + } + + void DgusTFT::SendFileList(int8_t startindex) { + // Respond to panel request for 4 files starting at index + #if ACDEBUG(AC_INFO) + DEBUG_ECHOLNPGM("## SendFileList ## ", startindex); + #endif + filenavigator.getFiles(startindex); + } + + void DgusTFT::SelectFile() { + strncpy(selectedfile, panel_command + 4, command_len - 4); + selectedfile[command_len - 5] = '\0'; + #if ACDEBUG(AC_FILE) + DEBUG_ECHOLNPGM(" Selected File: ", selectedfile); + #endif + switch (selectedfile[0]) { + case '/': // Valid file selected + SendtoTFTLN(AC_msg_sd_file_open_success); + break; + case '<': // .. (go up folder level) + filenavigator.upDIR(); + SendtoTFTLN(AC_msg_sd_file_open_failed); + SendFileList(0); + break; + default: // enter sub folder + filenavigator.changeDIR(selectedfile); + SendtoTFTLN(AC_msg_sd_file_open_failed); + SendFileList(0); + break; + } + } + + void DgusTFT::ProcessPanelRequest() { + uint16_t control_index = 0; + uint32_t control_value; + uint16_t temp; + char str_buf[20]; + + if (data_received) { + data_received = false; + + if (0x83 == data_buf[0]) { + control_index = uint16_t(data_buf[1] << 8) | uint16_t(data_buf[2]); + if ((control_index & 0xF000) == KEY_ADDRESS) { // is KEY + //key_index = control_index; + key_value = (uint16_t(data_buf[4]) << 8) | uint16_t(data_buf[5]); + } + + #if HAS_HOTEND + else if (control_index == TXT_HOTEND_TARGET || control_index == TXT_ADJUST_HOTEND) { // hotend target temp + control_value = (uint16_t(data_buf[4]) << 8) | uint16_t(data_buf[5]); + temp = constrain(uint16_t(control_value), 0, HEATER_0_MAXTEMP); + setTargetTemp_celsius(temp, E0); + //sprintf(str_buf,"%u/%u", (uint16_t)thermalManager.degHotend(0), uint16_t(control_value)); + //SendTxtToTFT(str_buf, TXT_PRINT_HOTEND); + } + #endif + + #if HAS_HEATED_BED + else if (control_index == TXT_BED_TARGET || control_index == TXT_ADJUST_BED) {// bed target temp + control_value = (uint16_t(data_buf[4]) << 8) | uint16_t(data_buf[5]); + temp = constrain(uint16_t(control_value), 0, BED_MAXTEMP); + setTargetTemp_celsius(temp, BED); + //sprintf(str_buf,"%u/%u", uint16_t(thermalManager.degBed()), uint16_t(control_value)); + //SendTxtToTFT(str_buf, TXT_PRINT_BED); + } + #endif + + #if HAS_FAN + else if (control_index == TXT_FAN_SPEED_TARGET) { // fan speed + control_value = (uint16_t(data_buf[4]) << 8) | uint16_t(data_buf[5]); + temp = constrain(uint16_t(control_value), 0, 100); + SendValueToTFT(temp, TXT_FAN_SPEED_NOW); + SendValueToTFT(temp, TXT_FAN_SPEED_TARGET); + setTargetFan_percent(temp, FAN0); + } + #endif + + else if (control_index == TXT_PRINT_SPEED_TARGET || control_index == TXT_ADJUST_SPEED) { // print speed + control_value = (uint16_t(data_buf[4]) << 8) | uint16_t(data_buf[5]); + const uint16_t feedrate = constrain(uint16_t(control_value), 40, 999); + //feedrate_percentage=constrain(control_value,40,999); + sprintf(str_buf, "%u", feedrate); + SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + SendValueToTFT(feedrate, TXT_PRINT_SPEED_NOW); + SendValueToTFT(feedrate, TXT_PRINT_SPEED_TARGET); + setFeedrate_percent(feedrate); + } + + else if (control_index == REG_LCD_READY) { + control_value = (uint32_t(data_buf[3]) << 16) | (uint32_t(data_buf[4]) << 8) | uint32_t(data_buf[5]); + if (control_value == 0x010072) { // startup last gif + LcdAudioSet(lcd_info.audio_on); + + SendValueToTFT(2, ADDRESS_MOVE_DISTANCE); + + #if ENABLED(CASE_LIGHT_ENABLE) + SendValueToTFT(getCaseLightState(), ADDRESS_SYSTEM_LED_STATUS); + SendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS); + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + const bool is_outage = AC_printer_resuming_from_power_outage == printer_state; + if (is_outage) { + ChangePageOfTFT(PAGE_OUTAGE_RECOVERY); + #if ENABLED(LONG_FILENAME_HOST_SUPPORT) + char filename[64] = { '\0' }; + card.getLongPath(filename, recovery.info.sd_filename); + SendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); + #else + SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); + #endif + PlayTune(BEEPER_PIN, SOS, 1); + } + #else + constexpr bool is_outage = false; + #endif + + if (!is_outage) ChangePageOfTFT(PAGE_MAIN); + + } + else if (control_value == 0x010000) { // startup first gif + PlayTune(BEEPER_PIN, Anycubic_PowerOn, 1); // takes 3500 ms + } + } + + /* + else if ((control_index & 0xF000) == 0x2000) { // is TXT ADDRESS + tft_txt_index = control_index; + j = 0; + for (i = 4; ;i++) { + tft_txt_buf[j] = data_buf[i]; + if (tft_txt_buf[j] == 0xFF) { + tft_txt_buf[j] = 0; + break; + } + j++; + } + } + */ + } + else if (0x82 == data_buf[0]) { + // send_cmd_to_pc(cmd ,start ); + } + } + } + + #if 0 + { + // Break these up into logical blocks // as its easier to navigate than one huge switch case! + int8_t req = atoi(&panel_command[1]); + + // Information requests A0 - A8 and A33 + if (req <= 8 || req == 33) PanelInfo(req); + + // Simple Actions A9 - A28 + else if (req <= 28) PanelAction(req); + + // Process Initiation + else if (req <= 34) PanelProcess(req); + + else SendtoTFTLN(); + } + #endif + + void DgusTFT::set_language(language_t language) { + lcd_info.language = ui_language = lcd_info_back.language = language; + } + + void DgusTFT::toggle_language() { + lcd_info.language = ui_language = (lcd_info.language == CHS ? ENG : CHS); + } + + void DgusTFT::goto_system_page() { + ChangePageOfTFT(lcd_info.language == CHS + ? (lcd_info.audio_on ? PAGE_SYSTEM_CHS_AUDIO_ON : PAGE_SYSTEM_CHS_AUDIO_OFF) + : (lcd_info.audio_on ? 11 : 50) // PAGE_SYSTEM_ENG_AUDIO_ON/OFF - 120 + ); + } + + void DgusTFT::toggle_audio() { + lcd_info.audio_on = !lcd_info.audio_on; + goto_system_page(); + LcdAudioSet(lcd_info.audio_on); + } + + void DgusTFT::store_changes() { + if (lcd_info_back.language != lcd_info.language || lcd_info_back.audio_on != lcd_info.audio_on) { + lcd_info_back = lcd_info; + injectCommands(F("M500")); + } + } + + #if HAS_HOTEND + void DgusTFT::send_temperature_hotend(uint32_t addr) { + char str_buf[16]; + sprintf(str_buf, "%u/%u", uint16_t(getActualTemp_celsius(E0)), uint16_t(getTargetTemp_celsius(E0))); + SendTxtToTFT(str_buf, addr); + } + #endif + + #if HAS_HEATED_BED + void DgusTFT::send_temperature_bed(uint32_t addr) { + char str_buf[16]; + sprintf(str_buf, "%u/%u", uint16_t(getActualTemp_celsius(BED)), uint16_t(getTargetTemp_celsius(BED))); + SendTxtToTFT(str_buf, addr); + } + #endif + + void DgusTFT::page1() { + #if ACDEBUG(AC_ALL) + if (page_index_saved != page_index_now || key_value_saved != key_value) { + DEBUG_ECHOLNPGM("page1 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: { // main page, print + lcd_txtbox_page = 0; + if (lcd_txtbox_index) { + set_descript_color(COLOR_BLUE); + lcd_txtbox_index = 0; + } + ChangePageOfTFT(PAGE_FILE); + SendFileList(0); + } break; + + case 2: { // tool + ChangePageOfTFT(PAGE_TOOL); + #if ENABLED(CASE_LIGHT_ENABLE) + SendValueToTFT(getCaseLightState(), ADDRESS_SYSTEM_LED_STATUS); + #endif + } break; + + case 3: // prepare + ChangePageOfTFT(PAGE_PREPARE); + break; + + case 4: // system + goto_system_page(); + break; + } + + #if 0 + if (message_index < 30) { + SendTxtToTFT(p_mesage[message_index], TXT_MAIN_MESSAGE); + message_index = 30; + } + #endif + + #if HAS_HOTEND || HAS_HEATED_BED + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PREHEAT_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PREHEAT_BED)); + #endif + } + + void DgusTFT::page2() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page2 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + char file_index = 0; + + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_MAIN); + set_descript_color(COLOR_BLUE); + break; + + case 2: // page up + if (lcd_txtbox_page > 0) { + lcd_txtbox_page--; + + set_descript_color(COLOR_BLUE); + lcd_txtbox_index = 0; + + SendFileList(lcd_txtbox_page * 5); + } + break; + + case 3: // page down + if ((lcd_txtbox_page + 1) * 5 < filenavigator.getFileNum()) { + lcd_txtbox_page++; + + set_descript_color(COLOR_BLUE); + lcd_txtbox_index = 0; + + SendFileList(lcd_txtbox_page * 5); + } + break; + + case 4: // page refresh + if (!isMediaInserted()) safe_delay(500); + + filenavigator.reset(); + + lcd_txtbox_page = 0; + if (lcd_txtbox_index) { + set_descript_color(COLOR_BLUE); + lcd_txtbox_index = 0; + } + SendFileList(lcd_txtbox_index); + break; + + case 5: // resume of outage(last power off) + #if ACDEBUG(AC_MARLIN) + DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + #endif + if (lcd_txtbox_index > 0 && lcd_txtbox_index < 6) { // 1~5 + + if (filenavigator.filelist.seek(lcd_txtbox_page * 5 + (lcd_txtbox_index - 1))) { + + set_descript_color(COLOR_BLUE); + + TERN_(CASE_LIGHT_ENABLE, setCaseLightState(true)); + + char str_buf[20]; + strncpy_P(str_buf, filenavigator.filelist.longFilename(), 17); + str_buf[17] = '\0'; + SendTxtToTFT(str_buf, TXT_PRINT_NAME); + + #if ENABLED(POWER_LOSS_RECOVERY) + if (printer_state == AC_printer_resuming_from_power_outage) { + // Need to home here to restore the Z position + //injectCommands_P(AC_cmnd_power_loss_recovery); + //SERIAL_ECHOLNPGM("start resuming from power outage: ", AC_cmnd_power_loss_recovery); + ChangePageOfTFT(PAGE_STATUS2); // show pause + injectCommands(F("M1000")); // home and start recovery + } + #endif + } + } + break; + + case 6: // start print + if (lcd_txtbox_index > 0 && lcd_txtbox_index < 6) { // 1~5 + + if (filenavigator.filelist.seek(lcd_txtbox_page * 5 + lcd_txtbox_index - 1)) { + #if 0 + SERIAL_ECHOLNPGM("start print: ", lcd_txtbox_page * 5 + (lcd_txtbox_index - 1)); + SERIAL_ECHOLNPGM("start print: ", filenavigator.filelist.shortFilename()); + SERIAL_ECHOLNPGM("start print: ", filenavigator.filelist.longFilename()); + #endif + + set_descript_color(COLOR_BLUE); + + // Allows printer to restart the job if we don't want to recover + if (printer_state == AC_printer_resuming_from_power_outage) { + injectCommands(F("M1000 C")); // Cancel recovery + printer_state = AC_printer_idle; + } + + TERN_(CASE_LIGHT_ENABLE, setCaseLightState(true)); + printFile(filenavigator.filelist.shortFilename()); + + char str_buf[20]; + strncpy_P(str_buf, filenavigator.filelist.longFilename(), 17); + str_buf[17] = '\0'; + SendTxtToTFT(str_buf, TXT_PRINT_NAME); + + sprintf(str_buf, "%5.2f", getFeedrate_percent()); + SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + + sprintf(str_buf, "%u", uint16_t(getProgress_percent())); + SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + + uint32_t time = 0; + sprintf(str_buf, "%s H ", utostr3(time / 60)); + sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); + SendTxtToTFT(str_buf, TXT_PRINT_TIME); + + ChangePageOfTFT(PAGE_STATUS2); + } + } + break; + + case 7: // txtbox 1 click + case 8: // txtbox 2 click + case 9: // txtbox 3 click + case 10: // txtbox 4 click + + case 11: { // txtbox 5 click + static uint8_t lcd_txtbox_index_last = 0; + + lcd_txtbox_index = key_value - 6; + + // lcd_txtbox_page 0~... + // lcd_txtbox_index 1~5 + file_index = lcd_txtbox_page * 5 + (lcd_txtbox_index - 1); + if (file_index < filenavigator.getFileNum()) { + + set_descript_color(COLOR_RED); + + if (lcd_txtbox_index_last && lcd_txtbox_index_last != lcd_txtbox_index) // 1~5 + set_descript_color(COLOR_BLUE, lcd_txtbox_index_last); + lcd_txtbox_index_last = lcd_txtbox_index; + } + } break; + } + } + + void DgusTFT::page3() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page3 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + static millis_t flash_time = 0; + const millis_t ms = millis(); + char str_buf[20]; + static uint8_t progress_last = 0; + + switch (key_value) { + case 0: break; + + case 1: // return + if (!isPrintingFromMedia()) // only idle status can return + ChangePageOfTFT(PAGE_FILE); + break; + + case 2: // resume print + #if ACDEBUG(AC_MARLIN) + DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + DEBUG_PRINT_PAUSED_STATE(F("pause_state :"), pause_state); + #endif + if ( pause_state == AC_paused_idle + || pause_state == AC_paused_filament_lack + || printer_state == AC_printer_resuming_from_power_outage + ) { + printer_state = AC_printer_idle; + pause_state = AC_paused_idle; + resumePrint(); + ChangePageOfTFT(PAGE_STATUS2); // show pause print + flash_time = ms + 1500; + } + else + setUserConfirmed(); + break; + + case 3: // print stop + if (isPrintingFromMedia()) + ChangePageOfTFT(PAGE_STOP_CONF); + break; + + case 4: // print change param + ChangePageOfTFT(PAGE_ADJUST); + TERN_(CASE_LIGHT_ENABLE, SendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS)); + TERN_(HAS_HOTEND, SendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_ADJUST_HOTEND)); + TERN_(HAS_HEATED_BED, SendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_ADJUST_BED)); + feedrate_back = getFeedrate_percent(); + SendValueToTFT(uint16_t(feedrate_back), TXT_ADJUST_SPEED); + flash_time = ms + 1500; + break; + } + + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + if (feedrate_back != getFeedrate_percent()) { + if (getFeedrate_percent() != 0) + sprintf(str_buf, "%5.2f", getFeedrate_percent()); + else + sprintf(str_buf, "%d", feedrate_back); + + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("print speed: ", str_buf); + DEBUG_ECHOLNPGM("feedrate_back: ", feedrate_back); + #endif + SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + feedrate_back = getFeedrate_percent(); + } + + if (progress_last != getProgress_percent()) { + sprintf(str_buf, "%u", getProgress_percent()); + SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + progress_last = getProgress_percent(); + } + + // Get Printing Time + uint32_t time = getProgress_seconds_elapsed() / 60; + sprintf(str_buf, "%s H ", utostr3(time / 60)); + sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); + SendTxtToTFT(str_buf, TXT_PRINT_TIME); + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PRINT_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PRINT_BED)); + } + + void DgusTFT::page4() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page4 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + char str_buf[20]; + static uint8_t progress_last = 0; + + switch (key_value) { + case 0: break; + + case 1: // return + if (!isPrintingFromMedia()) // only is idle status can return + ChangePageOfTFT(PAGE_FILE); + break; + + case 2: // print pause + if (isPrintingFromMedia()) { + pausePrint(); + printer_state = AC_printer_pausing; + pause_state = AC_paused_idle; + ChangePageOfTFT(PAGE_WAIT_PAUSE); + //injectCommands(F("M108")); // stop waiting temperature M109 + } + break; + + case 3: // print stop + if (isPrintingFromMedia()) + ChangePageOfTFT(PAGE_STOP_CONF); + break; + + case 4: // print settings + ChangePageOfTFT(PAGE_ADJUST); + TERN_(CASE_LIGHT_ENABLE, SendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS)); + TERN_(HAS_HOTEND, SendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_ADJUST_HOTEND)); + TERN_(HAS_HEATED_BED, SendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_ADJUST_BED)); + feedrate_back = getFeedrate_percent(); + SendValueToTFT((uint16_t)feedrate_back, TXT_ADJUST_SPEED); + TERN_(HAS_FAN, SendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_TARGET)); + str_buf[0] = 0; + strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 3); + SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + RequestValueFromTFT(TXT_ADJUST_SPEED); // attempt to make feedrate visible on visit to this page + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + if (feedrate_back != getFeedrate_percent()) { + if (getFeedrate_percent() != 0) + sprintf(str_buf, "%5.2f", getFeedrate_percent()); + else + sprintf(str_buf, "%d", feedrate_back); + + SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + feedrate_back = getFeedrate_percent(); + } + + if (progress_last != getProgress_percent()) { + sprintf(str_buf, "%u", getProgress_percent()); + SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + progress_last = getProgress_percent(); + } + + uint32_t time = getProgress_seconds_elapsed() / 60; + sprintf(str_buf, "%s H ", utostr3(time / 60)); + sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); + SendTxtToTFT(str_buf, TXT_PRINT_TIME); + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PRINT_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PRINT_BED)); + } + + void DgusTFT::page5() { // print settings + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page5 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + static bool z_change = false; + + switch (key_value) { + case 0: break; + + case 1: // return + if (AC_printer_printing == printer_state) + ChangePageOfTFT(PAGE_STATUS2); // show pause + else if (AC_printer_paused == printer_state) + ChangePageOfTFT(PAGE_STATUS1); // show print + break; + + #if ENABLED(MESH_EDIT_MENU) + + case 2: { // - + float z_off = getZOffset_mm(); + //SERIAL_ECHOLNPGM("z_off: ", z_off); + //setSoftEndstopState(false); + if (z_off <= -5) return; + z_off -= 0.05f; + setZOffset_mm(z_off); + + char str_buf[10]; + str_buf[0] = 0; + strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); + SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + + //if (isAxisPositionKnown(Z)) { // Move Z axis + // SERIAL_ECHOLNPGM("Z now:", getAxisPosition_mm(Z)); + // const float currZpos = getAxisPosition_mm(Z); + // setAxisPosition_mm(currZpos-0.05, Z); + // SERIAL_ECHOLNPGM("Z now:", getAxisPosition_mm(Z)); + //} + + #if ENABLED(BABYSTEPPING) + int16_t steps = mmToWholeSteps(-0.05, Z); + babystepAxis_steps(steps, Z); + #endif + + GRID_LOOP(x, y) { + const xy_uint8_t pos { x, y }; + const float currval = getMeshPoint(pos); + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("x: ", x, " y: ", y, " z: ", currval); + #endif + setMeshPoint(pos, constrain(currval - 0.05f, AC_LOWEST_MESHPOINT_VAL, 5)); + } + + z_change = true; + + //setSoftEndstopState(true); + } break; + + case 3: { // + + float z_off = getZOffset_mm(); + //SERIAL_ECHOLNPGM("z_off: ", z_off); + //setSoftEndstopState(false); + + if (z_off >= 5) return; + z_off += 0.05f; + setZOffset_mm(z_off); + + char str_buf[10]; + str_buf[0] = '\0'; + strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); + SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + + //int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z); + + /* + if (isAxisPositionKnown(Z)) { // Move Z axis + SERIAL_ECHOLNPGM("Z now:", getAxisPosition_mm(Z)); + const float currZpos = getAxisPosition_mm(Z); + setAxisPosition_mm(currZpos-0.05, Z); + SERIAL_ECHOLNPGM("Z now:", getAxisPosition_mm(Z)); + } + */ + + #if ENABLED(BABYSTEPPING) + int16_t steps = mmToWholeSteps(0.05, Z); + babystepAxis_steps(steps, Z); + #endif + + GRID_LOOP(x, y) { + const xy_uint8_t pos { x, y }; + const float currval = getMeshPoint(pos); + //SERIAL_ECHOLNPGM("x: ", x, " y: ", y, " z: ", currval); + setMeshPoint(pos, constrain(currval + 0.05f, AC_LOWEST_MESHPOINT_VAL, 5)); + } + + z_change = true; + + //setSoftEndstopState(true); + } break; + + #endif // MESH_EDIT_MENU + + #if ENABLED(CASE_LIGHT_ENABLE) + case 4: { // light control + const bool cls = !getCaseLightState(); + SendValueToTFT(cls, ADDRESS_PRINT_SETTING_LED_STATUS); + setCaseLightState(cls); + } break; + #endif + + case 5: + ChangePageOfTFT(PAGE_DONE); + break; + + case 6: break; + + case 7: + TERN_(HAS_HEATED_BED, RequestValueFromTFT(TXT_ADJUST_BED)); + RequestValueFromTFT(TXT_ADJUST_SPEED); + TERN_(HAS_HOTEND, RequestValueFromTFT(TXT_ADJUST_HOTEND)); + TERN_(HAS_FAN, RequestValueFromTFT(TXT_FAN_SPEED_TARGET)); + + if (z_change == true) { + injectCommands(F("M500")); + z_change = false; + } + + if (AC_printer_printing == printer_state) + ChangePageOfTFT(PAGE_STATUS2); // show pause + else if (AC_printer_paused == printer_state) + ChangePageOfTFT(PAGE_STATUS1); // show print + + break; + } + } + + void DgusTFT::page6() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page6 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + case 1: break; + } + } + + void DgusTFT::page7() { // tools + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page7 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_MAIN); + break; + + case 2: + ChangePageOfTFT(PAGE_MOVE); + break; + + case 3: // set temperature + ChangePageOfTFT(PAGE_TEMP); + #if HAS_HOTEND + SendValueToTFT(uint16_t(getActualTemp_celsius(E0)), TXT_HOTEND_NOW); + SendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_HOTEND_TARGET); + #endif + #if HAS_HEATED_BED + SendValueToTFT(uint16_t(getActualTemp_celsius(BED)), TXT_BED_NOW); + SendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_BED_TARGET); + #endif + break; + + case 4: + ChangePageOfTFT(PAGE_SPEED); + #if HAS_FAN + SendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_NOW); + SendValueToTFT(uint16_t(getTargetFan_percent(FAN0)), TXT_FAN_SPEED_TARGET); + #endif + SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_TARGET); + break; + + case 5: // turn off the xyz motor + if (!isMoving()) + stepper.disable_all_steppers(); + break; + + #if ENABLED(CASE_LIGHT_ENABLE) + case 6: { // light control + const bool cls = !getCaseLightState(); + SendValueToTFT(cls, ADDRESS_SYSTEM_LED_STATUS); + setCaseLightState(cls); + } break; + #endif + } + } + + void DgusTFT::page8() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page8 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + //static uint16_t movespeed = 50; + static float move_dis = 1.0f; + + if (key_value == 2 || key_value == 4 + || key_value == 6 || key_value == 8 + || key_value == 10 || (key_value == 12 && !isMoving()) + ) { + if (getAxisPosition_mm(Z) < 0) setAxisPosition_mm(0, Z, 8); + } + + // if (!planner.movesplanned())return; + switch (key_value) { + case 0: + break; + + case 1: // return + ChangePageOfTFT(PAGE_TOOL); + break; + + case 5: + if (!isMoving()) + injectCommands(F("G28 X")); + break; + + case 9: + if (!isMoving()) + injectCommands(F("G28 Y")); + break; + + case 13: + if (!isMoving()) + injectCommands(F("G28 Z")); + break; + + case 17: + if (!isMoving()) + injectCommands(F("G28")); + break; + + case 2: // X- + if (!isMoving()) + setAxisPosition_mm(getAxisPosition_mm(X) - move_dis, X, 50); + break; + + case 4: // X+ + if (!isMoving()) + setAxisPosition_mm(getAxisPosition_mm(X) + move_dis, X, 50); + break; + + case 6: // Y+ + if (!isMoving()) + setAxisPosition_mm(getAxisPosition_mm(Y) - move_dis, Y, 50); + break; + + case 8: // Y- + if (!isMoving()) + setAxisPosition_mm(getAxisPosition_mm(Y) + move_dis, Y, 50); + break; + + case 10: // Z- + if (!isMoving()) + setAxisPosition_mm(getAxisPosition_mm(Z) - move_dis, Z, 8); + break; + + case 12: // Z+ + if (!isMoving()) + setAxisPosition_mm(getAxisPosition_mm(Z) + move_dis, Z, 8); + break; + + case 3: + move_dis = 0.1f; + SendValueToTFT(1, ADDRESS_MOVE_DISTANCE); + break; + + case 7: + move_dis = 1.0f; + SendValueToTFT(2, ADDRESS_MOVE_DISTANCE); + break; + + case 11: + move_dis = 10.0f; + SendValueToTFT(3, ADDRESS_MOVE_DISTANCE); + break; + + //case 14: + // movespeed = 3000; //SERIAL_ECHOLN(movespeed); + // break; + // + //case 15: + // movespeed = 2000; //SERIAL_ECHOLN(movespeed); + // break; + // + //case 16: + // movespeed = 1000; //SERIAL_ECHOLN(movespeed); + // break; + } + } + + void DgusTFT::page9() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page9 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_TOOL); + break; + + case 2: break; + case 3: break; + case 4: break; + case 5: break; + + case 6: // cooling + setTargetTemp_celsius(0, E0); + setTargetTemp_celsius(0, BED); + ChangePageOfTFT(PAGE_TOOL); + break; + + case 7: // send target temp + RequestValueFromTFT(TXT_HOTEND_TARGET); + RequestValueFromTFT(TXT_BED_TARGET); + ChangePageOfTFT(PAGE_TOOL); + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + SendValueToTFT(uint16_t(getActualTemp_celsius(E0)), TXT_HOTEND_NOW); + SendValueToTFT(uint16_t(getActualTemp_celsius(BED)), TXT_BED_NOW); + } + + void DgusTFT::page10() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page10 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: // return + ChangePageOfTFT(PAGE_TOOL); + break; + + case 2: break; + case 3: break; + case 4: break; + case 5: break; + + case 6: // ok + RequestValueFromTFT(TXT_FAN_SPEED_TARGET); + RequestValueFromTFT(TXT_PRINT_SPEED_TARGET); + ChangePageOfTFT(PAGE_TOOL); + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + SendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_NOW); + SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + } + + void DgusTFT::page11() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page11 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_MAIN); + store_changes(); + break; + + case 2: // language + toggle_language(); + goto_system_page(); + break; + + case 3: break; + + case 4: // audio + toggle_audio(); + break; + + case 5: { // about + char str_ver[32]; + //sprintf(str_ver, "%04d-%02d-%02d %02d:%02d:%02d\n", BUILD_YEAR, BUILD_MONTH, BUILD_DAY, BUILD_HOUR, BUILD_MIN, BUILD_SEC); + sprintf(str_ver, MAIN_BOARD_FIRMWARE_VER); + SendTxtToTFT(str_ver, TXT_VERSION); + ChangePageOfTFT(PAGE_ABOUT); + } break; + + case 6: + ChangePageOfTFT(PAGE_RECORD); + break; + } + } + + void DgusTFT::page12() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page12 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + case 1: // return + ChangePageOfTFT(PAGE_SYSTEM_CHS_AUDIO_ON); + break; + } + } + + void DgusTFT::page13() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page13 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + + case 1: // return + goto_system_page(); + break; + + case 2: break; + } + } + + void DgusTFT::page14() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page14 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + case 1: break; // return + case 2: break; + case 3: break; + case 4: break; + } + } + + void DgusTFT::page15() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page15 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_MAIN); + break; + + case 2: + ChangePageOfTFT(PAGE_PreLEVEL); + break; + + #if HAS_HOTEND || HAS_HEATED_BED + case 3: { + ChangePageOfTFT(PAGE_PREHEAT); + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PREHEAT_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PREHEAT_BED)); + } break; + #endif + + #if HAS_EXTRUDERS + case 4: { + send_temperature_hotend(TXT_FILAMENT_TEMP); + ChangePageOfTFT(PAGE_FILAMENT); + } break; + #endif + } + } + + void DgusTFT::page16() { // AUTO LEVELING + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page16 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + case 1: // return + ChangePageOfTFT(PAGE_PREPARE); + break; + + case 2: + if (!isPrinting()) { + //ChangePageOfTFT(PAGE_LEVEL_ENSURE); + ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK); + } + break; + + case 3: { + char str_buf[10]; + str_buf[0] = '\0'; + strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); + SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + ChangePageOfTFT(PAGE_LEVEL_ADVANCE); + } break; + + case 4: + ChangePageOfTFT(PAGE_AUTO_OFFSET); + break; + } + } + + void DgusTFT::page17() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page17 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + float z_off; + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_PreLEVEL); + break; + + case 2: { + setSoftEndstopState(false); + if (getZOffset_mm() <= -5) return; + z_off = getZOffset_mm() - 0.01f; + setZOffset_mm(z_off); + + char str_buf[10]; + strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); + SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + + if (isAxisPositionKnown(Z)) { + const float currZpos = getAxisPosition_mm(Z); + setAxisPosition_mm(currZpos - 0.01f, Z); + } + + setSoftEndstopState(true); + } break; + + case 3: { + setSoftEndstopState(false); + if (getZOffset_mm() >= 5) return; + z_off = getZOffset_mm() + 0.01f; + setZOffset_mm(z_off); + + char str_buf[10]; + strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); + SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + + if (isAxisPositionKnown(Z)) { // Move Z axis + const float currZpos = getAxisPosition_mm(Z); + setAxisPosition_mm(currZpos + 0.01f, Z); + } + + setSoftEndstopState(true); + } break; + + case 4: + #if ACDEBUG(AC_MARLIN) + DEBUG_ECHOLNPGM("z off: ", ftostr52sprj(getZOffset_mm())); + #endif + #if HAS_LEVELING + GRID_LOOP(x, y) { + const xy_uint8_t pos { x, y }; + const float currval = getMeshPoint(pos); + setMeshPoint(pos, constrain(currval + getZOffset_mm(), AC_LOWEST_MESHPOINT_VAL, 5)); + } + injectCommands(F("M500")); + #endif + ChangePageOfTFT(PAGE_PREPARE); + break; + } + } + + #if HAS_HOTEND || HAS_HEATED_BED + + void DgusTFT::page18() { // preheat + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page18 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(PAGE_PREPARE); + break; + + case 2: // PLA + TERN_(HAS_HOTEND, setTargetTemp_celsius(190, E0)); + TERN_(HAS_HEATED_BED, setTargetTemp_celsius(60, BED)); + ChangePageOfTFT(PAGE_PREHEAT); + break; + + case 3: // ABS + TERN_(HAS_HOTEND, setTargetTemp_celsius(240, E0)); + TERN_(HAS_HEATED_BED, setTargetTemp_celsius(100, BED)); + ChangePageOfTFT(PAGE_PREHEAT); + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PREHEAT_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PREHEAT_BED)); + } + + #endif // HAS_HOTEND || HAS_HEATED_BED + + #if HAS_EXTRUDERS + + void DgusTFT::page19() { // Filament + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page19 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + static char filament_status = 0; + static millis_t flash_time = 0; + switch (key_value) { + case 0: break; + + case 1: // return + filament_status = 0; + injectCommands(F("G90")); + ChangePageOfTFT(PAGE_PREPARE); + break; + + case 2: // Filament in + if (getActualTemp_celsius(E0) < 220) { + filament_status = 0; + ChangePageOfTFT(PAGE_FILAMENT_HEAT); + } + else { + filament_status = 1; + injectCommands(F("G91")); + } + break; + + case 3: // filament out + if (getActualTemp_celsius(E0) < 220) { + filament_status = 0; + ChangePageOfTFT(PAGE_FILAMENT_HEAT); + } + else { + filament_status = 2; + injectCommands(F("G91")); + } + break; + + case 4: // stop + filament_status = 0; + break; + + } + + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + send_temperature_hotend(TXT_FILAMENT_TEMP); + + if (!isPrinting()) { + if (filament_status == 1) { + if (canMove(E0) && !commandsInQueue()) + injectCommands_P(AC_cmnd_manual_load_filament); + } + else if (filament_status == 2) { + if (canMove(E0) && !commandsInQueue()) + injectCommands_P(AC_cmnd_manual_unload_filament); + } + } + } + + #endif // HAS_EXTRUDERS + + void DgusTFT::page20() { // confirm + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page20 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: // return + ChangePageOfTFT(page_index_last); + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page21() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page21 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + ChangePageOfTFT(page_index_last); + break; + + case 2: break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page22() { // print finish + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page22 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // OK to finish + TERN_(CASE_LIGHT_ENABLE, setCaseLightState(false)); + ChangePageOfTFT(PAGE_MAIN); + break; + + case 2: break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page23() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page23 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: ChangePageOfTFT(page_index_last); break; // return + case 2: ChangePageOfTFT(page_index_last); break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page24() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page24 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: ChangePageOfTFT(page_index_last); break; // return + case 2: ChangePageOfTFT(page_index_last); break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page25() { // lack filament + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page25 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + #if ACDEBUG(AC_MARLIN) + DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state); + #endif + if (AC_printer_printing == printer_state) + ChangePageOfTFT(PAGE_STATUS2); // show pause + else if (AC_printer_paused == printer_state) { + //injectCommands(F("M108")); + ChangePageOfTFT(PAGE_STATUS1); // show resume + } + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page26() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page26 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: ChangePageOfTFT(page_index_last); break; // return + case 2: break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page27() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page27 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // print stop confirmed + if (isPrintingFromMedia()) { + printer_state = AC_printer_stopping; + stopPrint(); + message_index = 6; + ChangePageOfTFT(PAGE_MAIN); + } + else { + if (printer_state == AC_printer_resuming_from_power_outage) + injectCommands(F("M1000 C")); // Cancel recovery + printer_state = AC_printer_idle; + } + break; + + case 2: // return + if (AC_printer_printing == printer_state) + ChangePageOfTFT(PAGE_STATUS2); // show pause + else if (AC_printer_paused == printer_state) + ChangePageOfTFT(PAGE_STATUS1); // show print + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page28() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page28 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: ChangePageOfTFT(page_index_last); break; // return + case 2: break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page29() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page29 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + TERN_(CASE_LIGHT_ENABLE, setCaseLightState(false)); + ChangePageOfTFT(PAGE_MAIN); + break; + + case 2: break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page30() { // Auto heat filament + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page30 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // return + setTargetTemp_celsius(230, E0); + ChangePageOfTFT(PAGE_FILAMENT); + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page31() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page31 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + case 0: break; + case 1: break; // return + case 2: break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page32() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page32 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + #if HAS_LEVELING + + void DgusTFT::page33() { + #if ACDEBUG(AC_ALL) + if (page_index_saved != page_index_now) { + DEBUG_ECHOLNPGM("page33 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + } + #endif + + switch (key_value) { + case 0: break; + + case 1: // auto leveling start + injectCommands(F("G28\nG29")); + printer_state = AC_printer_probing; + + // this will cause leveling->preheating->leveling + #if 0 + #if ENABLED(PREHEAT_BEFORE_LEVELING) + if (getTargetTemp_celsius(E0) < LEVELING_NOZZLE_TEMP + || getTargetTemp_celsius(BED) < LEVELING_BED_TEMP + ) { + setTargetTemp_celsius(LEVELING_NOZZLE_TEMP, E0); + setTargetTemp_celsius(LEVELING_BED_TEMP, BED); + ChangePageOfTFT(PAGE_CHS_PROBE_PREHEATING); + } + else + ChangePageOfTFT(PAGE_LEVELING); + + #else + ChangePageOfTFT(PAGE_LEVELING); + #endif + #endif + + ChangePageOfTFT(PAGE_LEVELING); + break; + + case 2: + ChangePageOfTFT(PAGE_PreLEVEL); + break; + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + } + + void DgusTFT::page34() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page34 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + #if HAS_HOTEND || HAS_HEATED_BED + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_MAIN_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_MAIN_BED)); + #endif + + if (pop_up_index == 25) { + pop_up_index = 100; + ChangePageOfTFT(PAGE_PreLEVEL); + } + } + + #endif // HAS_LEVELING + + void DgusTFT::page115() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page115 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + switch (key_value) { + + case 0: break; + case 1: ChangePageOfTFT(PAGE_PreLEVEL); break; + + case 2: { + injectCommands(F("M1024 S3")); // -1 + //char value[20] + //sprintf_P(value, PSTR("G1 Z%iF%i")); enqueue_and_echo_command_now(value); } + } break; + + case 3: injectCommands(F("M1024 S4")); break; // 1 + case 4: injectCommands(F("M1024 S1")); break; // -0.1 + case 5: injectCommands(F("M1024 S2")); break; // 0.1 + case 6: injectCommands(F("M1024 S0")); break; // prepare, move x y to center + case 7: injectCommands(F("M1024 S5")); break; // 0.1 + } + + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1000; + } + + void DgusTFT::page117() { // Page CHS Mute handler + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page117 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + + case 1: + ChangePageOfTFT(PAGE_MAIN); + store_changes(); + break; + + case 2: // language + toggle_language(); + goto_system_page(); + break; + + case 3: break; + + case 4: // audio + toggle_audio(); + break; + + case 5: // about + char str_ver[32]; + //sprintf(str_ver, "%04d-%02d-%02d %02d:%02d:%02d\n", BUILD_YEAR, BUILD_MONTH, BUILD_DAY, BUILD_HOUR, BUILD_MIN, BUILD_SEC); + sprintf(str_ver, MAIN_BOARD_FIRMWARE_VER); + SendTxtToTFT(str_ver, TXT_VERSION); + ChangePageOfTFT(PAGE_ABOUT); + break; + + case 6: + ChangePageOfTFT(PAGE_RECORD); + break; + } + } + + void DgusTFT::page124() { // first time into page 124 the feedrate percent is not set + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page124 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + //DEBUG_ECHOLNPGM("update feedrate percent"); + } + #endif + SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + } + + void DgusTFT::page125() { // first time into page 125 the feedrate percent is not set + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page125 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + //DEBUG_ECHOLNPGM("update feedrate percent"); + } + #endif + SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + } + + void DgusTFT::page170() { // ENG Mute handler + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page170 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 0: break; + + case 1: + ChangePageOfTFT(PAGE_MAIN); + store_changes(); + break; + + case 2: // language + toggle_language(); + goto_system_page(); + break; + + case 3: break; + + case 4: // audio + toggle_audio(); + break; + + case 5: // about + char str_ver[32]; + //sprintf(str_ver, "%04d-%02d-%02d %02d:%02d:%02d\n", BUILD_YEAR, BUILD_MONTH, BUILD_DAY, BUILD_HOUR, BUILD_MIN, BUILD_SEC); + sprintf(str_ver, MAIN_BOARD_FIRMWARE_VER); + SendTxtToTFT(str_ver, TXT_VERSION); + ChangePageOfTFT(PAGE_ABOUT); + break; + + case 6: + ChangePageOfTFT(PAGE_RECORD); + break; + } + } + + #if ENABLED(POWER_LOSS_RECOVERY) + + void DgusTFT::page171() { // CHS power outage resume handler + #if ACDEBUG(AC_ALL) + if (page_index_saved != page_index_now) { + DEBUG_ECHOLNPGM("page171 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + } + #endif + #if ENABLED(LONG_FILENAME_HOST_SUPPORT) + char filename[64] = { '\0' }; + #endif + + switch (key_value) { + case 0: break; + + case 1: { // resume + ChangePageOfTFT(PAGE_OUTAGE_RECOVERY); + #if ENABLED(LONG_FILENAME_HOST_SUPPORT) + card.getLongPath(filename, recovery.info.sd_filename); + filename[17] = '\0'; + SendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); + #else + SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); + #endif + + char str_buf[20] = { '\0' }; + sprintf(str_buf, "%u", uint16_t(getFeedrate_percent())); + SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + + sprintf(str_buf, "%u", uint16_t(getProgress_percent())); + SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + + ChangePageOfTFT(PAGE_STATUS2); // show pause + injectCommands(F("M355 S1\nM1000")); // case light on, home and start recovery + } break; + + case 2: // cancel + printer_state = AC_printer_idle; + ChangePageOfTFT(PAGE_MAIN); + injectCommands(F("M355 S0\nM1000 C")); // cancel recovery + break; + } + } + + void DgusTFT::page173() { // ENG power outage resume handler + #if ACDEBUG(AC_ALL) + if (page_index_saved != page_index_now) { + DEBUG_ECHOLNPGM("page173 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + } + #endif + #if ENABLED(LONG_FILENAME_HOST_SUPPORT) + char filename[64] = { '\0' }; + #endif + + switch (key_value) { + case 0: break; + + case 1: { // resume + ChangePageOfTFT(PAGE_OUTAGE_RECOVERY); + #if ENABLED(LONG_FILENAME_HOST_SUPPORT) + card.getLongPath(filename, recovery.info.sd_filename); + filename[17] = '\0'; + SendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); + #else + SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); + #endif + + char str_buf[20] = { '\0' }; + sprintf(str_buf, "%u", uint16_t(getFeedrate_percent())); + SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + + sprintf(str_buf, "%u", uint16_t(getProgress_percent())); + SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + + ChangePageOfTFT(PAGE_STATUS2); // show pause + injectCommands(F("M355 S1\nM1000")); // case light on, home and start recovery + } break; + + case 2: // cancel + printer_state = AC_printer_idle; + ChangePageOfTFT(PAGE_MAIN); + injectCommands(F("M355 S0\nM1000 C")); // cancel recovery + break; + } + } + + #endif // POWER_LOSS_RECOVERY + + #if HAS_LEVELING + + void DgusTFT::page175() { // CHS probe preheating handler + #if ACDEBUG(AC_ALL) + if (page_index_saved != page_index_now) { + DEBUG_ECHOLNPGM("page175 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + } + #endif + + #if HAS_HOTEND || HAS_HEATED_BED + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_MAIN_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_MAIN_BED)); + #endif + } + + void DgusTFT::page176() { // ENG probe preheating handler + #if ACDEBUG(AC_ALL) + if (page_index_saved != page_index_now) { + DEBUG_ECHOLNPGM("page176 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + } + #endif + + #if HAS_HOTEND || HAS_HEATED_BED + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_MAIN_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_MAIN_BED)); + #endif + } + + #endif // HAS_LEVELING + + void DgusTFT::page177_to_198() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page177_to_198 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 1: // return + #if ACDEBUG(AC_MARLIN) + //DEBUG_ECHOLNPGM("page_index_now: ", page_index_now); + //DEBUG_ECHOLNPGM("page_index_last: ", page_index_last); + //DEBUG_ECHOLNPGM("page_index_last_2: ", page_index_last_2); + #endif + + if ((WITHIN(page_index_now, PAGE_CHS_ABNORMAL_X_ENDSTOP, PAGE_CHS_ABNORMAL_Z_ENDSTOP)) + || (WITHIN(page_index_now, PAGE_ENG_ABNORMAL_X_ENDSTOP, PAGE_ENG_ABNORMAL_Z_ENDSTOP)) + ) { + if (lcd_info.language == ENG) { + if (page_index_last_2 > 120) page_index_last_2 -= 120; + if (page_index_last > 120) page_index_last -= 120; + } + + if (PAGE_STATUS1 == page_index_last_2 || PAGE_STATUS2 == page_index_last_2 || PAGE_PRINT_FINISH == page_index_last) + ChangePageOfTFT(PAGE_MAIN); + else + ChangePageOfTFT(page_index_last_2); + } + else { + if (lcd_info.language == ENG && page_index_last > 120) + page_index_last -= 120; + ChangePageOfTFT(page_index_last); + } + + onSurviveInKilled(); + stepper.disable_all_steppers(); + break; + + default: break; + } + } + + #if 0 + void DgusTFT::page178_to_181_190_to_193() { // temperature abnormal + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page178_to_181_190_to_193 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 1: // return + SERIAL_ECHOLNPGM("page_index_now: ", page_index_now); + SERIAL_ECHOLNPGM("page_index_last: ", page_index_last); + SERIAL_ECHOLNPGM("page_index_last_2: ", page_index_last_2); + + if (isPrinting() || isPrintingPaused() || isPrintingFromMedia()) { + printer_state = AC_printer_stopping; + stopPrint(); + ChangePageOfTFT(PAGE_MAIN); + } + else + ChangePageOfTFT(page_index_last); + + onSurviveInKilled(); + break; + + default: break; + } + } + #endif + + void DgusTFT::page199_to_200() { + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page199_to_200 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now, " key: ", key_value); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + switch (key_value) { + case 1: // return + #if ACDEBUG(AC_MARLIN) + //DEBUG_ECHOLNPGM("page_index_now: ", page_index_now); + //DEBUG_ECHOLNPGM("page_index_last: ", page_index_last); + //DEBUG_ECHOLNPGM("page_index_last_2: ", page_index_last_2); + #endif + onSurviveInKilled(); + ChangePageOfTFT(PAGE_PreLEVEL); + break; + + default: break; + } + } + + inline void ProbeTare() { + #if PIN_EXISTS(AUTO_LEVEL_TX) + OUT_WRITE(AUTO_LEVEL_TX_PIN, LOW); + delay(300); + OUT_WRITE(AUTO_LEVEL_TX_PIN, HIGH); + delay(100); + #endif + } + + inline bool getProbeState() { return PROBE_TRIGGERED(); } + + void DgusTFT::page201() { // probe precheck + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page201 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + static millis_t probe_check_time = 0; + static millis_t temperature_time = 0; + static uint8_t probe_check_counter = 0; + static uint8_t probe_state_last = 0; + static bool probe_tare_flag = 0; + + if (!probe_tare_flag) { + ProbeTare(); + + delay(100); + + if (getProbeState()) { // triggered too early + probe_check_counter = 0; + probe_tare_flag = 0; + ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK_FAILED); + } + probe_tare_flag = 1; + } + + switch (key_value) { + case 1: // cancel + probe_check_counter = 0; + probe_tare_flag = 0; + ChangePageOfTFT(PAGE_PreLEVEL); + break; + + default: break; + } + + if (ELAPSED(millis(), probe_check_time)) { + probe_check_time = millis() + 300; + + if (!probe_state_last && getProbeState()) { + probe_check_counter = 0; + probe_tare_flag = 0; + ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK_OK); + } + + probe_state_last = getProbeState(); + + if (probe_check_counter++ >= 200) { // waiting for 1 min + probe_check_counter = 0; + probe_tare_flag = 0; + ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK_FAILED); + } + } + + if (ELAPSED(millis(), temperature_time)) { + temperature_time = millis() + 1500; + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_MAIN_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_MAIN_BED)); + } + } + + void DgusTFT::page202() { // probe precheck ok + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page202 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + + //static millis_t flash_time = 0; + //static millis_t probe_check_counter = 0; + //static uint8_t probe_state_last = 0; + + delay(3000); + + injectCommands(F("G28\nG29")); + printer_state = AC_printer_probing; + ChangePageOfTFT(PAGE_LEVELING); + } + + void DgusTFT::page203() { // probe precheck failed + #if ACDEBUG(AC_ALL) + if ((page_index_saved != page_index_now) || (key_value_saved != key_value)) { + DEBUG_ECHOLNPGM("page203 page_index_last_2: ", page_index_last_2, " page_index_last: ", page_index_last, " page_index_now: ", page_index_now); + page_index_saved = page_index_now; + key_value_saved = key_value; + } + #endif + //static millis_t probe_check_counter = 0; + //static uint8_t probe_state_last = 0; + + #if HAS_HOTEND || HAS_HEATED_BED + static millis_t flash_time = 0; + const millis_t ms = millis(); + if (PENDING(ms, flash_time)) return; + flash_time = ms + 1500; + + TERN_(HAS_HOTEND, send_temperature_hotend(TXT_MAIN_HOTEND)); + TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_MAIN_BED)); + #endif + } + + void DgusTFT::pop_up_manager() { + #if ACDEBUG(AC_ALL) + if (pop_up_index_saved != pop_up_index) { + DEBUG_ECHOLNPGM("pop_up_manager pop_up_index: ", pop_up_index); + pop_up_index_saved = pop_up_index; + } + #endif + + switch (pop_up_index) { + case 10: // T0 error + if (page_index_now != PAGE_ABNORMAL) + ChangePageOfTFT(PAGE_ABNORMAL); + pop_up_index = 100; + break; + + case 15: // filament lack + if (page_index_now != PAGE_FILAMENT_LACK) + ChangePageOfTFT(PAGE_FILAMENT_LACK); + pop_up_index = 100; + break; + + case 16: // stop wait + ChangePageOfTFT(PAGE_WAIT_STOP); + pop_up_index = 100; + break; + + case 18: + ChangePageOfTFT(PAGE_STATUS1); + pop_up_index = 100; + break; + + case 23: // + if (page_index_now != PAGE_FILAMENT_LACK) + ChangePageOfTFT(PAGE_FILAMENT_LACK); + pop_up_index = 100; + break; + + case 24: { // + uint32_t time = getProgress_seconds_elapsed() / 60; + char str_buf[20]; + sprintf(str_buf, "%s H ", utostr3(time / 60)); + sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); + SendTxtToTFT(str_buf, TXT_FINISH_TIME); + ChangePageOfTFT(PAGE_PRINT_FINISH); + //SendtoTFTLN(AC_msg_print_complete); // no idea why this causes a compile error + pop_up_index = 100; + } break; + + case 25: // LEVEL DONE + ChangePageOfTFT(PAGE_PreLEVEL); + pop_up_index = 100; + break; + } + } + + void DEBUG_PRINT_PAUSED_STATE(FSTR_P const msg, paused_state_t state) { + DEBUG_ECHOPGM(msg, state); + switch (state) { + case AC_paused_heater_timed_out: + DEBUG_ECHOLNPGM(" AC_paused_heater_timed_out"); + break; + case AC_paused_filament_lack: + DEBUG_ECHOLNPGM(" AC_paused_filament_lack"); + break; + case AC_paused_purging_filament: + DEBUG_ECHOLNPGM(" AC_paused_purging_filament"); + break; + case AC_paused_idle: + DEBUG_ECHOLNPGM(" AC_paused_idle"); + break; + } + } + +// routines to make the debug outputs human readable + + void DEBUG_PRINT_PRINTER_STATE(FSTR_P const msg, printer_state_t state) { + DEBUG_ECHOPGM(msg, state); + switch (state) { + case AC_printer_idle: + DEBUG_ECHOLNPGM(" AC_printer_idle"); + break; + case AC_printer_probing: + DEBUG_ECHOLNPGM(" AC_printer_probing"); + break; + case AC_printer_printing: + DEBUG_ECHOLNPGM(" AC_printer_printing"); + break; + case AC_printer_pausing: + DEBUG_ECHOLNPGM(" AC_printer_pausing"); + break; + case AC_printer_paused: + DEBUG_ECHOLNPGM(" AC_printer_paused"); + break; + case AC_printer_stopping: + DEBUG_ECHOLNPGM(" AC_printer_stopping"); + break; + case AC_printer_stopping_from_media_remove: + DEBUG_ECHOLNPGM(" AC_printer_stopping_from_media_remove"); + break; + case AC_printer_resuming_from_power_outage: + DEBUG_ECHOLNPGM(" AC_printer_resuming_from_power_outage"); + break; + } + } + + void DEBUG_PRINT_TIMER_EVENT(FSTR_P const msg, timer_event_t event) { + DEBUG_ECHOPGM(msg, event); + switch (event) { + case AC_timer_started: + DEBUG_ECHOLNPGM(" AC_timer_started"); + break; + case AC_timer_paused: + DEBUG_ECHOLNPGM(" AC_timer_paused"); + break; + case AC_timer_stopped: + DEBUG_ECHOLNPGM(" AC_timer_stopped"); + break; + } + } + + void DEBUG_PRINT_MEDIA_EVENT(FSTR_P const msg, media_event_t event) { + DEBUG_ECHOPGM(msg, event); + switch (event) { + case AC_media_inserted: + DEBUG_ECHOLNPGM(" AC_media_inserted"); + break; + case AC_media_removed: + DEBUG_ECHOLNPGM(" AC_media_removed"); + break; + case AC_media_error: + DEBUG_ECHOLNPGM(" AC_media_error"); + break; + } + } + +} // namespace + +#endif // ANYCUBIC_LCD_VYPER diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h new file mode 100644 index 000000000000..1903fa118336 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h @@ -0,0 +1,479 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * lcd/extui/anycubic_vyper/dgus_tft.h + */ + +#include "dgus_tft_defs.h" +#include "../../../inc/MarlinConfigPre.h" +#include "../ui_api.h" + +#define MAIN_BOARD_FIRMWARE_VER "V2.4.5" + +#define DATA_BUF_SIZE 64 + +/****************** PAGE INDEX***********************/ +#define PAGE_OFFSET 0 +#define PAGE_MAIN (1+PAGE_OFFSET) +#define PAGE_FILE (2+PAGE_OFFSET) +#define PAGE_STATUS1 (3+PAGE_OFFSET) // show resume +#define PAGE_STATUS2 (4+PAGE_OFFSET) // show pause +#define PAGE_ADJUST (5+PAGE_OFFSET) +#define PAGE_KEYBPARD (6+PAGE_OFFSET) +#define PAGE_TOOL (7+PAGE_OFFSET) +#define PAGE_MOVE (8+PAGE_OFFSET) +#define PAGE_TEMP (9+PAGE_OFFSET) +#define PAGE_SPEED (10+PAGE_OFFSET) +#define PAGE_SYSTEM_CHS_AUDIO_ON (11+PAGE_OFFSET) +#define PAGE_WIFI (12+PAGE_OFFSET) +#define PAGE_ABOUT (13+PAGE_OFFSET) +#define PAGE_RECORD (14+PAGE_OFFSET) +#define PAGE_PREPARE (15+PAGE_OFFSET) +#define PAGE_PreLEVEL (16+PAGE_OFFSET) +#define PAGE_LEVEL_ADVANCE (17+PAGE_OFFSET) +#define PAGE_PREHEAT (18+PAGE_OFFSET) +#define PAGE_FILAMENT (19+PAGE_OFFSET) + +#define PAGE_DONE (20+PAGE_OFFSET) +#define PAGE_ABNORMAL (21+PAGE_OFFSET) +#define PAGE_PRINT_FINISH (22+PAGE_OFFSET) +#define PAGE_WAIT_STOP (23+PAGE_OFFSET) +#define PAGE_FILAMENT_LACK (25+PAGE_OFFSET) +#define PAGE_FORBIT (26+PAGE_OFFSET) +#define PAGE_STOP_CONF (27+PAGE_OFFSET) +#define PAGE_NO_SD (29+PAGE_OFFSET) +#define PAGE_FILAMENT_HEAT (30+PAGE_OFFSET) +#define PAGE_WAIT_PAUSE (32+PAGE_OFFSET) + +#define PAGE_LEVEL_ENSURE (33+PAGE_OFFSET) +#define PAGE_LEVELING (34+PAGE_OFFSET) + +#define PAGE_AUTO_OFFSET (115+PAGE_OFFSET) + +#define PAGE_SYSTEM_CHS_AUDIO_OFF (117+PAGE_OFFSET) + +#define PAGE_SYSTEM_ENG_AUDIO_ON (131+PAGE_OFFSET) +#define PAGE_SYSTEM_ENG_AUDIO_OFF (170+PAGE_OFFSET) + +#define PAGE_OUTAGE_RECOVERY (171+PAGE_OFFSET) +#define PAGE_ENG_OUTAGE_RECOVERY (173+PAGE_OFFSET) + +#define PAGE_CHS_PROBE_PREHEATING (176+PAGE_OFFSET) +#define PAGE_ENG_PROBE_PREHEATING (175+PAGE_OFFSET) + +#define PAGE_CHS_HOMING (177+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_BED_HEATER (178+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_BED_NTC (179+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_HOTEND_HEATER (180+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_HOTEND_NTC (181+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_ENDSTOP (182+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_X_ENDSTOP (182+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_Y_ENDSTOP (183+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_Z_ENDSTOP (184+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_ZL_ENDSTOP (185+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_ZR_ENDSTOP (186+PAGE_OFFSET) +#define PAGE_CHS_ABNORMAL_LEVELING_SENSOR (187+PAGE_OFFSET) +#define PAGE_CHS_LEVELING_FAILED (188+PAGE_OFFSET) + +#define PAGE_ENG_HOMING (189+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_BED_HEATER (190+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_BED_NTC (191+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_HOTEND_HEATER (192+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_HOTEND_NTC (193+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_ENDSTOP (194+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_X_ENDSTOP (194+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_Y_ENDSTOP (195+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_Z_ENDSTOP (196+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_ZL_ENDSTOP (197+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_ZR_ENDSTOP (198+PAGE_OFFSET) +#define PAGE_ENG_ABNORMAL_LEVELING_SENSOR (199+PAGE_OFFSET) +#define PAGE_ENG_LEVELING_FAILED (200+PAGE_OFFSET) + +#define PAGE_CHS_PROBE_PRECHECK (201+PAGE_OFFSET) +#define PAGE_CHS_PROBE_PRECHECK_OK (202+PAGE_OFFSET) +#define PAGE_CHS_PROBE_PRECHECK_FAILED (203+PAGE_OFFSET) + +#define PAGE_ENG_PROBE_PRECHECK (204+PAGE_OFFSET) +#define PAGE_ENG_PROBE_PRECHECK_OK (205+PAGE_OFFSET) +#define PAGE_ENG_PROBE_PRECHECK_FAILED (206+PAGE_OFFSET) + +/****************** Lcd control **************************/ +#define REG_LCD_READY 0x0014 + +/****************** TXT **************************/ + +// MAIN PAGE TXT +#define TXT_MAIN_BED 0x2000 +#define TXT_MAIN_HOTEND 0x2030 +#define TXT_MAIN_MESSAGE 0x2060 + +// FILE TXT +#define TXT_FILE_0 (0x2000+3*0x30) +#define TXT_DESCRIPT_0 0x5000 // DESCRIBE ADDRESS +#define TXT_FILE_1 (0x2000+4*0x30) +#define TXT_DESCRIPT_1 0x5030 +#define TXT_FILE_2 (0x2000+5*0x30) +#define TXT_DESCRIPT_2 0x5060 +#define TXT_FILE_3 (0x2000+6*0x30) +#define TXT_DESCRIPT_3 0x5090 +#define TXT_FILE_4 (0x2000+7*0x30) +#define TXT_DESCRIPT_4 0x50C0 + +// PRINT TXT +#define TXT_PRINT_NAME 0x2000+8*0x30 +#define TXT_PRINT_SPEED 0x2000+9*0x30 +#define TXT_PRINT_TIME 0x2000+10*0x30 +#define TXT_PRINT_PROGRESS 0x2000+11*0x30 +#define TXT_PRINT_HOTEND 0x2000+12*0x30 +#define TXT_PRINT_BED 0x2000+13*0x30 + +// PRINT ADJUST TXT + +#define TXT_ADJUST_HOTEND (0x2000+14*0x30) +#define TXT_ADJUST_BED (0x2000+15*0x30) +#define TXT_ADJUST_SPEED (0x2000+16*0x30) + +// TEMP SET TXT + +#define TXT_BED_NOW (0x2000+17*0x30) +#define TXT_BED_TARGET (0x2000+18*0x30) +#define TXT_HOTEND_NOW (0x2000+19*0x30) +#define TXT_HOTEND_TARGET (0x2000+20*0x30) + +// SPEED SET TXT +#define TXT_FAN_SPEED_NOW (0x2000+21*0x30) +#define TXT_FAN_SPEED_TARGET (0x2000+22*0x30) +#define TXT_PRINT_SPEED_NOW (0x2000+23*0x30) +#define TXT_PRINT_SPEED_TARGET (0x2000+24*0x30) + +// ABOUT TXT +#define TXT_ABOUT (0x2000+25*0x30) + +// RECORT TXT +#define TXT_RECORT_0 (0x2000+26*0x30) +#define TXT_RECORT_1 (0x2000+27*0x30) +#define TXT_RECORT_2 (0x2000+28*0x30) +#define TXT_RECORT_3 (0x2000+29*0x30) +#define TXT_RECORT_4 (0x2000+30*0x30) +#define TXT_RECORT_5 (0x2000+31*0x30) + +// ADVANCE LEVEL TXT +#define TXT_LEVEL_OFFSET (0x2000+32*0x30) + +// FILAMENT TXT +#define TXT_FILAMENT_TEMP (0x2000+33*0x30) + +#define TXT_FINISH_TIME (0x2000+34*0x30) +#define TXT_VERSION (0x2000+35*0x30) +#define TXT_PREHEAT_HOTEND (0x2000+36*0x30) +#define TXT_PREHEAT_BED (0x2000+37*0x30) + +#define TXT_OUTAGE_RECOVERY_FILE 0x2180 + +#define ADDRESS_SYSTEM_AUDIO 0x0080 + +#define ADDRESS_MOVE_DISTANCE 0x4300 +#define ADDRESS_SYSTEM_LED_STATUS 0x4500 +#define ADDRESS_PRINT_SETTING_LED_STATUS 0x4550 + +/*********************** KEY VALUE **************************/ +#define KEY_ADDRESS 0x1000 + +// MAIN PAGE KEY + +#define KEY_MAIN_TO_FILE 1 +#define KEY_MAIN_TO_TOOL 2 +#define KEY_MAIN_TO_PREPARE 3 +#define KEY_MAIN_TO_SYSTEM 4 + +// FILE PAGE KEY + +#define KEY_FILE_TO_MAIN 1 +#define KEY_PRINT 6 +#define KEY_RESUME 5 +#define KEY_PgUp 2 +#define KEY_pgDn 3 +#define KEY_FLASH 4 +#define KEY_FILE0 7 +#define KEY_FILE1 8 +#define KEY_FILE2 9 +#define KEY_FILE3 10 +#define KEY_FILE4 11 + +#define KEY_CONTINUE 2 +#define KEY_PAUSE 2 +#define KEY_STOP 3 +#define KEY_TO_ADJUST 4 +#define KEY_ADJUST_TO_PRINT 1 +#define KEY_ADJUST_ENSURE 7 +#define KEY_CHECK_DOOR 2 +#define KEY_DONE_OFF 3 + +// TOOL PAGE KEY + +#define KEY_TOOL_TO_MAIN 1 +#define KEY_TOOL_TO_MOVE 2 +#define KEY_TOOL_TO_TEMP 3 +#define KEY_TOOL_TO_SPEED 4 +#define KEY_TOOL_LIGHT 5 + +#define KEY_MOVE_TO_TOLL 1// move page +#define KEY_MOVE_X 2 +#define KEY_01 3 +#define KEY_MOVE_NX 4 +#define KEY_HOME_X 5 +#define KEY_MOVE_Y 6 +#define KEY_1 7 +#define KEY_MOVE_NY 8 +#define KEY_HOME_Y 9 +#define KEY_MOVE_Z 10 +#define KEY_10 11 +#define KEY_MOVE_NZ 12 +#define KEY_HOME_Z 13 +#define KEY_SPEED_LOW 14 +#define KEY_SPEED_MIDDLE 15 +#define KEY_SPEED_HIGHT 16 +#define KEY_HOME_ALL 17 + +#define KEY_TEMP_TO_TOOL 1 //Temperature setting page +#define KEY_BED_ADD 2 +#define KEY_BED_DEC 3 +#define KEY_HOTEND_ADD 4 +#define KEY_HOTEND_DEC 5 +#define KEY_COOL 6 +#define KEY_TEMP_ENSURE 7 + +#define KEY_SPEED_TO_TOOL 1 //speed setting page +#define KEY_FAN_SPEED_ADD 2 +#define KEY_FAN_SPEED_DEC 3 +#define KEY_PRINT_SPEED_ADD 4 +#define KEY_PRINT_SPEED_DEC 5 +#define KEY_SPEED_ENSURE 6 + +#define KEY_PREPARE_TO_MAIN 1 //PREPARE PAGE TO MAIN +#define KEY_PREPARE_TO_PreLEVE 2 +#define KEY_PreLEVE_TO_PREPARE 1 +#define KEY_PreLEVE_TO_LEVELING 2 +#define KEY_PreLEVE_TO_ADVANCE 3 +#define KEY_ADVANCE_TO_PreLEVE 1 +#define KEY_LEVEL_ADD 3 +#define KEY_LEVEL_DEC 2 +#define KEY_LEVEL_ENSURE 4 + + +#define KEY_PREPARE_TO_PREHEAT 3 +#define KEY_PREHEAT_TO_PREPARE 1 +#define KEY_PREHEAT_PLA 2 +#define KEY_PREHEAT_ABS 3 + +#define KEY_PREPARE_TO_FILAMENT 4 +#define KEY_FILAMENT_TO_PREPARE 1 +#define KEY_RETREAT 3 +#define KEY_FORWARD 2 +#define KEY_FILAMENT_STOP 4 + +// SYSTEM PAGE KEY + +#define KEY_SYS_TO_MAIN 1 +#define KEY_LANGUAGE 2 +#define KEY_SYS_TO_WIFI 3 +#define KEY_WIFI_TO_SYS 1 + +#define KEY_BEEP 4 +#define KEY_SYS_TO_ABOUT 5 +#define KEY_ABOUT_TO_SYS 1 + +#define KEY_SYS_TO_RECORD 6 +#define KEY_RECORD_TO_SYS 1 +#define KEY_RECORD_PaUp 2 +#define KEY_RECORD_PaDn 3 +#define KEY_RECORD_FLASH 4 + +#define COLOR_RED 0xF800 +#define COLOR_BLUE 0x0210 + +namespace Anycubic { + + enum language_t : uint8_t { ENG, CHS }; + + class DgusTFT; + extern DgusTFT ui; + + typedef struct _lcd_info_t { + language_t language; + bool audio_on; + } lcd_info_t; + + class DgusTFT { + static printer_state_t printer_state; + static paused_state_t pause_state; + #if HAS_HOTEND + static heater_state_t hotend_state; + #endif + #if HAS_HEATED_BED + static heater_state_t hotbed_state; + #endif + static char panel_command[MAX_CMND_LEN]; + static uint8_t command_len; + static char selectedfile[MAX_PATH_LEN]; + static file_menu_t file_menu; + static bool data_received; + static uint8_t data_buf[DATA_BUF_SIZE]; + static uint8_t data_index; + static uint16_t page_index_last, page_index_last_2; + static uint8_t message_index; + static uint8_t pop_up_index; + static uint32_t key_value; + static uint8_t lcd_txtbox_index; + static uint8_t lcd_txtbox_page; + static int16_t feedrate_back; + static language_t ui_language; + + public: + DgusTFT(); + + static lcd_info_t lcd_info, lcd_info_back; + static uint16_t page_index_now; + + static void Startup(); + static void ParamInit(); + static void IdleLoop(); + static void PrinterKilled(FSTR_P,FSTR_P); + static void MediaEvent(media_event_t); + static void TimerEvent(timer_event_t); + static void FilamentRunout(); + static void ConfirmationRequest(const char * const); + static void StatusChange(const char * const); + static void PowerLoss(); + static void PowerLossRecovery(); + static void HomingStart(); + static void HomingComplete(); + + static void set_descript_color(const uint16_t color, const uint8_t index=lcd_txtbox_index); + static void set_language(language_t); + static void toggle_language(); + static void goto_system_page(); + static void toggle_audio(); + static void store_changes(); + + #if HAS_HOTEND + static void send_temperature_hotend(uint32_t addr); + #endif + #if HAS_HEATED_BED + static void send_temperature_bed(uint32_t addr); + #endif + + typedef void (*p_fun)(); + static void page1(); + static void page2(); + static void page3(); + static void page4(); + static void page5(); + static void page6(); + static void page7(); // tool + static void page8(); + static void page9(); + static void page10(); // fan and print speed + static void page11(); // system + static void page12(); + static void page13(); + static void page14(); + static void page15(); + static void page16(); + static void page17(); + static void page18(); + static void page19(); + static void page20(); + static void page21(); + static void page22(); + static void page23(); + static void page24(); + static void page25(); + static void page26(); + static void page27(); + static void page28(); + static void page29(); + static void page30(); + static void page31(); + static void page32(); + + #if HAS_LEVELING + static void page33(); + #endif + static void page34(); + static void page115(); + static void page117(); // CHS Mute handler + static void page124(); + static void page125(); + static void page170(); // ENG Mute handler + + #if ENABLED(POWER_LOSS_RECOVERY) + static void page171(); // CHS power outage resume handler + static void page173(); // ENG power outage resume handler + #endif + #if HAS_LEVELING + static void page175(); // ENG probe preheating handler + static void page176(); // CHS probe preheating handler + #endif + + static void page177_to_198(); + //static void page178_to_181_190_to_193(); + static void page199_to_200(); + + static void page201(); + static void page202(); + static void page203(); + static void page204(); + static void page205(); + static void page206(); + + static void pop_up_manager(); + + static void SendtoTFT(FSTR_P const=nullptr); + static void SendtoTFTLN(FSTR_P const=nullptr); + static bool ReadTFTCommand(); + static int8_t Findcmndpos(const char *, const char); + static void CheckHeaters(); + static void SendFileList(int8_t); + static void SelectFile(); + static void ProcessPanelRequest(); + static void PanelInfo(uint8_t); + static void PanelAction(uint8_t); + static void PanelProcess(uint8_t); + + static void SendValueToTFT(const uint16_t value, const uint16_t address); + static void RequestValueFromTFT(const uint16_t address); + static void SendTxtToTFT(const char *pdata, const uint16_t address); + static void SendColorToTFT(const uint16_t color, const uint16_t address); + static void SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address); + static void ChangePageOfTFT(const uint16_t page_index, const bool no_send=false); + static void FakeChangePageOfTFT(const uint16_t page_index); + static void LcdAudioSet(const bool audio_on); + + private: + + }; + + extern DgusTFT Dgus; +} diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft_defs.h b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft_defs.h new file mode 100644 index 000000000000..dc187690e387 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft_defs.h @@ -0,0 +1,157 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * lcd/extui/anycubic_vyper/dgus_defs.h + */ + +#pragma once +#include "../../../inc/MarlinConfigPre.h" + +#define ACDEBUGLEVEL 0 // 0: off, 255: all levels enabled + +#if ACDEBUGLEVEL + // Bit-masks for selective debug: + enum ACDebugMask : uint8_t { + AC_INFO = 1, + AC_ACTION = 2, + AC_FILE = 4, + AC_PANEL = 8, + AC_MARLIN = 16, + AC_SOME = 32, + AC_ALL = 64 + }; + #define ACDEBUG(mask) ( ((mask) & ACDEBUGLEVEL) == mask ) // Debug flag macro +#else + #define ACDEBUG(mask) false +#endif + +#define TFTSer LCD_SERIAL // Serial interface for TFT panel now uses marlinserial +#define MAX_FOLDER_DEPTH 4 // Limit folder depth TFT has a limit for the file path +#define MAX_CMND_LEN 16 * MAX_FOLDER_DEPTH // Maximum Length for a Panel command +#define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path + +#define AC_HEATER_FAULT_VALIDATION_TIME 5 // number of 1/2 second loops before signalling a heater fault +#define AC_LOWEST_MESHPOINT_VAL Z_PROBE_LOW_POINT // The lowest value you can set for a single mesh point offset + + // TFT panel commands +#define AC_msg_sd_card_inserted F("J00") +#define AC_msg_sd_card_removed F("J01") +#define AC_msg_no_sd_card F("J02") +#define AC_msg_usb_connected F("J03") +#define AC_msg_print_from_sd_card F("J04") +#define AC_msg_pause F("J05") +#define AC_msg_nozzle_heating F("J06") +#define AC_msg_nozzle_heating_done F("J07") +#define AC_msg_bed_heating F("J08") +#define AC_msg_bed_heating_done F("J09") +#define AC_msg_nozzle_temp_abnormal F("J10") +#define AC_msg_kill_lcd F("J11") +#define AC_msg_ready F("J12") +#define AC_msg_low_nozzle_temp F("J13") +#define AC_msg_print_complete F("J14") +#define AC_msg_filament_out_alert F("J15") +#define AC_msg_stop F("J16") +#define AC_msg_main_board_has_reset F("J17") +#define AC_msg_paused F("J18") +#define AC_msg_j19_unknown F("J19") +#define AC_msg_sd_file_open_success F("J20") +#define AC_msg_sd_file_open_failed F("J21") +#define AC_msg_level_monitor_finished F("J22") +#define AC_msg_filament_out_block F("J23") +#define AC_msg_probing_not_allowed F("J24") +#define AC_msg_probing_complete F("J25") +#define AC_msg_start_probing F("J26") +#define AC_msg_version F("J27") +#define AC_msg_bed_temp_abnormal F("J28") + +#define MARLIN_msg_probing_point PSTR("Probing Point ") +#define MARLIN_msg_start_probing PSTR("Probing Point 1/25") +#define MARLIN_msg_probing_failed PSTR("Probing Failed") +#define MARLIN_msg_ready PSTR(" Ready.") +#define MARLIN_msg_print_paused PSTR("Print Paused") +#define MARLIN_msg_print_aborted PSTR("Print Aborted") +#define MARLIN_msg_extruder_heating PSTR("E Heating...") +#define MARLIN_msg_bed_heating PSTR("Bed Heating...") + +#define MARLIN_msg_probe_preheat_start PSTR("Probe preheat start") +#define MARLIN_msg_probe_preheat_stop PSTR("Probe preheat stop") + + +#define MARLIN_msg_nozzle_parked PSTR("Nozzle Parked") +#define MARLIN_msg_heater_timeout PSTR("Heater Timeout") +#define MARLIN_msg_reheating PSTR("Reheating...") +#define MARLIN_msg_reheat_done PSTR("Reheat finished.") +#define MARLIN_msg_filament_purging PSTR("Filament Purging...") +#define MARLIN_msg_media_removed PSTR("Media Removed") +#define MARLIN_msg_special_pause PSTR("PB") +#define AC_cmnd_auto_unload_filament PSTR("M701") // Use Marlin unload routine +#define AC_cmnd_auto_load_filament PSTR("M702 M0 PB") // Use Marlin load routing then pause for user to clean nozzle + +#define AC_cmnd_manual_load_filament PSTR("M83\nG1 E50 F700\nM82") // replace the manual panel commands with something a little faster +#define AC_cmnd_manual_unload_filament PSTR("M83\nG1 E-50 F1200\nM82") +#define AC_cmnd_enable_levelling PSTR("M420 S1 V1") +#define AC_cmnd_power_loss_recovery PSTR("G28 R5 X Y\nG28 Z") // Lift, home X and Y then home Z when in 'safe' position + +namespace Anycubic { + enum heater_state_t : uint8_t { + AC_heater_off, + AC_heater_temp_set, + AC_heater_temp_reached + }; + + enum paused_state_t : uint8_t { + AC_paused_heater_timed_out, + AC_paused_filament_lack, + AC_paused_purging_filament, + AC_paused_idle + }; + + enum printer_state_t : uint8_t { + AC_printer_idle, + AC_printer_probing, + AC_printer_printing, + AC_printer_pausing, + AC_printer_paused, + AC_printer_stopping, + AC_printer_stopping_from_media_remove, + AC_printer_resuming_from_power_outage + }; + + enum timer_event_t : uint8_t { + AC_timer_started, + AC_timer_paused, + AC_timer_stopped + }; + + enum media_event_t : uint8_t { + AC_media_inserted, + AC_media_removed, + AC_media_error + }; + enum file_menu_t : uint8_t { + AC_menu_file, + AC_menu_command, + AC_menu_change_to_file, + AC_menu_change_to_command + }; +} diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp new file mode 100644 index 000000000000..142f438861b4 --- /dev/null +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -0,0 +1,152 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * lcd/extui/anycubic_vyper/vyper_extui.cpp + * + * Anycubic Dgus TFT support for Marlin + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(ANYCUBIC_LCD_VYPER) + +#include "../ui_api.h" +#include "dgus_tft.h" + +using namespace Anycubic; + +namespace ExtUI { + + void onStartup() { Dgus.Startup(); } + + void onIdle() { Dgus.IdleLoop(); } + + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { + Dgus.PrinterKilled(error, component); + } + + void onMediaInserted() { Dgus.MediaEvent(AC_media_inserted); } + void onMediaError() { Dgus.MediaEvent(AC_media_error); } + void onMediaRemoved() { Dgus.MediaEvent(AC_media_removed); } + + void onPlayTone(const uint16_t frequency, const uint16_t duration) { + #if ENABLED(SPEAKER) + ::tone(BEEPER_PIN, frequency, duration); + #endif + } + + 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 onUserConfirmRequired(const char * const msg) { Dgus.ConfirmationRequest(msg); } + void onStatusChanged(const char * const msg) { Dgus.StatusChange(msg); } + + void onHomingStart() { Dgus.HomingStart(); } + void onHomingDone() { Dgus.HomingComplete(); } + + void onFactoryReset() { + Dgus.page_index_now = 121; + Dgus.lcd_info.audio_on = DISABLED(SPEAKER); + } + + void onStoreSettings(char *buff) { + // Called when saving to EEPROM (i.e. M500). If the ExtUI needs + // permanent data to be stored, it can write up to eeprom_data_size bytes + // into buff. + + static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size); + memcpy(buff, &Dgus.lcd_info, sizeof(Dgus.lcd_info)); + } + + void onLoadSettings(const char *buff) { + // Called while loading settings from EEPROM. If the ExtUI + // needs to retrieve data, it should copy up to eeprom_data_size bytes + // from buff + + static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size); + memcpy(&Dgus.lcd_info, buff, sizeof(Dgus.lcd_info)); + memcpy(&Dgus.lcd_info_back, buff, sizeof(Dgus.lcd_info_back)); + } + + void onPostprocessSettings() { + // Called after loading or resetting stored settings + Dgus.ParamInit(); + Dgus.PowerLoss(); + } + + 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_MESH + void onLevelingStart() {} + void onLevelingDone() {} + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + // Called when any mesh points are updated + //SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval); + } + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { + // Called to indicate a special condition + //SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " state:", state); + } + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + // Called when power-loss is enabled/disabled + void onSetPowerLoss(const bool) { Dgus.PowerLoss(); } + // Called when power-loss state is detected + void onPowerLoss() { /* handled internally */ } + // Called on resume from power-loss + void onPowerLossResume() { Dgus.PowerLossRecovery(); } + #endif + + #if HAS_PID_HEATING + void onPidTuning(const result_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; + } + } + #endif + + void onSteppersDisabled() {} + void onSteppersEnabled() {} +} + +#endif // ANYCUBIC_LCD_VYPER diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index 2f3bbd64cc42..2fe4e03016b5 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -102,12 +102,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -126,6 +126,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 3cf0c3264865..2dd4d0d19ec3 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -368,8 +368,8 @@ void DGUSScreenHandlerMKS::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) { } void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t z_value = BE16_P(val_ptr); - switch (z_value) { + const uint16_t z = BE16_P(val_ptr); + switch (z) { case 0: Z_distance = 0.01; break; case 1: Z_distance = 0.1; break; case 2: Z_distance = 0.5; break; @@ -477,7 +477,7 @@ void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void * void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { #if ENABLED(MESH_BED_LEVELING) - const uint16_t mesh_value = BE16_P(val_ptr); + const uint16_t mesh_val = BE16_P(val_ptr); // static uint8_t a_first_level = 1; char cmd_buf[30]; float offset = mesh_adj_distance; @@ -485,7 +485,7 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { if (!queue.ring_buffer.empty()) return; - switch (mesh_value) { + switch (mesh_val) { case 0: offset = mesh_adj_distance; integer = offset; // get int @@ -575,20 +575,19 @@ void DGUSScreenHandlerMKS::SD_FileBack(DGUS_VP_Variable&, void*) { } void DGUSScreenHandlerMKS::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) { - - const uint16_t lcd_value = BE16_P(val_ptr); - lcd_default_light = constrain(lcd_value, 10, 100); + const uint16_t lcd_val = BE16_P(val_ptr); + lcd_default_light = constrain(lcd_val, 10, 100); const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light }; dgusdisplay.WriteVariable(0x0082, &lcd_data, 5, true); } void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) { - const int16_t point_value = BE16_P(val_ptr); + const int16_t point_val = BE16_P(val_ptr); // Insist on leveling first time at this screen static bool first_level_flag = false; - if (!first_level_flag || point_value == 0x0001) { + if (!first_level_flag || point_val == 0x0001) { queue.enqueue_now_P(G28_STR); first_level_flag = true; } @@ -601,10 +600,10 @@ void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val queue.enqueue_one_now(buf_level); }; - if (WITHIN(point_value, 0x0001, 0x0005)) + if (WITHIN(point_val, 0x0001, 0x0005)) queue.enqueue_now(F("G1Z10")); - switch (point_value) { + switch (point_val) { case 0x0001: enqueue_corner_move(X_MIN_POS + ABS(mks_corner_offsets[0].x), Y_MIN_POS + ABS(mks_corner_offsets[0].y), level_speed); @@ -628,7 +627,7 @@ void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val break; } - if (WITHIN(point_value, 0x0002, 0x0005)) { + if (WITHIN(point_val, 0x0002, 0x0005)) { //queue.enqueue_now(F("G28Z")); queue.enqueue_now(F("G1Z-10")); } @@ -638,14 +637,14 @@ void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val #define mks_max(a, b) ((a) > (b)) ? (a) : (b) void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) { #if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP) - const uint16_t tmc_value = BE16_P(val_ptr); + const uint16_t tmc_val = BE16_P(val_ptr); #endif switch (var.VP) { case VP_TMC_X_STEP: #if USE_SENSORLESS #if X_HAS_STEALTHCHOP - stepperX.homing_threshold(mks_min(tmc_value, 255)); + stepperX.homing_threshold(mks_min(tmc_val, 255)); settings.save(); //tmc_step.x = stepperX.homing_threshold(); #endif @@ -654,7 +653,7 @@ void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr case VP_TMC_Y_STEP: #if USE_SENSORLESS #if Y_HAS_STEALTHCHOP - stepperY.homing_threshold(mks_min(tmc_value, 255)); + stepperY.homing_threshold(mks_min(tmc_val, 255)); settings.save(); //tmc_step.y = stepperY.homing_threshold(); #endif @@ -663,7 +662,7 @@ void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr case VP_TMC_Z_STEP: #if USE_SENSORLESS #if Z_HAS_STEALTHCHOP - stepperZ.homing_threshold(mks_min(tmc_value, 255)); + stepperZ.homing_threshold(mks_min(tmc_val, 255)); settings.save(); //tmc_step.z = stepperZ.homing_threshold(); #endif @@ -671,49 +670,49 @@ void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr break; case VP_TMC_X_Current: #if AXIS_IS_TMC(X) - stepperX.rms_current(tmc_value); + stepperX.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_X1_Current: #if AXIS_IS_TMC(X2) - stepperX2.rms_current(tmc_value); + stepperX2.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_Y_Current: #if AXIS_IS_TMC(Y) - stepperY.rms_current(tmc_value); + stepperY.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_Y1_Current: #if AXIS_IS_TMC(X2) - stepperY2.rms_current(tmc_value); + stepperY2.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_Z_Current: #if AXIS_IS_TMC(Z) - stepperZ.rms_current(tmc_value); + stepperZ.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_Z1_Current: #if AXIS_IS_TMC(Z2) - stepperZ2.rms_current(tmc_value); + stepperZ2.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_E0_Current: #if AXIS_IS_TMC(E0) - stepperE0.rms_current(tmc_value); + stepperE0.rms_current(tmc_val); settings.save(); #endif break; case VP_TMC_E1_Current: #if AXIS_IS_TMC(E1) - stepperE1.rms_current(tmc_value); + stepperE1.rms_current(tmc_val); settings.save(); #endif break; @@ -849,29 +848,29 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { } void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) { - const int16_t value_pos = BE16_P(val_ptr); + const int16_t pos = BE16_P(val_ptr); switch (var.VP) { - case VP_X_PARK_POS: mks_park_pos.x = value_pos; break; - case VP_Y_PARK_POS: mks_park_pos.y = value_pos; break; - case VP_Z_PARK_POS: mks_park_pos.z = value_pos; break; + case VP_X_PARK_POS: mks_park_pos.x = pos; break; + case VP_Y_PARK_POS: mks_park_pos.y = pos; break; + case VP_Z_PARK_POS: mks_park_pos.z = pos; break; default: break; } skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr) { - const int16_t value_raw = BE16_P(val_ptr); + const int16_t raw = BE16_P(val_ptr); - *(int16_t*)var.memadr = value_raw; + *(int16_t*)var.memadr = raw; settings.save(); skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_raw = BE16_P(val_ptr); - const float value = (float)value_raw; + const uint16_t raw = BE16_P(val_ptr); + const float value = (float)raw; ExtUI::axis_t axis; switch (var.VP) { @@ -886,8 +885,8 @@ void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *v } void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_raw = BE16_P(val_ptr); - const float value = (float)value_raw; + const uint16_t raw = BE16_P(val_ptr); + const float value = (float)raw; ExtUI::extruder_t extruder; switch (var.VP) { @@ -905,8 +904,8 @@ void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, } void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_raw = BE16_P(val_ptr); - const float value = (float)value_raw; + const uint16_t raw = BE16_P(val_ptr); + const float value = (float)raw; ExtUI::axis_t axis; switch (var.VP) { @@ -921,8 +920,8 @@ void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val } void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_raw = BE16_P(val_ptr); - const float value = (float)value_raw; + const uint16_t raw = BE16_P(val_ptr); + const float value = (float)raw; ExtUI::extruder_t extruder; switch (var.VP) { @@ -940,8 +939,8 @@ void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, v } void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_raw = BE16_P(val_ptr); - const float value = (float)value_raw; + const uint16_t raw = BE16_P(val_ptr); + const float value = (float)raw; ExtUI::axis_t axis; switch (var.VP) { @@ -956,8 +955,8 @@ void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_p } void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr) { - uint16_t value_raw = BE16_P(val_ptr); - float value = (float)value_raw; + uint16_t raw = BE16_P(val_ptr); + float value = (float)raw; ExtUI::extruder_t extruder; switch (var.VP) { default: return; @@ -974,33 +973,33 @@ void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void * } void DGUSScreenHandlerMKS::HandleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr) { - uint16_t value_travel = BE16_P(val_ptr); - planner.settings.travel_acceleration = (float)value_travel; + uint16_t travel = BE16_P(val_ptr); + planner.settings.travel_acceleration = (float)travel; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } void DGUSScreenHandlerMKS::HandleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr) { - uint16_t value_t = BE16_P(val_ptr); - planner.settings.min_feedrate_mm_s = (float)value_t; + uint16_t t = BE16_P(val_ptr); + planner.settings.min_feedrate_mm_s = (float)t; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } void DGUSScreenHandlerMKS::HandleMin_T_F(DGUS_VP_Variable &var, void *val_ptr) { - uint16_t value_t_f = BE16_P(val_ptr); - planner.settings.min_travel_feedrate_mm_s = (float)value_t_f; + uint16_t t_f = BE16_P(val_ptr); + planner.settings.min_travel_feedrate_mm_s = (float)t_f; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) { - uint16_t value_acc = BE16_P(val_ptr); - planner.settings.acceleration = (float)value_acc; + uint16_t acc = BE16_P(val_ptr); + planner.settings.acceleration = (float)acc; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } #if ENABLED(PREVENT_COLD_EXTRUSION) void DGUSScreenHandlerMKS::HandleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_ex_min_temp = BE16_P(val_ptr); - thermalManager.extrude_min_temp = value_ex_min_temp; + const uint16_t ex_min_temp = BE16_P(val_ptr); + thermalManager.extrude_min_temp = ex_min_temp; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } #endif @@ -1080,8 +1079,8 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) #endif // BABYSTEPPING void DGUSScreenHandlerMKS::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_len = BE16_P(val_ptr); - const float value = (float)value_len; + const uint16_t len = BE16_P(val_ptr); + const float value = (float)len; distanceFilament = value; @@ -1089,8 +1088,8 @@ void DGUSScreenHandlerMKS::GetManualFilament(DGUS_VP_Variable &var, void *val_pt } void DGUSScreenHandlerMKS::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) { - const uint16_t value_len = BE16_P(val_ptr); - filamentSpeed_mm_s = value_len; + const uint16_t len = BE16_P(val_ptr); + filamentSpeed_mm_s = len; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp index 5bbeb0d7cc67..7e215f887c5b 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp @@ -125,8 +125,7 @@ void DGUSDisplay::WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t si const char* data = static_cast(data_ptr); size_t len = strlen_P(data); - uint8_t left_spaces = 0; - uint8_t right_spaces = 0; + uint8_t left_spaces = 0, right_spaces = 0; if (len < size) { if (!len) { @@ -147,15 +146,9 @@ void DGUSDisplay::WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t si len = size; } - while (left_spaces--) { - LCD_SERIAL.write(' '); - } - while (len--) { - LCD_SERIAL.write(pgm_read_byte(data++)); - } - while (right_spaces--) { - LCD_SERIAL.write(use_space ? ' ' : '\0'); - } + while (left_spaces--) LCD_SERIAL.write(' '); + while (len--) LCD_SERIAL.write(pgm_read_byte(data++)); + while (right_spaces--) LCD_SERIAL.write(use_space ? ' ' : '\0'); } void DGUSDisplay::ReadVersions() { @@ -340,11 +333,13 @@ void DGUSDisplay::ProcessRx() { } size_t DGUSDisplay::GetFreeTxBuffer() { - #ifdef LCD_SERIAL_GET_TX_BUFFER_FREE - return LCD_SERIAL_GET_TX_BUFFER_FREE(); - #else - return SIZE_MAX; - #endif + return ( + #ifdef LCD_SERIAL_GET_TX_BUFFER_FREE + LCD_SERIAL_GET_TX_BUFFER_FREE() + #else + SIZE_MAX + #endif + ); } void DGUSDisplay::FlushTx() { diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h index c4e3645f28c9..bfea5780a1f0 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h @@ -47,13 +47,13 @@ class DGUSDisplay { enum DGUS_ControlType : uint8_t { VARIABLE_DATA_INPUT = 0x00, - POPUP_WINDOW = 0x01, - INCREMENTAL_ADJUST = 0x02, - SLIDER_ADJUST = 0x03, - RTC_SETTINGS = 0x04, - RETURN_KEY_CODE = 0x05, - TEXT_INPUT = 0x06, - FIRMWARE_SETTINGS = 0x07 + POPUP_WINDOW = 0x01, + INCREMENTAL_ADJUST = 0x02, + SLIDER_ADJUST = 0x03, + RTC_SETTINGS = 0x04, + RETURN_KEY_CODE = 0x05, + TEXT_INPUT = 0x06, + FIRMWARE_SETTINGS = 0x07 }; DGUSDisplay() = default; @@ -63,8 +63,11 @@ class DGUSDisplay { static void Read(uint16_t addr, uint8_t size); static void Write(uint16_t addr, const void* data_ptr, uint8_t size); - static void WriteString(uint16_t addr, const void* data_ptr, uint8_t size, bool left = true, bool right = false, bool use_space = true); - static void WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left = true, bool right = false, bool use_space = true); + static void WriteString(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true); + static void WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true); + static void WriteString(uint16_t addr, FSTR_P const fstr, uint8_t size, bool left=true, bool right=false, bool use_space=true) { + WriteStringPGM(addr, FTOP(fstr), size, left, right, use_space); + } template static void Write(uint16_t addr, T data) { @@ -83,7 +86,7 @@ class DGUSDisplay { // start: position at which the sound was stored on the display. // len: how many sounds to play. Sounds will play consecutively from start to start+len-1. // volume: playback volume. 0 keeps the current volume. - static void PlaySound(uint8_t start, uint8_t len = 1, uint8_t volume = 0); + static void PlaySound(uint8_t start, uint8_t len=1, uint8_t volume=0); // Enable/disable a specific touch control. // type: control type. // control: index of the control on the page (set during screen development). @@ -154,7 +157,7 @@ class DGUSDisplay { }; enum dgus_system_addr : uint16_t { - DGUS_VERSION = 0x000f // OS/GUI version + DGUS_VERSION = 0x000F // OS/GUI version }; static void WriteHeader(uint16_t addr, uint8_t command, uint8_t len); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index 2b750df9c9ca..7a0318a5554a 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -63,13 +63,13 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { if (vp.addr == DGUS_Addr::SCREENCHANGE_Idle && (ExtUI::isPrinting() || ExtUI::isPrintingPaused())) { - dgus_screen_handler.SetStatusMessage(F("Impossible while printing")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_PRINTING)); return; } if (vp.addr == DGUS_Addr::SCREENCHANGE_Printing && (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused())) { - dgus_screen_handler.SetStatusMessage(F("Impossible while idle")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_IDLE)); return; } @@ -137,7 +137,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { UNUSED(data_ptr); if (dgus_screen_handler.filelist_selected < 0) { - dgus_screen_handler.SetStatusMessage(F("No file selected")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NO_FILE_SELECTED)); return; } @@ -147,7 +147,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -205,7 +205,7 @@ void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) { } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -362,7 +362,7 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) { #endif } - dgus_screen_handler.SetStatusMessage(F("Cooling...")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_COOLING)); dgus_screen_handler.TriggerFullUpdate(); } @@ -387,13 +387,13 @@ void DGUSRxHandler::Steppers(DGUS_VP &vp, void *data_ptr) { void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); - if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED)); + if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(ExtUI::Z))) { + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -411,13 +411,13 @@ void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) { void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); - if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED)); + if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(ExtUI::Z))) { + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -454,12 +454,12 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (!ExtUI::isPositionKnown()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -509,12 +509,12 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) { #endif if (!ExtUI::isPositionKnown()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -525,7 +525,7 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) { #else queue.enqueue_now(F("G29")); #endif - queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE); + queue.enqueue_now(F("M500")); } void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) { @@ -533,7 +533,7 @@ void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) { UNUSED(data_ptr); if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -574,7 +574,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -598,7 +598,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) { } if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) { - dgus_screen_handler.SetStatusMessage(F("Temperature too low")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_TEMP_TOO_LOW)); return; } @@ -618,17 +618,13 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } DGUS_Data::Axis axis = (DGUS_Data::Axis)((uint8_t*)data_ptr)[1]; - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLinePGM(DGUS_MSG_HOMING, 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); - dgus_screen_handler.ShowWaitScreen(dgus_screen_handler.GetCurrentScreen()); + dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), dgus_screen_handler.GetCurrentScreen()); switch (axis) { case DGUS_Data::Axis::X_Y_Z: @@ -650,19 +646,13 @@ void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) { switch (vp.addr) { default: return; - case DGUS_Addr::MOVE_SetX: - axis = ExtUI::X; - break; - case DGUS_Addr::MOVE_SetY: - axis = ExtUI::Y; - break; - case DGUS_Addr::MOVE_SetZ: - axis = ExtUI::Z; - break; + case DGUS_Addr::MOVE_SetX: axis = ExtUI::X; break; + case DGUS_Addr::MOVE_SetY: axis = ExtUI::Y; break; + case DGUS_Addr::MOVE_SetZ: axis = ExtUI::Z; break; } - if (!ExtUI::isAxisPositionKnown(axis)) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED)); + if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(axis))) { + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } @@ -675,18 +665,11 @@ void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); float offset; - switch (dgus_screen_handler.move_steps) { default: return; - case DGUS_Data::StepSize::MM10: - offset = 10.0f; - break; - case DGUS_Data::StepSize::MM1: - offset = 1.0f; - break; - case DGUS_Data::StepSize::MMP1: - offset = 0.1f; - break; + case DGUS_Data::StepSize::MM10: offset = 10.0f; break; + case DGUS_Data::StepSize::MM1: offset = 1.0f; break; + case DGUS_Data::StepSize::MMP1: offset = 0.1f; break; } const DGUS_Data::MoveDirection direction = (DGUS_Data::MoveDirection)((uint8_t*)data_ptr)[1]; @@ -694,31 +677,16 @@ void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) { switch (direction) { default: return; - case DGUS_Data::MoveDirection::XP: - axis = ExtUI::X; - break; - case DGUS_Data::MoveDirection::XM: - axis = ExtUI::X; - offset = -offset; - break; - case DGUS_Data::MoveDirection::YP: - axis = ExtUI::Y; - break; - case DGUS_Data::MoveDirection::YM: - axis = ExtUI::Y; - offset = -offset; - break; - case DGUS_Data::MoveDirection::ZP: - axis = ExtUI::Z; - break; - case DGUS_Data::MoveDirection::ZM: - axis = ExtUI::Z; - offset = -offset; - break; + case DGUS_Data::MoveDirection::XM: offset = -offset; + case DGUS_Data::MoveDirection::XP: axis = ExtUI::X; break; + case DGUS_Data::MoveDirection::YM: offset = -offset; + case DGUS_Data::MoveDirection::YP: axis = ExtUI::Y; break; + case DGUS_Data::MoveDirection::ZM: offset = -offset; + case DGUS_Data::MoveDirection::ZP: axis = ExtUI::Z; break; } - if (!ExtUI::isAxisPositionKnown(axis)) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED)); + if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(axis))) { + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } @@ -731,7 +699,6 @@ void DGUSRxHandler::MoveSetStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::StepSize size = (DGUS_Data::StepSize)((uint8_t*)data_ptr)[1]; - dgus_screen_handler.move_steps = size; dgus_screen_handler.TriggerFullUpdate(); @@ -750,20 +717,14 @@ void DGUSRxHandler::GcodeExecute(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - if (!strlen(dgus_screen_handler.gcode)) { - return; - } + if (!strlen(dgus_screen_handler.gcode)) return; if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLinePGM(PSTR("Executing command..."), 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); - dgus_screen_handler.ShowWaitScreen(DGUS_Screen::GCODE); + dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_EXECUTING_COMMAND), DGUS_Screen::GCODE); queue.enqueue_one_now(dgus_screen_handler.gcode); } @@ -773,17 +734,15 @@ void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) { const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; - if (result != DGUS_Data::Popup::CONFIRMED) { - return; - } + if (result != DGUS_Data::Popup::CONFIRMED) return; if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } queue.enqueue_now(F("M502")); - queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE); + queue.enqueue_now(F("M500")); } void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) { @@ -796,7 +755,7 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) { case DGUS_Data::Extra::BUTTON1: #if ENABLED(BLTOUCH) if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -842,7 +801,7 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -873,7 +832,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { UNUSED(data_ptr); if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -887,7 +846,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { heater = H_BED; break; #else - dgus_screen_handler.SetStatusMessage(F("Bed PID disabled")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BED_PID_DISABLED)); return; #endif case DGUS_Data::Heater::H0: @@ -895,7 +854,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { heater = H_E0; break; #else - dgus_screen_handler.SetStatusMessage(F("PID disabled")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED)); return; #endif #if HAS_MULTI_HOTEND @@ -904,7 +863,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { heater = H_E1; break; #else - dgus_screen_handler.SetStatusMessage(F("PID disabled")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED)); return; #endif #endif @@ -913,14 +872,10 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { char buffer[24]; snprintf_P(buffer, sizeof(buffer), PSTR("M303C%dE%dS%dU1"), cycles, heater, dgus_screen_handler.pid_temp); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLinePGM(PSTR("PID autotuning..."), 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); - dgus_screen_handler.ShowWaitScreen(DGUS_Screen::PID); + dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_PID_AUTOTUNING), DGUS_Screen::PID); queue.enqueue_one_now(buffer); - queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE); + queue.enqueue_now(F("M500")); } #if ENABLED(POWER_LOSS_RECOVERY) @@ -934,7 +889,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -953,12 +908,12 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } if (!recovery.valid()) { - dgus_screen_handler.SetStatusMessage(F("Invalid recovery data")); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_INVALID_RECOVERY_DATA)); return; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index a7295f90fec4..e1d8778567c4 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -69,16 +69,6 @@ bool DGUSScreenHandler::leveling_active = false; millis_t DGUSScreenHandler::status_expire = 0; millis_t DGUSScreenHandler::eeprom_save = 0; -const char DGUS_MSG_HOMING_REQUIRED[] PROGMEM = "Homing required", - DGUS_MSG_BUSY[] PROGMEM = "Busy", - DGUS_MSG_UNDEF[] PROGMEM = "-", - DGUS_MSG_HOMING[] PROGMEM = "Homing...", - DGUS_MSG_FW_OUTDATED[] PROGMEM = "DWIN GUI/OS update required", - DGUS_MSG_ABL_REQUIRED[] PROGMEM = "Auto bed leveling required"; - -const char DGUS_CMD_HOME[] PROGMEM = "G28", - DGUS_CMD_EEPROM_SAVE[] PROGMEM = "M500"; - void DGUSScreenHandler::Init() { dgus_display.Init(); @@ -138,7 +128,7 @@ void DGUSScreenHandler::Loop() { if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) { dgus_display.PlaySound(3); - SetStatusMessage(ExtUI::getMeshValid() ? F("Probing successful") : F("Probing failed")); + SetStatusMessage(ExtUI::getMeshValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED)); MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC); return; @@ -151,7 +141,7 @@ void DGUSScreenHandler::Loop() { if (eeprom_save > 0 && ELAPSED(ms, eeprom_save) && IsPrinterIdle()) { eeprom_save = 0; - queue.enqueue_now_P(DGUS_CMD_EEPROM_SAVE); + queue.enqueue_now(F("M500")); return; } @@ -159,10 +149,10 @@ void DGUSScreenHandler::Loop() { } void DGUSScreenHandler::PrinterKilled(FSTR_P const error, FSTR_P const component) { - SetMessageLinePGM(FTOP(error), 1); - SetMessageLinePGM(FTOP(component), 2); + SetMessageLine(error, 1); + SetMessageLine(component, 2); SetMessageLinePGM(NUL_STR, 3); - SetMessageLinePGM(GET_TEXT(MSG_PLEASE_RESET), 4); + SetMessageLine(GET_TEXT_F(MSG_PLEASE_RESET), 4); dgus_display.PlaySound(3, 1, 200); @@ -170,14 +160,14 @@ void DGUSScreenHandler::PrinterKilled(FSTR_P const error, FSTR_P const component } void DGUSScreenHandler::UserConfirmRequired(const char * const msg) { - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLine(msg, 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); + SetMessageLinePGM(NUL_STR, 1); + SetMessageLine(msg, 2); + SetMessageLinePGM(NUL_STR, 3); + SetMessageLinePGM(NUL_STR, 4); dgus_display.PlaySound(3); - dgus_screen_handler.ShowWaitScreen(current_screen, true); + ShowWaitScreen(current_screen, true); } void DGUSScreenHandler::SettingsReset() { @@ -189,7 +179,7 @@ void DGUSScreenHandler::SettingsReset() { Ready(); } - SetStatusMessage(F("EEPROM reset")); + SetStatusMessage(GET_TEXT_F(DGUS_MSG_RESET_EEPROM)); } void DGUSScreenHandler::StoreSettings(char *buff) { @@ -223,12 +213,12 @@ void DGUSScreenHandler::LoadSettings(const char *buff) { void DGUSScreenHandler::ConfigurationStoreWritten(bool success) { if (!success) - SetStatusMessage(F("EEPROM write failed")); + SetStatusMessage(GET_TEXT_F(DGUS_MSG_WRITE_EEPROM_FAILED)); } void DGUSScreenHandler::ConfigurationStoreRead(bool success) { if (!success) { - SetStatusMessage(F("EEPROM read failed")); + SetStatusMessage(GET_TEXT_F(DGUS_MSG_READ_EEPROM_FAILED)); } else if (!settings_ready) { settings_ready = true; @@ -283,7 +273,8 @@ void DGUSScreenHandler::PrintTimerStopped() { void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) { char buffer[21]; - snprintf_P(buffer, sizeof(buffer), PSTR("Filament runout E%d"), extruder); + + snprintf_P(buffer, sizeof(buffer), GET_TEXT(DGUS_MSG_FILAMENT_RUNOUT), extruder); SetStatusMessage(buffer); @@ -346,7 +337,7 @@ void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) { #endif // HAS_PID_HEATING -void DGUSScreenHandler::SetMessageLine(const char* msg, uint8_t line) { +void DGUSScreenHandler::SetMessageLine(const char * const msg, const uint8_t line) { switch (line) { default: return; case 1: @@ -364,7 +355,7 @@ void DGUSScreenHandler::SetMessageLine(const char* msg, uint8_t line) { } } -void DGUSScreenHandler::SetMessageLinePGM(PGM_P msg, uint8_t line) { +void DGUSScreenHandler::SetMessageLinePGM(PGM_P const msg, const uint8_t line) { switch (line) { default: return; case 1: @@ -389,12 +380,12 @@ void DGUSScreenHandler::SetStatusMessage(const char* msg, const millis_t duratio } void DGUSScreenHandler::SetStatusMessage(FSTR_P const fmsg, const millis_t duration) { - dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Status, FTOP(fmsg), DGUS_STATUS_LEN, false, true); + dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN, false, true); status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0); } -void DGUSScreenHandler::ShowWaitScreen(DGUS_Screen return_screen, bool has_continue) { +void DGUSScreenHandler::ShowWaitScreen(const DGUS_Screen return_screen, const bool has_continue/*=false*/) { if (return_screen != DGUS_Screen::WAIT) { wait_return_screen = return_screen; } @@ -403,6 +394,14 @@ void DGUSScreenHandler::ShowWaitScreen(DGUS_Screen return_screen, bool has_conti TriggerScreenChange(DGUS_Screen::WAIT); } +void DGUSScreenHandler::ShowWaitScreen(FSTR_P const msg, const DGUS_Screen return_screen, const bool has_continue/*=false*/) { + SetMessageLinePGM(NUL_STR, 1); + SetMessageLine(msg, 2); + SetMessageLinePGM(NUL_STR, 3); + SetMessageLinePGM(NUL_STR, 4); + ShowWaitScreen(return_screen, has_continue); +} + DGUS_Screen DGUSScreenHandler::GetCurrentScreen() { return current_screen; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 6a00a4f72aff..295df311df46 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -69,13 +69,15 @@ class DGUSScreenHandler { static void PidTuning(const ExtUI::result_t rst); #endif - static void SetMessageLine(const char* msg, uint8_t line); - static void SetMessageLinePGM(PGM_P msg, uint8_t line); + static void SetMessageLine(const char * const msg, const uint8_t line); + static void SetMessageLinePGM(PGM_P const msg, const uint8_t line); + static void SetMessageLine(FSTR_P const msg, const uint8_t line) { SetMessageLinePGM(FTOP(msg), line); } static void SetStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); static void SetStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); - static void ShowWaitScreen(DGUS_Screen return_screen, bool has_continue=false); + static void ShowWaitScreen(const DGUS_Screen return_screen, const bool has_continue=false); + static void ShowWaitScreen(FSTR_P const msg, const DGUS_Screen return_screen, const bool has_continue=false); static DGUS_Screen GetCurrentScreen(); static void TriggerScreenChange(DGUS_Screen screen); @@ -139,13 +141,3 @@ class DGUSScreenHandler { }; extern DGUSScreenHandler dgus_screen_handler; - -extern const char DGUS_MSG_HOMING_REQUIRED[], - DGUS_MSG_BUSY[], - DGUS_MSG_UNDEF[], - DGUS_MSG_HOMING[], - DGUS_MSG_FW_OUTDATED[], - DGUS_MSG_ABL_REQUIRED[]; - -extern const char DGUS_CMD_HOME[], - DGUS_CMD_EEPROM_SAVE[]; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp index 4caccc071768..c95d7d045351 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp @@ -68,7 +68,7 @@ bool DGUSSetupHandler::LevelingMenu() { ExtUI::setLevelingActive(dgus_screen_handler.leveling_active); if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } @@ -80,13 +80,9 @@ bool DGUSSetupHandler::LevelingMenu() { return true; } - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLinePGM(DGUS_MSG_HOMING, 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); - dgus_screen_handler.ShowWaitScreen(DGUS_Screen::LEVELING_MENU); + dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_MENU); - queue.enqueue_now_P(DGUS_CMD_HOME); + queue.enqueue_now(F("G28")); return false; } @@ -99,17 +95,13 @@ bool DGUSSetupHandler::LevelingManual() { } if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLinePGM(DGUS_MSG_HOMING, 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); - dgus_screen_handler.ShowWaitScreen(DGUS_Screen::LEVELING_MANUAL); + dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_MANUAL); - queue.enqueue_now_P(DGUS_CMD_HOME); + queue.enqueue_now(F("G28")); return false; } @@ -118,7 +110,7 @@ bool DGUSSetupHandler::LevelingOffset() { dgus_screen_handler.offset_steps = DGUS_Data::StepSize::MMP1; if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } @@ -136,13 +128,9 @@ bool DGUSSetupHandler::LevelingOffset() { return true; } - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1); - dgus_screen_handler.SetMessageLinePGM(DGUS_MSG_HOMING, 2); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3); - dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4); - dgus_screen_handler.ShowWaitScreen(DGUS_Screen::LEVELING_OFFSET); + dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_OFFSET); - queue.enqueue_now_P(DGUS_CMD_HOME); + queue.enqueue_now(F("G28")); return false; } @@ -175,7 +163,7 @@ bool DGUSSetupHandler::Move() { dgus_screen_handler.move_steps = DGUS_Data::StepSize::MM10; if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } @@ -186,7 +174,7 @@ bool DGUSSetupHandler::Gcode() { ZERO(dgus_screen_handler.gcode); if (dgus_display.gui_version < 0x30 || dgus_display.os_version < 0x21) { - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_FW_OUTDATED)); + dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_FW_OUTDATED)); return false; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp index 39b3f57e96ca..b27988a89f59 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp @@ -180,15 +180,12 @@ #endif // SDSUPPORT void DGUSTxHandler::PositionZ(DGUS_VP &vp) { - float position = ExtUI::isAxisPositionKnown(ExtUI::Z) ? - planner.get_axis_position_mm(Z_AXIS) - : 0; - - const int16_t data = dgus_display.ToFixedPoint(position); - dgus_display.Write((uint16_t)vp.addr, Swap16(data)); + const float position = ExtUI::isAxisPositionKnown(ExtUI::Z) ? planner.get_axis_position_mm(Z_AXIS) : 0; + const int32_t data = dgus_display.ToFixedPoint(int32_t(position * 50.0f) / 50.0f); // Round to 0.02 + dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data)); } -void DGUSTxHandler::Ellapsed(DGUS_VP &vp) { +void DGUSTxHandler::Elapsed(DGUS_VP &vp) { char buffer[21]; duration_t(print_job_timer.duration()).toString(buffer); @@ -522,7 +519,7 @@ void DGUSTxHandler::PrintTime(DGUS_VP &vp) { dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); #else - dgus_display.WriteStringPGM((uint16_t)vp.addr, DGUS_MSG_UNDEF, vp.size); + dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size); #endif } @@ -533,7 +530,7 @@ void DGUSTxHandler::LongestPrint(DGUS_VP &vp) { dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); #else - dgus_display.WriteStringPGM((uint16_t)vp.addr, DGUS_MSG_UNDEF, vp.size); + dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size); #endif } @@ -544,7 +541,7 @@ void DGUSTxHandler::FilamentUsed(DGUS_VP &vp) { dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); #else - dgus_display.WriteStringPGM((uint16_t)vp.addr, DGUS_MSG_UNDEF, vp.size); + dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size); #endif } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h index aad73dd5d606..161d73f813a4 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h @@ -37,7 +37,7 @@ namespace DGUSTxHandler { #endif void PositionZ(DGUS_VP &); - void Ellapsed(DGUS_VP &); + void Elapsed(DGUS_VP &); void Percent(DGUS_VP &); void StatusIcons(DGUS_VP &); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h index 3fd6d16f5bbd..8cec8e59c9f2 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h @@ -107,10 +107,9 @@ enum class DGUS_Addr : uint16_t { SD_FileName4 = 0x30A5, // 0x30A5 - 0x30C4 SD_ScrollIcons = 0x30C5, // Bits: DGUS_Data::ScrollIcon SD_SelectedFileName = 0x30C6, // 0x30C6 - 0x30E5 - STATUS_PositionZ = 0x30E6, // Type: Fixed point, 1 decimal (16 bits signed) - STATUS_Ellapsed = 0x30E7, // 0x30E7 - 0x30F5 - STATUS_Percent = 0x30F6, // Type: Integer (16 bits unsigned) - STATUS_Icons = 0x30F7, // Bits: DGUS_Data::StatusIcon + STATUS_PositionZ = 0x30E6, // Type: Fixed point, 2 decimal (32 bits signed) + STATUS_Elapsed = 0x30E8, // 0x30E8 - 0x30F6 + STATUS_Percent = 0x30F7, // Type: Integer (16 bits unsigned) ADJUST_Feedrate = 0x30F8, // Type: Integer (16 bits signed) ADJUST_Flowrate_CUR = 0x30F9, // Type: Integer (16 bits signed) #if HAS_MULTI_EXTRUDER @@ -120,11 +119,11 @@ enum class DGUS_Addr : uint16_t { TEMP_Current_Bed = 0x30FC, // Type: Integer (16 bits signed) TEMP_Target_Bed = 0x30FD, // Type: Integer (16 bits signed) TEMP_Max_Bed = 0x30FE, // Type: Integer (16 bits unsigned) - TEMP_Current_H0 = 0x30FF, // Type: Integer (16 bits signed) + TEMP_Current_H0 = 0x30FF, // Type: Fixed point, 1 decimal (16 bits signed) TEMP_Target_H0 = 0x3100, // Type: Integer (16 bits signed) TEMP_Max_H0 = 0x3101, // Type: Integer (16 bits unsigned) #if HAS_MULTI_HOTEND - TEMP_Current_H1 = 0x3102, // Type: Integer (16 bits signed) + TEMP_Current_H1 = 0x3102, // Type: Fixed point, 1 decimal (16 bits signed) TEMP_Target_H1 = 0x3103, // Type: Integer (16 bits signed) TEMP_Max_H1 = 0x3104, // Type: Integer (16 bits unsigned) #endif @@ -156,6 +155,7 @@ enum class DGUS_Addr : uint16_t { INFOS_LongestPrint = 0x318D, // 0x318D - 0x31A4 INFOS_FilamentUsed = 0x31A5, // 0x31A5 - 0x31BC WAIT_Icons = 0x31BD, // Bits: DGUS_Data::WaitIcon + STATUS_Icons = 0x31BE, // Bits: DGUS_Data::StatusIcon // READ-WRITE VARIABLES diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp index 855c0bccfa13..706038f0edf9 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp @@ -56,7 +56,7 @@ constexpr DGUS_Addr LIST_PRINT_STATUS[] PROGMEM = { DGUS_Addr::TEMP_Current_Bed, DGUS_Addr::TEMP_Target_Bed, DGUS_Addr::STATUS_PositionZ, - DGUS_Addr::STATUS_Ellapsed, + DGUS_Addr::STATUS_Elapsed, DGUS_Addr::STATUS_Percent, DGUS_Addr::STATUS_Icons, (DGUS_Addr)0 @@ -78,7 +78,7 @@ constexpr DGUS_Addr LIST_PRINT_FINISHED[] PROGMEM = { DGUS_Addr::TEMP_Current_Bed, DGUS_Addr::TEMP_Target_Bed, DGUS_Addr::STATUS_PositionZ, - DGUS_Addr::STATUS_Ellapsed, + DGUS_Addr::STATUS_Elapsed, DGUS_Addr::STATUS_Percent_Complete, (DGUS_Addr)0 }; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp index 4370a06d046e..3f00dbb0372b 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp @@ -116,8 +116,7 @@ const struct DGUS_VP vp_list[] PROGMEM = { VP_HELPER_RX(DGUS_Addr::LEVEL_MANUAL_Point, &DGUSRxHandler::MoveToPoint), VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Probe, &DGUSRxHandler::Probe), - VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, - &DGUSRxHandler::DisableABL), + VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, &DGUSRxHandler::DisableABL), VP_HELPER_RX(DGUS_Addr::FILAMENT_Select, &DGUSRxHandler::FilamentSelect), VP_HELPER_RX(DGUS_Addr::FILAMENT_SetLength, &DGUSRxHandler::FilamentLength), @@ -177,12 +176,12 @@ const struct DGUS_VP vp_list[] PROGMEM = { VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_PositionZ, nullptr, &DGUSTxHandler::PositionZ), - VP_HELPER(DGUS_Addr::STATUS_Ellapsed, + VP_HELPER(DGUS_Addr::STATUS_Elapsed, DGUS_ELAPSED_LEN, VPFLAG_AUTOUPLOAD, nullptr, nullptr, - &DGUSTxHandler::Ellapsed), + &DGUSTxHandler::Elapsed), VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_Percent, nullptr, &DGUSTxHandler::Percent), @@ -205,14 +204,14 @@ const struct DGUS_VP vp_list[] PROGMEM = { VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_Bed, &thermalManager.temp_bed.celsius, - &DGUSTxHandler::ExtraToInteger), + (&DGUSTxHandler::ExtraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_Bed, &thermalManager.temp_bed.target, &DGUSTxHandler::ExtraToInteger), VP_HELPER_TX(DGUS_Addr::TEMP_Max_Bed, &DGUSTxHandler::TempMax), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H0, &thermalManager.temp_hotend[ExtUI::heater_t::H0].celsius, - &DGUSTxHandler::ExtraToInteger), + (&DGUSTxHandler::ExtraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H0, &thermalManager.temp_hotend[ExtUI::heater_t::H0].target, &DGUSTxHandler::ExtraToInteger), @@ -220,7 +219,7 @@ const struct DGUS_VP vp_list[] PROGMEM = { #if HAS_MULTI_HOTEND VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].celsius, - &DGUSTxHandler::ExtraToInteger), + (&DGUSTxHandler::ExtraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].target, &DGUSTxHandler::ExtraToInteger), 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 9aecf65f984b..fb8ef8cc8458 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -100,11 +100,11 @@ namespace ExtUI { void onPostprocessSettings() {} - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { dgus_screen_handler.ConfigurationStoreWritten(success); } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { dgus_screen_handler.ConfigurationStoreRead(success); } @@ -123,6 +123,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index a5e816efd85c..83b7a0a3cabc 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -88,12 +88,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -112,6 +112,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp index 00cdf76331d6..f607dc102dc1 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp @@ -58,8 +58,8 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .enabled(ENABLED(HAS_TRINAMIC_CONFIG)) .tag(3) .button(TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT)) .enabled(ENABLED(LIN_ADVANCE)) - .tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) - .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED)) + .tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) + .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED_NO_UNITS)) .tag(6) .button(ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) .tag(7) .button(JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) .tag(8) .button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/cocoa_press_ui.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/cocoa_press_ui.h index 6a022289252d..5704371131c6 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/cocoa_press_ui.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/cocoa_press_ui.h @@ -1,4 +1,3 @@ - /**************************************************************************** * 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 * @@ -28,33 +27,26 @@ constexpr float x_max = 480.000000; constexpr float y_min = 0.000000; constexpr float y_max = 272.000000; -const PROGMEM uint16_t syringe_outline[] = {0xED96, 0x14F0, 0xE65D, 0x10E9, 0xDED2, 0x0F9C, 0xD74B, 0x110E, 0xD01B, 0x1543, 0xCE80, 0x1836, 0xCE0A, 0x1C3A, 0xCE0F, 0x27AD, 0xCF0A, 0x2BD3, 0xD127, 0x2E5B, 0xD2A1, 0x2FF0, 0xD2A2, 0x9FC9, 0xD407, 0xA97A, 0xD7B9, 0xB10C, 0xD7BF, 0xBB58, 0xD978, 0xC2BE, 0xDD55, 0xC6EB, 0xDD58, 0xD159, 0xDE3B, 0xD3A8, 0xDFCF, 0xD3AF, 0xE0B8, 0xD04C, 0xE0B8, 0xC6EB, 0xE4A7, 0xC299, 0xE652, 0xBAF6, 0xE652, 0xB10C, 0xEA2E, 0xA8EA, 0xEB6C, 0x9E86, 0xEB6C, 0x2F58, 0xEF3C, 0x2B4E, 0xF003, 0x2583, 0xEFFD, 0x1AC2, 0xED96, 0x14F0, 0xED96, 0x14F0}; -const PROGMEM uint16_t syringe_fluid[] = {0xDE73, 0x2512, 0xDA0C, 0x261D, 0xD5B8, 0x29A0, 0xD4AE, 0x2D87, 0xD4AE, 0x9F60, 0xD585, 0xA63B, 0xDE44, 0xA9DE, 0xE32A, 0xA942, 0xE7E3, 0xA6A5, 0xE930, 0xA342, 0xE95D, 0x9C1D, 0xE95B, 0x31B8, 0xE955, 0x2B63, 0xE867, 0x2A67, 0xE790, 0x28DE, 0xE342, 0x25CB, 0xDE73, 0x2512}; -const PROGMEM uint16_t syringe[] = {0xED91, 0x1502, 0xE658, 0x10FB, 0xDECE, 0x0FAE, 0xD746, 0x1120, 0xD016, 0x1555, 0xCE7B, 0x1848, 0xCE05, 0x1C4D, 0xCE0A, 0x27BF, 0xCF05, 0x2BE5, 0xD122, 0x2E6E, 0xD29C, 0x3002, 0xD29D, 0x9FDB, 0xD402, 0xA98C, 0xD7B4, 0xB11F, 0xD7BA, 0xBB6A, 0xD973, 0xC2D1, 0xDD50, 0xC6FD, 0xDD53, 0xD16C, 0xDE36, 0xD3BA, 0xDFCA, 0xD3C2, 0xE0B3, 0xD05E, 0xE0B3, 0xC6FD, 0xE4A2, 0xC2AB, 0xE64D, 0xBB09, 0xE64D, 0xB11F, 0xEA29, 0xA8FC, 0xEB67, 0x9E98, 0xEB67, 0x2F6B, 0xEF37, 0x2B60, 0xEFFE, 0x2595, 0xEFF8, 0x1AD5, 0xED91, 0x1502, 0xED91, 0x1502, 0xFFFF, 0xD1CF, 0x1A7E, 0xD84F, 0x16DB, 0xDF19, 0x15A9, 0xE5E0, 0x16EA, 0xEC5B, 0x1AA4, 0xEC9D, 0x1D34, 0xEC9D, 0x20CC, 0xE5F1, 0x1D41, 0xDF02, 0x1C12, 0xD812, 0x1D41, 0xD166, 0x20CC, 0xD16C, 0x1B45, 0xD1CF, 0x1A7E, 0xFFFF, 0xE3BD, 0xACFD, 0xDE8E, 0xAF4F, 0xD988, 0xAC0F, 0xD7CC, 0xA8CD, 0xDD1C, 0xAAA9, 0xE287, 0xAA5B, 0xE655, 0xA8BE, 0xE3BD, 0xACFD, 0xFFFF, 0xE802, 0x2DC5, 0xE809, 0x343C, 0xE808, 0x9FC8, 0xE7E3, 0xA296, 0xE70D, 0xA4B1, 0xE2C9, 0xA70E, 0xDE4E, 0xA790, 0xD6A1, 0xA457, 0xD5FF, 0x9F2B, 0xD5FF, 0x2DFD, 0xD6B2, 0x2B72, 0xDA78, 0x2861, 0xDE9D, 0x276F, 0xE300, 0x2824, 0xE70D, 0x2B13, 0xE7FF, 0x2DB6, 0xE800, 0x2DC5, 0xE802, 0x2DC5, 0xFFFF, 0xE2ED, 0xBA8B, 0xE1CC, 0xBF52, 0xDF1C, 0xC165, 0xDC64, 0xBF99, 0xDB1B, 0xBAFF, 0xDB19, 0xB433, 0xDF04, 0xB552, 0xE2EF, 0xB438, 0xE2ED, 0xBA8B, 0xFFFF, 0xEC09, 0x2893, 0xE925, 0x2A08, 0xE57D, 0x261D, 0xE149, 0x246F, 0xDBDE, 0x24A0, 0xD6BC, 0x2795, 0xD484, 0x2A46, 0xD1C0, 0x2853, 0xD166, 0x251E, 0xD80D, 0x2151, 0xDF02, 0x200C, 0xE5F6, 0x2151, 0xEC9D, 0x251E, 0xEC09, 0x2893}; -const PROGMEM uint16_t park_btn[] = {0x0AAA, 0x0E1E, 0x57FF, 0x0E1E, 0x57FF, 0x33C3, 0x0AAA, 0x33C3, 0x0AAA, 0x0E1E}; -const PROGMEM uint16_t pause_btn[] = {0x47FF, 0xCA58, 0x7FFF, 0xCA58, 0x7FFF, 0xEFFE, 0x47FF, 0xEFFE, 0x47FF, 0xCA58}; -const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAA, 0x3D2C, 0x57FF, 0x3D2C, 0x57FF, 0x62D2, 0x0AAA, 0x62D2, 0x0AAA, 0x3D2C}; -const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAA, 0x6C3B, 0x57FF, 0x6C3B, 0x57FF, 0x91E0, 0x0AAA, 0x91E0, 0x0AAA, 0x6C3B}; -const PROGMEM uint16_t menu_btn[] = {0x0AAA, 0x9B4A, 0x57FF, 0x9B4A, 0x57FF, 0xC0EF, 0x0AAA, 0xC0EF, 0x0AAA, 0x9B4A}; -const PROGMEM uint16_t print_btn[] = {0x0AAA, 0xCA58, 0x42AA, 0xCA58, 0x42AA, 0xEFFE, 0x0AAA, 0xEFFE, 0x0AAA, 0xCA58}; -const PROGMEM uint16_t stop_btn[] = {0x8554, 0xCA58, 0xBD53, 0xCA58, 0xBD53, 0xEFFE, 0x8554, 0xEFFE, 0x8554, 0xCA58}; -const PROGMEM uint16_t print_time_hms[] = {0x62A9, 0xA968, 0x8FFE, 0xA968, 0x8FFE, 0xC0EF, 0x62A9, 0xC0EF, 0x62A9, 0xA968}; -const PROGMEM uint16_t print_time_percent[] = {0x8FFE, 0xA968, 0xBD53, 0xA968, 0xBD53, 0xC0EF, 0x8FFE, 0xC0EF, 0x8FFE, 0xA968}; -const PROGMEM uint16_t print_time_label[] = {0x62A9, 0x91E0, 0xBD53, 0x91E0, 0xBD53, 0xA986, 0x62A9, 0xA986, 0x62A9, 0x91E0}; -const PROGMEM uint16_t h3_temp[] = {0x62A9, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x8D2C, 0x62A9, 0x8D2C, 0x62A9, 0x75A4}; -const PROGMEM uint16_t h3_label[] = {0x62A9, 0x5E1D, 0x8FFE, 0x5E1D, 0x8FFE, 0x75A4, 0x62A9, 0x75A4, 0x62A9, 0x5E1D}; -const PROGMEM uint16_t chocolate_label[] = {0x62A9, 0x12D2, 0xBD53, 0x12D2, 0xBD53, 0x2A5A, 0x62A9, 0x2A5A, 0x62A9, 0x12D2}; -const PROGMEM uint16_t h0_label[] = {0x62A9, 0x2A5A, 0x8FFE, 0x2A5A, 0x8FFE, 0x41E1, 0x62A9, 0x41E1, 0x62A9, 0x2A5A}; -const PROGMEM uint16_t h0_temp[] = {0x62A9, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x5968, 0x62A9, 0x5968, 0x62A9, 0x41E1}; -const PROGMEM uint16_t h1_label[] = {0x8FFE, 0x2A5A, 0xBD53, 0x2A5A, 0xBD53, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x2A5A}; -const PROGMEM uint16_t h1_temp[] = {0x8FFE, 0x41E1, 0xBD53, 0x41E1, 0xBD53, 0x5968, 0x8FFE, 0x5968, 0x8FFE, 0x41E1}; -const PROGMEM uint16_t h2_label[] = {0x8FFE, 0x5E1D, 0xBD53, 0x5E1D, 0xBD53, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x5E1D}; -const PROGMEM uint16_t h2_temp[] = {0x8FFE, 0x75A4, 0xBD53, 0x75A4, 0xBD53, 0x8D2C, 0x8FFE, 0x8D2C, 0x8FFE, 0x75A4}; -const PROGMEM uint16_t extrude_btn[] = {0xC859, 0xDD2B, 0xF5AE, 0xDD2B, 0xF5AE, 0xEFFE, 0xC859, 0xEFFE, 0xC859, 0xDD2B}; -const PROGMEM uint16_t load_screen_extrude[] = {0x25FB, 0x89AE, 0x2F58, 0x89AE, 0x2F58, 0xAAF6, 0x3406, 0xAAF6, 0x2AAA, 0xBB9A, 0x214D, 0xAAF6, 0x25FB, 0xAAF6, 0x25FB, 0x89AE}; -const PROGMEM uint16_t load_screen_retract[] = {0x25FC, 0x790A, 0x2F58, 0x790A, 0x2F58, 0x57C2, 0x3406, 0x57C2, 0x2AAA, 0x471D, 0x214D, 0x57C2, 0x25FC, 0x57C2, 0x25FC, 0x790A}; -const PROGMEM uint16_t load_screen_back_btn[] = {0x1555, 0xCA58, 0xC553, 0xCA58, 0xC553, 0xEFFE, 0x1555, 0xEFFE, 0x1555, 0xCA58}; -const PROGMEM uint16_t load_screen_unload_btn[] = {0x4AAA, 0x8EBD, 0xC553, 0x8EBD, 0xC553, 0xB463, 0x4AAA, 0xB463, 0x4AAA, 0x8EBD}; -const PROGMEM uint16_t load_screen_load_btn[] = {0x4AAA, 0x5322, 0xC553, 0x5322, 0xC553, 0x78C7, 0x4AAA, 0x78C7, 0x4AAA, 0x5322}; -const PROGMEM uint16_t load_sreen_title[] = {0x4AAA, 0x1787, 0xC553, 0x1787, 0xC553, 0x3D2C, 0x4AAA, 0x3D2C, 0x4AAA, 0x1787}; -const PROGMEM uint16_t load_screen_increment[] = {0x1555, 0x2E1D, 0x3FFF, 0x2E1D, 0x3FFF, 0x3D2C, 0x1555, 0x3D2C, 0x1555, 0x2E1D}; +const PROGMEM uint16_t menu_btn[] = {0x0AAA, 0x0E1E, 0x6D54, 0x0E1E, 0x6D54, 0x2F0E, 0x0AAA, 0x2F0E, 0x0AAA, 0x0E1E}; +const PROGMEM uint16_t print_btn[] = {0x47FF, 0xCF0D, 0x7FFF, 0xCF0D, 0x7FFF, 0xEFFE, 0x47FF, 0xEFFE, 0x47FF, 0xCF0D}; +const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAA, 0x3878, 0x6D54, 0x3878, 0x6D54, 0x5968, 0x0AAA, 0x5968, 0x0AAA, 0x3878}; +const PROGMEM uint16_t extrude_btn[] = {0x0AAA, 0x5E1D, 0x6D54, 0x5E1D, 0x6D54, 0x7F0E, 0x0AAA, 0x7F0E, 0x0AAA, 0x5E1D}; +const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAA, 0x83C2, 0x6D54, 0x83C2, 0x6D54, 0xA4B3, 0x0AAA, 0xA4B3, 0x0AAA, 0x83C2}; +const PROGMEM uint16_t media_btn[] = {0x0AAA, 0xCF0D, 0x42AA, 0xCF0D, 0x42AA, 0xEFFE, 0x0AAA, 0xEFFE, 0x0AAA, 0xCF0D}; +const PROGMEM uint16_t pause_btn[] = {0x8554, 0xCF0D, 0xBD53, 0xCF0D, 0xBD53, 0xEFFE, 0x8554, 0xEFFE, 0x8554, 0xCF0D}; +const PROGMEM uint16_t print_time_hms[] = {0xC59E, 0xAEA0, 0xF510, 0xAEA0, 0xF510, 0xC52D, 0xC59E, 0xC52D, 0xC59E, 0xAEA0}; +const PROGMEM uint16_t file_name[] = {0x0B0E, 0xAECD, 0xBCEF, 0xAECD, 0xBCEF, 0xC4AB, 0x0B0E, 0xC4AB, 0x0B0E, 0xAECD}; +const PROGMEM uint16_t chocolate_label[] = {0x75C1, 0x1369, 0xF4FE, 0x1369, 0xF4FE, 0x2AB1, 0x75C1, 0x2AB1, 0x75C1, 0x1369}; +const PROGMEM uint16_t h0_label[] = {0x8304, 0x4BEB, 0xB271, 0x4BEB, 0xB271, 0x63B0, 0x8304, 0x63B0, 0x8304, 0x4BEB}; +const PROGMEM uint16_t h0_temp[] = {0x8304, 0x7190, 0xB271, 0x7190, 0xB271, 0x8955, 0x8304, 0x8955, 0x8304, 0x7190}; +const PROGMEM uint16_t h1_label[] = {0xBB04, 0x4BEB, 0xEA71, 0x4BEB, 0xEA71, 0x63B0, 0xBB04, 0x63B0, 0xBB04, 0x4BEB}; +const PROGMEM uint16_t h1_temp[] = {0xBB04, 0x7190, 0xEA71, 0x7190, 0xEA71, 0x8956, 0xBB04, 0x8956, 0xBB04, 0x7190}; +const PROGMEM uint16_t stop_btn[] = {0xC2A9, 0xCF0D, 0xF553, 0xCF0D, 0xF553, 0xEFFE, 0xC2A9, 0xEFFE, 0xC2A9, 0xCF0D}; +const PROGMEM uint16_t load_screen_extrude[] = {0x382C, 0x8B02, 0x4188, 0x8B02, 0x4188, 0xAC4A, 0x4637, 0xAC4A, 0x3CDA, 0xBCEE, 0x337D, 0xAC4A, 0x382C, 0xAC4A, 0x382C, 0x8B02}; +const PROGMEM uint16_t load_screen_retract[] = {0x382C, 0x7A5D, 0x4188, 0x7A5D, 0x4188, 0x5915, 0x4637, 0x5915, 0x3CDA, 0x4871, 0x337E, 0x5915, 0x382C, 0x5915, 0x382C, 0x7A5D}; +const PROGMEM uint16_t load_screen_back_btn[] = {0x1555, 0xCA58, 0xEAA8, 0xCA58, 0xEAA8, 0xEFFE, 0x1555, 0xEFFE, 0x1555, 0xCA58}; +const PROGMEM uint16_t load_screen_unload_btn[] = {0x67FF, 0x70F0, 0xEAA8, 0x70F0, 0xEAA8, 0x9695, 0x67FF, 0x9695, 0x67FF, 0x70F0}; +const PROGMEM uint16_t load_screen_start_stop_btn[] = {0x67FF, 0x9B4A, 0xEAA8, 0x9B4A, 0xEAA8, 0xC0EF, 0x67FF, 0xC0EF, 0x67FF, 0x9B4A}; +const PROGMEM uint16_t load_screen_load_btn[] = {0x67FF, 0x4696, 0xEAA8, 0x4696, 0xEAA8, 0x6C3B, 0x67FF, 0x6C3B, 0x67FF, 0x4696}; +const PROGMEM uint16_t load_screen_continuous[] = {0x67FF, 0x1787, 0xEAA8, 0x1787, 0xEAA8, 0x3D2C, 0x67FF, 0x3D2C, 0x67FF, 0x1787}; +const PROGMEM uint16_t load_screen_increment[] = {0x1555, 0x1787, 0x62A9, 0x1787, 0x62A9, 0x3D2C, 0x1555, 0x3D2C, 0x1555, 0x1787}; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.cpp new file mode 100644 index 000000000000..ca98e7c9b6d4 --- /dev/null +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.cpp @@ -0,0 +1,55 @@ +/************************************** + * confirm_start_print_dialog_box.cpp * + **************************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * 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 "../config.h" +#include "../screens.h" + +#ifdef COCOA_CONFIRM_START_PRINT + +using namespace FTDI; +using namespace Theme; +using namespace ExtUI; + +void ConfirmStartPrintDialogBox::onRedraw(draw_mode_t) { + FileList files; + const char *filename = files.filename(); + char buffer[strlen_P(GET_TEXT(MSG_START_PRINT_CONFIRMATION)) + strlen(filename) + 1]; + sprintf_P(buffer, GET_TEXT(MSG_START_PRINT_CONFIRMATION), filename); + drawMessage((const char *)buffer); + drawYesNoButtons(); +} + +bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) { + switch (tag) { + case 1: { + FileList files; + printFile(files.shortFilename()); + StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PRINT_STARTING)); + GOTO_SCREEN(StatusScreen); + return true; + } + case 2: GOTO_PREVIOUS(); return true; + default: return false; + } +} + +#endif // COCOA_CONFIRM_START_PRINT diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.h new file mode 100644 index 000000000000..38cb5c2774bf --- /dev/null +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.h @@ -0,0 +1,32 @@ +/************************************ + * confirm_start_print_dialog_box.h * + ************************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * 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: . * + ****************************************************************************/ + +#pragma once + +#define COCOA_CONFIRM_START_PRINT +#define COCOA_CONFIRM_START_PRINT_CLASS ConfirmStartPrintDialogBox + +class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t); +}; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.cpp new file mode 100644 index 000000000000..581c3374288b --- /dev/null +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.cpp @@ -0,0 +1,289 @@ +/******************** + * files_screen.cpp * + ********************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * 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 "../config.h" +#include "../screens.h" +#include "../screen_data.h" + +#ifdef COCOA_FILES_SCREEN + +#if ENABLED(TOUCH_UI_PORTRAIT) + #define GRID_COLS 6 + #define GRID_ROWS 15 + #define FILES_PER_PAGE 11 + #define PREV_DIR LEFT + #define NEXT_DIR RIGHT + + #define PREV_POS BTN_POS(1,1), BTN_SIZE(1,2) + #define HEAD_POS BTN_POS(2,1), BTN_SIZE(4,2) + #define NEXT_POS BTN_POS(6,1), BTN_SIZE(1,2) + #define LIST_POS BTN_POS(1,3), BTN_SIZE(6,FILES_PER_PAGE) + #define BTN1_POS BTN_POS(1,14), BTN_SIZE(3,2) + #define BTN2_POS BTN_POS(4,14), BTN_SIZE(3,2) +#else + #define GRID_COLS 12 + #define GRID_ROWS 8 + #define FILES_PER_PAGE 6 + #define PREV_DIR UP + #define NEXT_DIR DOWN + + #define PREV_POS BTN_POS(12,2), BTN_SIZE(1,3) + #define HEAD_POS BTN_POS( 1,1), BTN_SIZE(12,1) + #define NEXT_POS BTN_POS(12,5), BTN_SIZE(1,4) + #define LIST_POS BTN_POS( 1,2), BTN_SIZE(11,FILES_PER_PAGE) + #define BTN1_POS BTN_POS( 1,8), BTN_SIZE(6,1) + #define BTN2_POS BTN_POS( 7,8), BTN_SIZE(5,1) +#endif + +using namespace FTDI; +using namespace ExtUI; +using namespace Theme; + +constexpr static FilesScreenData &mydata = screen_data.FilesScreen; + +void FilesScreen::onEntry() { + mydata.cur_page = 0; + mydata.selected_tag = 0xFF; + #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) + CLCD::mem_write_32(CLCD::REG::MACRO_0,DL::NOP); + #endif + gotoPage(0); + BaseScreen::onEntry(); +} + +const char *FilesScreen::getSelectedFilename(bool shortName) { + FileList files; + files.seek(getSelectedFileIndex(), true); + return shortName ? files.shortFilename() : files.filename(); +} + +void FilesScreen::drawSelectedFile() { + if(mydata.selected_tag == 0xFF) return; + FileList files; + files.seek(getSelectedFileIndex(), true); + mydata.flags.is_dir = files.isDir(); + drawFileButton( + files.filename(), + mydata.selected_tag, + mydata.flags.is_dir, + true + ); +} + +uint16_t FilesScreen::getSelectedFileIndex() { + return getFileForTag(mydata.selected_tag); +} + +uint16_t FilesScreen::getFileForTag(uint8_t tag) { + return mydata.cur_page * FILES_PER_PAGE + tag - 2; +} + +void FilesScreen::drawFileButton(int x, int y, int w, int h, const char *filename, uint8_t tag, bool is_dir, bool is_highlighted) { + #define SUB_COLS 6 + #define SUB_ROWS FILES_PER_PAGE + + const int bx = SUB_X(1); + const int by = SUB_Y(getLineForTag(tag)+1); + const int bw = SUB_W(6); + const int bh = SUB_H(1); + + CommandProcessor cmd; + cmd.tag(tag); + cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color)); + cmd.font(font_medium).rectangle(bx, by, bw, bh); + cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled)); + #if ENABLED(SCROLL_LONG_FILENAMES) + if (is_highlighted) { + cmd.cmd(SAVE_CONTEXT()); + cmd.cmd(SCISSOR_XY(x,y)); + cmd.cmd(SCISSOR_SIZE(w,h)); + cmd.cmd(MACRO(0)); + cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT); + } else + #endif + draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium); + if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX); + #if ENABLED(SCROLL_LONG_FILENAMES) + if (is_highlighted) cmd.cmd(RESTORE_CONTEXT()); + #endif +} + +void FilesScreen::drawFileList() { + FileList files; + mydata.num_page = max(1,ceil(float(files.count()) / FILES_PER_PAGE)); + mydata.cur_page = min(mydata.cur_page, mydata.num_page-1); + mydata.flags.is_root = files.isAtRootDir(); + mydata.flags.is_empty = true; + + uint16_t fileIndex = mydata.cur_page * FILES_PER_PAGE; + for (uint8_t i = 0; i < FILES_PER_PAGE; i++, fileIndex++) { + if (files.seek(fileIndex)) { + drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false); + mydata.flags.is_empty = false; + } else + break; + } +} + +void FilesScreen::drawHeader() { + char str[16]; + sprintf_P(str, PSTR("Page %d of %d"), mydata.cur_page + 1, mydata.num_page); + + CommandProcessor cmd; + cmd.colors(normal_btn) + .font(font_small) + .tag(0).button(HEAD_POS, str, OPT_CENTER | OPT_FLAT); +} + +void FilesScreen::drawArrows() { + const bool prev_enabled = mydata.cur_page > 0; + const bool next_enabled = mydata.cur_page < (mydata.num_page - 1); + + CommandProcessor cmd; + cmd.colors(normal_btn); + cmd.tag(242).enabled(prev_enabled).button(PREV_POS, F("")); if (prev_enabled) drawArrow(PREV_POS, PREV_DIR); + cmd.tag(243).enabled(next_enabled).button(NEXT_POS, F("")); if (next_enabled) drawArrow(NEXT_POS, NEXT_DIR); +} + +void FilesScreen::drawFooter() { + const bool has_selection = mydata.selected_tag != 0xFF; + + CommandProcessor cmd; + cmd.colors(normal_btn) + .font(font_medium) + .colors(normal_btn) + .enabled(!mydata.flags.is_root) + .tag(245).button(BTN2_POS, F("Up Dir")) + .colors(action_btn); + + if (mydata.flags.is_empty) + cmd.tag(240).button(BTN1_POS, GET_TEXT_F(MSG_BUTTON_DONE)); + else if (has_selection && mydata.flags.is_dir) + cmd.tag(244).button(BTN1_POS, GET_TEXT_F(MSG_BUTTON_OPEN)); + else + cmd.tag(241).enabled(has_selection).button(BTN1_POS, F("Select")); +} + +void FilesScreen::drawFileButton(const char *filename, uint8_t tag, bool is_dir, bool is_highlighted) { + #undef MARGIN_L + #undef MARGIN_R + #define MARGIN_L 0 + #define MARGIN_R 0 + drawFileButton(LIST_POS, filename, tag, is_dir, is_highlighted); +} + +void FilesScreen::onRedraw(draw_mode_t what) { + if (what & FOREGROUND) { + drawHeader(); + drawArrows(); + drawSelectedFile(); + drawFooter(); + } +} + +void FilesScreen::gotoPage(uint8_t page) { + mydata.selected_tag = 0xFF; + mydata.cur_page = page; + CommandProcessor cmd; + cmd.cmd(CMD_DLSTART) + .cmd(CLEAR_COLOR_RGB(bg_color)) + .cmd(CLEAR(true,true,true)) + .colors(normal_btn); + drawFileList(); + storeBackground(); +} + +bool FilesScreen::onTouchEnd(uint8_t tag) { + switch (tag) { + case 240: // Done button, always select first file + { + FileList files; + files.seek(0); + GOTO_PREVIOUS(); + } + return true; + case 241: // Select highlighted file + GOTO_PREVIOUS(); + return true; + case 242: // Previous page + if (mydata.cur_page > 0) { + gotoPage(mydata.cur_page-1); + } + break; + case 243: // Next page + if (mydata.cur_page < (mydata.num_page-1)) { + gotoPage(mydata.cur_page+1); + } + break; + case 244: // Select directory + { + FileList files; + files.changeDir(getSelectedShortFilename()); + gotoPage(0); + } + break; + case 245: // Up directory + { + FileList files; + files.upDir(); + gotoPage(0); + } + break; + default: // File selected + if (tag < 240) { + mydata.selected_tag = tag; + #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) + mydata.scroll_pos = 0; + mydata.scroll_max = 0; + if (FTDI::ftdi_chip >= 810) { + const char *filename = getSelectedFilename(); + if (filename[0]) { + CommandProcessor cmd; + constexpr int dim[4] = {LIST_POS}; + const uint16_t text_width = cmd.font(font_medium).text_width(filename); + if (text_width > dim[2]) + mydata.scroll_max = text_width - dim[2] + MARGIN_L + MARGIN_R + 10; + } + } + #endif + } + break; + } + return true; +} + +void FilesScreen::onIdle() { + #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) + if (FTDI::ftdi_chip >= 810) { + CLCD::mem_write_32(CLCD::REG::MACRO_0, + VERTEX_TRANSLATE_X(-int32_t(mydata.scroll_pos))); + if (mydata.scroll_pos < mydata.scroll_max * 16) + mydata.scroll_pos++; + } + #endif +} + +void FilesScreen::onMediaRemoved() { + if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen); +} + +#endif // COCOA_FILES_SCREEN diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.h new file mode 100644 index 000000000000..99ea52ff817b --- /dev/null +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.h @@ -0,0 +1,68 @@ +/****************** + * files_screen.h * + ******************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * 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: . * + ****************************************************************************/ + +#pragma once + +#define COCOA_FILES_SCREEN +#define COCOA_FILES_SCREEN_CLASS FilesScreen + +struct FilesScreenData { + struct { + uint8_t is_dir : 1; + uint8_t is_root : 1; + uint8_t is_empty : 1; + } flags; + uint8_t selected_tag; + uint8_t num_page; + uint8_t cur_page; + #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) + uint16_t scroll_pos; + uint16_t scroll_max; + #endif +}; + +class FilesScreen : public BaseScreen, public CachedScreen { + private: + static uint8_t getTagForLine(uint8_t line) {return line + 2;} + static uint8_t getLineForTag(uint8_t tag) {return tag - 2;} + static uint16_t getFileForTag(uint8_t tag); + static uint16_t getSelectedFileIndex(); + + inline static const char *getSelectedShortFilename() {return getSelectedFilename(true);} + static const char *getSelectedFilename(bool shortName = false); + + static void drawFileButton(int x, int y, int w, int h, const char *filename, uint8_t tag, bool is_dir, bool is_highlighted); + static void drawFileButton(const char *filename, uint8_t tag, bool is_dir, bool is_highlighted); + static void drawFileList(); + static void drawHeader(); + static void drawArrows(); + static void drawFooter(); + static void drawSelectedFile(); + + static void gotoPage(uint8_t); + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); + static void onMediaRemoved(); +}; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp index 5e61bdb12f18..be18c0348388 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp @@ -57,7 +57,9 @@ void LevelingMenu::onRedraw(draw_mode_t what) { cmd.font(font_large) .cmd(COLOR_RGB(bg_text_enabled)) .text(BED_MESH_TITLE_POS, GET_TEXT_F(MSG_BED_LEVELING)) + #if ENABLED(BLTOUCH) .text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) + #endif .font(font_medium).colors(normal_btn) .tag(2).button(PROBE_BED_POS, GET_TEXT_F(MSG_PROBE_BED)) .enabled(ENABLED(HAS_MESH)) @@ -66,8 +68,10 @@ void LevelingMenu::onRedraw(draw_mode_t what) { .tag(4).button(EDIT_MESH_POS, GET_TEXT_F(MSG_EDIT_MESH)) #undef GRID_COLS #define GRID_COLS 2 + #if ENABLED(BLTOUCH) .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)) + #endif #undef GRID_COLS #define GRID_COLS 3 .colors(action_btn) @@ -81,8 +85,10 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) { case 2: BedMeshViewScreen::doProbe(); break; case 3: BedMeshViewScreen::show(); break; case 4: BedMeshEditScreen::show(); break; + #if ENABLED(BLTOUCH) case 5: injectCommands(F("M280 P0 S60")); break; case 6: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; + #endif default: return false; } return true; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp index d40b3be35460..95ddf7d387f7 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp @@ -39,42 +39,6 @@ using namespace Theme; constexpr static LoadChocolateScreenData &mydata = screen_data.LoadChocolateScreen; -void LoadChocolateScreen::draw_syringe(draw_mode_t what) { - #if ENABLED(COCOA_PRESS_CHOCOLATE_LEVEL_SENSOR) - const float fill_level = get_chocolate_fill_level(); - #else - constexpr float fill_level = 1.0f; - #endif - - CommandProcessor cmd; - PolyUI ui(cmd, what); - - if (what & BACKGROUND) { - // Paint the shadow for the syringe - ui.color(shadow_rgb); - ui.shadow(POLY(syringe_outline), shadow_depth); - } - - if (what & FOREGROUND) { - int16_t x, y, h, v; - - // Paint the syringe icon - ui.color(syringe_rgb); - ui.fill(POLY(syringe_outline)); - - ui.color(fluid_rgb); - ui.bounds(POLY(syringe_fluid), x, y, h, v); - cmd.cmd(SAVE_CONTEXT()); - cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level))); - cmd.cmd(SCISSOR_SIZE(h, v * fill_level)); - ui.fill(POLY(syringe_fluid), false); - cmd.cmd(RESTORE_CONTEXT()); - - ui.color(stroke_rgb); - ui.fill(POLY(syringe)); - } -} - void LoadChocolateScreen::draw_buttons(draw_mode_t what) { int16_t x, y, h, v; @@ -84,10 +48,18 @@ void LoadChocolateScreen::draw_buttons(draw_mode_t what) { cmd.font(font_medium).colors(normal_btn); ui.bounds(POLY(load_screen_unload_btn), x, y, h, v); - cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_FULL_UNLOAD)); + cmd.tag(2).colors(mydata.repeat_tag == 5 ? action_btn : normal_btn).button(x, y, h, v, GET_TEXT_F(MSG_UNLOAD)); ui.bounds(POLY(load_screen_load_btn), x, y, h, v); - cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_FULL_LOAD)); + cmd.tag(3).colors(mydata.repeat_tag == 6 ? action_btn : normal_btn).button(x, y, h, v, GET_TEXT_F(MSG_LOAD)); + + ui.bounds(POLY(load_screen_start_stop_btn), x, y, h, v); + if(mydata.repeat_tag == 0) { + cmd.colors(normal_btn).enabled(false); + } else { + cmd.colors(mydata.repeating ? action_btn : normal_btn).enabled(true); + } + cmd.tag(4).button(x, y, h, v, GET_TEXT_F(MSG_START_STOP)); ui.bounds(POLY(load_screen_back_btn), x, y, h, v); cmd.tag(1).colors(action_btn).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_DONE)); @@ -102,8 +74,8 @@ void LoadChocolateScreen::draw_text(draw_mode_t what) { cmd.font(font_medium).cmd(COLOR_RGB(bg_text_enabled)); - ui.bounds(POLY(load_sreen_title), x, y, h, v); - cmd.tag(2).text(x, y, h, v, GET_TEXT_F(MSG_LOAD_UNLOAD)); + ui.bounds(POLY(load_screen_continuous), x, y, h, v); + cmd.tag(2).text(x, y, h, v, GET_TEXT_F(MSG_CONTINUOUS)); ui.bounds(POLY(load_screen_increment), x, y, h, v); cmd.tag(3).text(x, y, h, v, GET_TEXT_F(MSG_INCREMENT)); @@ -120,11 +92,12 @@ void LoadChocolateScreen::draw_arrows(draw_mode_t what) { constexpr uint8_t style = PolyUI::REGULAR; - ui.button(4, POLY(load_screen_extrude), style); - ui.button(5, POLY(load_screen_retract), style); + ui.button(5, POLY(load_screen_extrude), style); + ui.button(6, POLY(load_screen_retract), style); } void LoadChocolateScreen::onEntry() { + mydata.repeating = false; mydata.repeat_tag = 0; } @@ -136,14 +109,15 @@ void LoadChocolateScreen::onRedraw(draw_mode_t what) { .tag(0); } - draw_syringe(what); draw_arrows(what); draw_buttons(what); draw_text(what); } -bool LoadChocolateScreen::onTouchStart(uint8_t) { - mydata.repeat_tag = 0; +bool LoadChocolateScreen::onTouchStart(uint8_t tag) { + if(tag != 4) { + mydata.repeating = false; + } return true; } @@ -151,10 +125,13 @@ bool LoadChocolateScreen::onTouchEnd(uint8_t tag) { using namespace ExtUI; switch (tag) { case 2: - mydata.repeat_tag = (mydata.repeat_tag == 2) ? 0 : 2; + mydata.repeat_tag = 5; break; case 3: - mydata.repeat_tag = (mydata.repeat_tag == 3) ? 0 : 3; + mydata.repeat_tag = 6; + break; + case 4: + mydata.repeating = !mydata.repeating; break; case 1: GOTO_PREVIOUS(); break; } @@ -176,26 +153,10 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) { #define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); #define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); switch (tag) { - case 2: { - if (get_chocolate_fill_level() < 0.1) { - mydata.repeat_tag = 0; - return false; - } - UI_INCREMENT_AXIS(E0); - break; - } - case 3: { - if (get_chocolate_fill_level() > 0.75) { - mydata.repeat_tag = 0; - return false; - } - UI_DECREMENT_AXIS(E0); - break; - } - case 4: + case 5: UI_INCREMENT_AXIS(E0); break; - case 5: + case 6: UI_DECREMENT_AXIS(E0); break; default: return false; @@ -207,7 +168,7 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) { void LoadChocolateScreen::onIdle() { reset_menu_timeout(); - if (mydata.repeat_tag) onTouchHeld(mydata.repeat_tag); + if (mydata.repeating) onTouchHeld(mydata.repeat_tag); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { if (!EventLoop::is_touch_held()) onRefresh(); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.h index 4a582f0212f8..426669775d66 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.h @@ -28,11 +28,11 @@ struct LoadChocolateScreenData { uint8_t repeat_tag; + bool repeating; }; class LoadChocolateScreen : public BaseScreen, public CachedScreen { private: - static void draw_syringe(draw_mode_t what); static void draw_arrows(draw_mode_t what); static void draw_buttons(draw_mode_t what); static void draw_text(draw_mode_t what); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp index b01aa81dd441..2fabb81ee4db 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp @@ -32,7 +32,7 @@ using namespace Theme; #define GRID_ROWS 5 void PreheatMenu::onRedraw(draw_mode_t what) { - const int16_t w = TERN0(COCOA_PRESS_EXTRA_HEATER, has_extra_heater() ? BTN_W(1) : BTN_W(2)); + const int16_t w = TERN0(COCOA_PRESS_EXTRA_HEATER, has_extra_heater()) ? BTN_W(1) : BTN_W(2); const int16_t h = BTN_H(1); if (what & BACKGROUND) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h index 8481e446c425..5276f64f4429 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h @@ -90,7 +90,6 @@ enum { #include "../generic/spinner_dialog_box.h" #include "../generic/restore_failsafe_dialog_box.h" #include "../generic/save_settings_dialog_box.h" -#include "../generic/confirm_start_print_dialog_box.h" #include "../generic/confirm_abort_print_dialog_box.h" #include "../generic/confirm_user_request_alert_box.h" #include "../generic/touch_calibration_screen.h" @@ -114,7 +113,6 @@ enum { #include "../generic/bed_mesh_edit_screen.h" #include "../generic/case_light_screen.h" #include "../generic/linear_advance_screen.h" -#include "../generic/files_screen.h" #include "../generic/move_axis_screen.h" #include "../generic/flow_percent_screen.h" #if HAS_JUNCTION_DEVIATION @@ -132,3 +130,5 @@ enum { #include "leveling_menu.h" #include "move_xyz_screen.h" #include "move_e_screen.h" +#include "files_screen.h" +#include "confirm_start_print_dialog_box.h" diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp index 00b2d6a0943e..eddf36723977 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp @@ -29,6 +29,8 @@ #include "cocoa_press_ui.h" #define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0])) +#define ICON_POS(x,y,w,h) x, y, h, h +#define TEXT_POS(x,y,w,h) x + h, y, w - h, h const uint8_t shadow_depth = 5; @@ -38,8 +40,28 @@ using namespace ExtUI; float StatusScreen::increment; +void StatusScreen::_format_time(char *outstr, uint32_t time) { + const uint8_t hrs = time / 3600, + min = (time / 60) % 60, + sec = time % 60; + if (hrs) + sprintf_P(outstr, PSTR("%02d:%02d"), hrs, min); + else + sprintf_P(outstr, PSTR("%02d:%02ds"), min, sec); +} + void StatusScreen::loadBitmaps() { + // Load the bitmaps for the status screen + using namespace Theme; constexpr uint32_t base = ftdi_memory_map::RAM_G; + CLCD::mem_write_xbm(base + Light_Bulb_Info.RAMG_offset, Light_Bulb, sizeof(Light_Bulb)); + CLCD::mem_write_xbm(base + Chamber_Icon_Info.RAMG_offset, Chamber_Icon, sizeof(Chamber_Icon)); + CLCD::mem_write_xbm(base + Clock_Icon_Info.RAMG_offset, Clock_Icon, sizeof(Clock_Icon)); + CLCD::mem_write_xbm(base + File_Icon_Info.RAMG_offset, File_Icon, sizeof(File_Icon)); + CLCD::mem_write_xbm(base + TD_Icon_Info.RAMG_offset, TD_Icon, sizeof(TD_Icon)); + CLCD::mem_write_xbm(base + Extruder_Icon_Info.RAMG_offset, Extruder_Icon, sizeof(Extruder_Icon)); + CLCD::mem_write_xbm(base + Bed_Heat_Icon_Info.RAMG_offset, Bed_Heat_Icon, sizeof(Bed_Heat_Icon)); + CLCD::mem_write_xbm(base + Fan_Icon_Info.RAMG_offset, Fan_Icon, sizeof(Fan_Icon)); // Load fonts for internationalization #if ENABLED(TOUCH_UI_USE_UTF8) @@ -47,33 +69,50 @@ void StatusScreen::loadBitmaps() { #endif } -void StatusScreen::draw_progress(draw_mode_t what) { +void StatusScreen::draw_time(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); - int16_t x, y, h, v; - - cmd.cmd(COLOR_RGB(accent_color_1)); - cmd.font(font_medium); + int16_t x, y, w, h; + ui.bounds(POLY(print_time_hms), x, y, w, h); if (what & BACKGROUND) { - ui.bounds(POLY(print_time_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_ELAPSED_PRINT)); + cmd.cmd(COLOR_RGB(bg_text_enabled)) + .cmd (BITMAP_SOURCE(Clock_Icon_Info)) + .cmd (BITMAP_LAYOUT(Clock_Icon_Info)) + .cmd (BITMAP_SIZE (Clock_Icon_Info)) + .icon(ICON_POS(x, y, w, h), Clock_Icon_Info, icon_scale) + .cmd(COLOR_RGB(bg_text_enabled)); } if (what & FOREGROUND) { const uint32_t elapsed = getProgress_seconds_elapsed(); - const uint8_t hrs = elapsed/3600; - const uint8_t min = (elapsed/60)%60; + char elapsed_str[10]; + _format_time(elapsed_str, elapsed); + + cmd.font(font_medium) + .cmd(COLOR_RGB(bg_text_enabled)) + .text(TEXT_POS(x, y, w, h), elapsed_str); + } +} + + +void StatusScreen::draw_progress(draw_mode_t what) { + CommandProcessor cmd; + PolyUI ui(cmd, what); - char str[10]; - sprintf_P(str, PSTR(" %02d : %02d"), hrs, min); - ui.bounds(POLY(print_time_hms), x, y, h, v); - cmd.text(x, y, h, v, str); + int16_t x, y, w, h; - sprintf_P(str, PSTR("%-3d%%"), getProgress_percent() ); - ui.bounds(POLY(print_time_percent), x, y, h, v); - cmd.text(x, y, h, v, str); + cmd.cmd(COLOR_RGB(accent_color_1)); + cmd.font(font_medium); + + if (what & FOREGROUND) { + // Draw progress bar + ui.bounds(POLY(file_name), x, y, w, h); + const uint16_t bar_width = w * getProgress_percent() / 100; + cmd.tag(8) + .cmd(COLOR_RGB(accent_color_5)) + .rectangle(x, y, bar_width, h); } } @@ -81,30 +120,38 @@ void StatusScreen::draw_temperature(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); - int16_t x, y, h, v; + int16_t x, y, w, h; if (what & BACKGROUND) { cmd.cmd(COLOR_RGB(fluid_rgb)); cmd.font(font_medium).tag(10); - ui.bounds(POLY(chocolate_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHOCOLATE)); + /*ui.bounds(POLY(temp_lbl), x, y, w, h); + cmd.text(x, y, w, h, F("Temp")); - ui.bounds(POLY(h0_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_NOZZLE)); + ui.bounds(POLY(set_lbl), x, y, w, h); + cmd.text(x, y, w, h, F("Set"));*/ - ui.bounds(POLY(h1_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_BODY)); + ui.bounds(POLY(chocolate_label), x, y, w, h); + cmd.text(x, y, w, h, F("Cocoa Press")); + + ui.bounds(POLY(h0_label), x, y, w, h); + cmd.text(x, y, w, h, GET_TEXT_F(MSG_NOZZLE)); + + ui.bounds(POLY(h1_label), x, y, w, h); + cmd.text(x, y, w, h, GET_TEXT_F(MSG_BODY)); #if ENABLED(COCOA_PRESS_EXTRA_HEATER) if (has_extra_heater()) { - ui.bounds(POLY(h2_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_EXTERNAL)); + ui.bounds(POLY(h2_label), x, y, w, h); + cmd.text(x, y, w, h, GET_TEXT_F(MSG_EXTERNAL)); } #endif - ui.bounds(POLY(h3_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER)); + #if ENABLED(COCOA_PRESS_CHAMBER_COOLER) + ui.bounds(POLY(h3_label), x, y, w, h); + cmd.text(x, y, w, h, GET_TEXT_F(MSG_CHAMBER)); + #endif #if ENABLED(TOUCH_UI_USE_UTF8) load_utf8_bitmaps(cmd); // Restore font bitmap handles @@ -117,68 +164,60 @@ void StatusScreen::draw_temperature(draw_mode_t what) { cmd.font(font_large).tag(10); + // Show the actual temperatures + format_temp(str, getActualTemp_celsius(E0)); - ui.bounds(POLY(h0_temp), x, y, h, v); - cmd.text(x, y, h, v, str); + ui.bounds(POLY(h0_temp), x, y, w, h); + cmd.text(x, y, w, h, str); format_temp(str, getActualTemp_celsius(E1)); - ui.bounds(POLY(h1_temp), x, y, h, v); - cmd.text(x, y, h, v, str); + ui.bounds(POLY(h1_temp), x, y, w, h); + cmd.text(x, y, w, h, str); #if ENABLED(COCOA_PRESS_EXTRA_HEATER) if (has_extra_heater()) { format_temp(str, getActualTemp_celsius(E2)); - ui.bounds(POLY(h2_temp), x, y, h, v); - cmd.text(x, y, h, v, str); + ui.bounds(POLY(h2_temp), x, y, w, h); + cmd.text(x, y, w, h, str); } #endif - format_temp(str, getActualTemp_celsius(CHAMBER)); - ui.bounds(POLY(h3_temp), x, y, h, v); - cmd.text(x, y, h, v, str); - } -} + #if ENABLED(COCOA_PRESS_CHAMBER_COOLER) + format_temp(str, getActualTemp_celsius(CHAMBER)); + ui.bounds(POLY(h3_temp), x, y, w, h); + cmd.text(x, y, w, h, str); + #endif -void StatusScreen::draw_syringe(draw_mode_t what) { - #if ENABLED(COCOA_PRESS_CHOCOLATE_LEVEL_SENSOR) - const float fill_level = get_chocolate_fill_level(); - #else - constexpr float fill_level = 1.0f; - #endif + /*// Show the set temperatures + format_temp(str, getTargetTemp_celsius(E0)); + ui.bounds(POLY(h0_set), x, y, w, h); + cmd.text(x, y, w, h, str); - CommandProcessor cmd; - PolyUI ui(cmd, what); + format_temp(str, getTargetTemp_celsius(E1)); + ui.bounds(POLY(h1_set), x, y, w, h); + cmd.text(x, y, w, h, str); - if (what & BACKGROUND) { - // Paint the shadow for the syringe - ui.color(shadow_rgb); - ui.shadow(POLY(syringe_outline), shadow_depth); - } + #if ENABLED(COCOA_PRESS_EXTRA_HEATER) + if (has_extra_heater()) { + format_temp(str, getTargetTemp_celsius(E2)); + ui.bounds(POLY(h2_set), x, y, w, h); + cmd.text(x, y, w, h, str); + } + #endif - if (what & FOREGROUND) { - int16_t x, y, h, v; - - // Paint the syringe icon - ui.color(syringe_rgb); - ui.fill(POLY(syringe_outline)); - - ui.color(fluid_rgb); - ui.bounds(POLY(syringe_fluid), x, y, h, v); - cmd.cmd(SAVE_CONTEXT()); - cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level))); - cmd.cmd(SCISSOR_SIZE(h, v * fill_level)); - ui.fill(POLY(syringe_fluid), false); - cmd.cmd(RESTORE_CONTEXT()); - - ui.color(stroke_rgb); - ui.fill(POLY(syringe)); + #if ENABLED(COCOA_PRESS_CHAMBER_COOLER) + format_temp(str, getTargetTemp_celsius(CHAMBER)); + ui.bounds(POLY(h3_set), x, y, w, h); + cmd.text(x, y, w, h, str); + #endif*/ } } void StatusScreen::draw_buttons(draw_mode_t what) { - int16_t x, y, h, v; + int16_t x, y, w, h; - const bool can_print = isMediaInserted() && !isPrintingFromMedia(); + const bool can_print = !isPrinting() && isMediaInserted() && isFileSelected(); + const bool can_select = !isPrinting() && isMediaInserted(); const bool sdOrHostPrinting = ExtUI::isPrinting(); const bool sdOrHostPaused = ExtUI::isPrintingPaused(); @@ -187,29 +226,68 @@ void StatusScreen::draw_buttons(draw_mode_t what) { cmd.font(font_medium).colors(normal_btn); - ui.bounds(POLY(park_btn), x, y, h, v); - cmd.tag(1).button(x, y, h, v, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED)); + ui.bounds(POLY(load_chocolate_btn), x, y, w, h); + cmd.tag(1).button(x, y, w, h, GET_TEXT_F(MSG_LOAD_UNLOAD)); + + ui.bounds(POLY(extrude_btn), x, y, w, h); + cmd.tag(2).button(x, y, w, h, GET_TEXT_F(MSG_EXTRUDE)); + + ui.bounds(POLY(preheat_chocolate_btn), x, y, w, h); + cmd.tag(3).button(x, y, w, h, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE)); + + ui.bounds(POLY(menu_btn), x, y, w, h); + cmd.tag(4).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_MENU)); + + ui.bounds(POLY(media_btn), x, y, w, h); + cmd.tag(5).enabled(can_select).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_MEDIA)); + + ui.bounds(POLY(print_btn), x, y, w, h); + cmd.tag(6).colors(action_btn).enabled(can_print).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_PRINT)); - ui.bounds(POLY(load_chocolate_btn), x, y, h, v); - cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_LOAD_UNLOAD)); + ui.bounds(POLY(pause_btn), x, y, w, h); + cmd.tag(sdOrHostPaused ? 8 : 7).enabled(sdOrHostPrinting).button(x, y, w, h, sdOrHostPaused ? GET_TEXT_F(MSG_BUTTON_RESUME) : GET_TEXT_F(MSG_BUTTON_PAUSE)); - ui.bounds(POLY(preheat_chocolate_btn), x, y, h, v); - cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE)); + ui.bounds(POLY(stop_btn), x, y, w, h); + cmd.tag(9).enabled(sdOrHostPrinting).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_STOP)); +} - ui.bounds(POLY(menu_btn), x, y, h, v); - cmd.tag(4).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_MENU)); +void StatusScreen::draw_file(draw_mode_t what) { + int16_t x, y, w, h; - ui.bounds(POLY(pause_btn), x, y, h, v); - cmd.tag(sdOrHostPaused ? 6 : 5).enabled(sdOrHostPrinting).button(x, y, h, v, sdOrHostPaused ? GET_TEXT_F(MSG_BUTTON_RESUME) : GET_TEXT_F(MSG_BUTTON_PAUSE)); + CommandProcessor cmd; + PolyUI ui(cmd, what); - ui.bounds(POLY(stop_btn), x, y, h, v); - cmd.tag(7).enabled(sdOrHostPrinting).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_STOP)); + ui.bounds(POLY(file_name), x, y, w, h); - ui.bounds(POLY(extrude_btn), x, y, h, v); - cmd.tag(8).button(x, y, h, v, GET_TEXT_F(MSG_EXTRUDE)); + if (what & BACKGROUND) { + cmd.tag(5) + .cmd(COLOR_RGB(bg_text_enabled)) + .cmd (BITMAP_SOURCE(File_Icon_Info)) + .cmd (BITMAP_LAYOUT(File_Icon_Info)) + .cmd (BITMAP_SIZE (File_Icon_Info)) + .icon(ICON_POS(x, y, w, h), File_Icon_Info, icon_scale); + } - ui.bounds(POLY(print_btn), x, y, h, v); - cmd.tag(9).colors(action_btn).enabled(can_print).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_PRINT)); + if (what & FOREGROUND) { + cmd.cmd(COLOR_RGB(bg_text_enabled)); + + if(!isMediaInserted()) + draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), F("No media present"), OPT_CENTERY, font_small); + else if(isFileSelected()) { + FileList list; + draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), list.filename(), OPT_CENTERY, font_small); + } else + draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), F("No file selected"), OPT_CENTERY, font_small); + } +} + +bool StatusScreen::isFileSelected() { + if(!isMediaInserted()) return false; + FileList list; + if(list.isDir()) return false; + const char *filename = list.filename(); + if(filename[0] == '\0') return false; + return true; } void StatusScreen::onRedraw(draw_mode_t what) { @@ -220,8 +298,9 @@ void StatusScreen::onRedraw(draw_mode_t what) { .tag(0); } + draw_file(what); + draw_time(what); draw_progress(what); - draw_syringe(what); draw_temperature(what); draw_buttons(what); } @@ -233,11 +312,12 @@ bool StatusScreen::onTouchStart(uint8_t) { bool StatusScreen::onTouchEnd(uint8_t tag) { switch (tag) { - case 1: SpinnerDialogBox::enqueueAndWait(F("G28 O\nG27")); break; - case 2: GOTO_SCREEN(LoadChocolateScreen); break; + case 1: GOTO_SCREEN(LoadChocolateScreen); break; case 3: GOTO_SCREEN(PreheatMenu); break; case 4: GOTO_SCREEN(MainMenu); break; - case 5: + case 5: GOTO_SCREEN(FilesScreen); break; + case 6: GOTO_SCREEN(ConfirmStartPrintDialogBox); break; + case 7: sound.play(twinkle, PLAY_ASYNCHRONOUS); if (ExtUI::isPrintingFromMedia()) ExtUI::pausePrint(); @@ -246,7 +326,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { #endif GOTO_SCREEN(StatusScreen); break; - case 6: + case 8: sound.play(twinkle, PLAY_ASYNCHRONOUS); if (ExtUI::isPrintingFromMedia()) ExtUI::resumePrint(); @@ -255,12 +335,12 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { #endif GOTO_SCREEN(StatusScreen); break; - case 7: + case 9: GOTO_SCREEN(ConfirmAbortPrintDialogBox); current_screen.forget(); PUSH_SCREEN(StatusScreen); break; - case 9: GOTO_SCREEN(FilesScreen); break; + case 10: GOTO_SCREEN(TemperatureScreen); break; default: return false; } @@ -271,7 +351,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { } bool StatusScreen::onTouchHeld(uint8_t tag) { - if (tag == 8 && !ExtUI::isMoving()) { + if (tag == 2 && !ExtUI::isMoving()) { LoadChocolateScreen::setManualFeedrateAndIncrement(1, increment); UI_INCREMENT(AxisPosition_mm, E0); current_screen.onRefresh(); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h index 08fb6f26d4c5..05f99e953d6c 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h @@ -28,17 +28,19 @@ class StatusScreen : public BaseScreen, public CachedScreen { private: + static void _format_time(char *outstr, uint32_t time); + static float increment; static bool jog_xy; static bool fine_motion; + static void draw_time(draw_mode_t what); static void draw_progress(draw_mode_t what); static void draw_temperature(draw_mode_t what); - static void draw_syringe(draw_mode_t what); - static void draw_arrows(draw_mode_t what); - static void draw_overlay_icons(draw_mode_t what); - static void draw_fine_motion(draw_mode_t what); static void draw_buttons(draw_mode_t what); + static void draw_file(draw_mode_t what); + + static bool isFileSelected(); public: static void loadBitmaps(); static void unlockMotors(); 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 159847bde19c..b82b4a07bd7f 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 @@ -97,7 +97,7 @@ namespace ExtUI { void onLoadSettings(const char *buff) { InterfaceSettingsScreen::loadSettings(buff); } void onPostprocessSettings() {} // Called after loading or resetting stored settings - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE if (success && InterfaceSettingsScreen::backupEEPROM()) { SERIAL_ECHOLNPGM("EEPROM backed up to SPI Flash"); @@ -106,7 +106,7 @@ namespace ExtUI { UNUSED(success); #endif } - void onSettingsLoaded(bool) {} + void onSettingsLoaded(const bool) {} void onPlayTone(const uint16_t frequency, const uint16_t duration) { sound.play_tone(frequency, duration); } @@ -125,6 +125,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp index f7e57cf0b9a0..b52904fe8f49 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp @@ -41,7 +41,7 @@ void EndstopStatesScreen::onExit() { #define GRID_ROWS 7 #define PIN_BTN(X,Y,PIN,LABEL) button(BTN_POS(X,Y), BTN_SIZE(2,1), LABEL) -#define PIN_ENABLED(X,Y,LABEL,PIN,INV) cmd.enabled(1).colors(READ(PIN##_PIN) != INV ? action_btn : normal_btn).PIN_BTN(X,Y,PIN,LABEL); +#define PIN_ENABLED(X,Y,LABEL,PIN,ST) cmd.enabled(1).colors(READ(PIN##_PIN) == ST ? action_btn : normal_btn).PIN_BTN(X,Y,PIN,LABEL); #define PIN_DISABLED(X,Y,LABEL,PIN) cmd.enabled(0).PIN_BTN(X,Y,PIN,LABEL); void EndstopStatesScreen::onRedraw(draw_mode_t) { @@ -55,32 +55,32 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { .text(BTN_POS(1,1), BTN_SIZE(6,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) .font(font_tiny); #if HAS_X_MAX - PIN_ENABLED (1, 2, PSTR(STR_X_MAX), X_MAX, X_MAX_ENDSTOP_INVERTING) + PIN_ENABLED (1, 2, PSTR(STR_X_MAX), X_MAX, X_MAX_ENDSTOP_HIT_STATE) #else PIN_DISABLED(1, 2, PSTR(STR_X_MAX), X_MAX) #endif #if HAS_Y_MAX - PIN_ENABLED (3, 2, PSTR(STR_Y_MAX), Y_MAX, Y_MAX_ENDSTOP_INVERTING) + PIN_ENABLED (3, 2, PSTR(STR_Y_MAX), Y_MAX, Y_MAX_ENDSTOP_HIT_STATE) #else PIN_DISABLED(3, 2, PSTR(STR_Y_MAX), Y_MAX) #endif #if HAS_Z_MAX - PIN_ENABLED (5, 2, PSTR(STR_Z_MAX), Z_MAX, Z_MAX_ENDSTOP_INVERTING) + PIN_ENABLED (5, 2, PSTR(STR_Z_MAX), Z_MAX, Z_MAX_ENDSTOP_HIT_STATE) #else PIN_DISABLED(5, 2, PSTR(STR_Z_MAX), Z_MAX) #endif #if HAS_X_MIN - PIN_ENABLED (1, 3, PSTR(STR_X_MIN), X_MIN, X_MIN_ENDSTOP_INVERTING) + PIN_ENABLED (1, 3, PSTR(STR_X_MIN), X_MIN, X_MIN_ENDSTOP_HIT_STATE) #else PIN_DISABLED(1, 3, PSTR(STR_X_MIN), X_MIN) #endif #if HAS_Y_MIN - PIN_ENABLED (3, 3, PSTR(STR_Y_MIN), Y_MIN, Y_MIN_ENDSTOP_INVERTING) + PIN_ENABLED (3, 3, PSTR(STR_Y_MIN), Y_MIN, Y_MIN_ENDSTOP_HIT_STATE) #else PIN_DISABLED(3, 3, PSTR(STR_Y_MIN), Y_MIN) #endif #if HAS_Z_MIN - PIN_ENABLED (5, 3, PSTR(STR_Z_MIN), Z_MIN, Z_MIN_ENDSTOP_INVERTING) + PIN_ENABLED (5, 3, PSTR(STR_Z_MIN), Z_MIN, Z_MIN_ENDSTOP_HIT_STATE) #else PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN) #endif @@ -95,7 +95,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2) #endif #if PIN_EXISTS(Z_MIN_PROBE) - PIN_ENABLED (5, 4, PSTR(STR_Z_PROBE), Z_MIN_PROBE, Z_MIN_PROBE_ENDSTOP_INVERTING) + PIN_ENABLED (5, 4, PSTR(STR_Z_PROBE), Z_MIN_PROBE, Z_MIN_PROBE_ENDSTOP_HIT_STATE) #else PIN_DISABLED(5, 4, PSTR(STR_Z_PROBE), Z_MIN_PROBE) #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp index e7fc23ab4870..666a7542cccb 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp @@ -34,7 +34,7 @@ void MaxVelocityScreen::onRedraw(draw_mode_t what) { widgets_t w(what); w.precision(0); w.units(GET_TEXT_F(MSG_UNITS_MM_S)); - w.heading( GET_TEXT_F(MSG_MAX_SPEED)); + w.heading( GET_TEXT_F(MSG_MAX_SPEED_NO_UNITS)); w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_VMAX_X), getAxisMaxFeedrate_mm_s(X) ); w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_VMAX_Y), getAxisMaxFeedrate_mm_s(Y) ); w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_VMAX_Z), getAxisMaxFeedrate_mm_s(Z) ); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h index 5dbde8a5c359..05e625842ad9 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h @@ -146,6 +146,7 @@ namespace Language_en { LSTR MSG_PROBE_BED = u8"Probe Mesh"; LSTR MSG_PRINT_TEST = u8"Print Test (PLA)"; LSTR MSG_MOVE_Z_TO_TOP = u8"Raise Z to Top"; + LSTR MSG_MAX_SPEED_NO_UNITS = u8"Max Speed"; #if ENABLED(TOUCH_UI_LULZBOT_BIO) LSTR MSG_MOVE_TO_HOME = u8"Move to Home"; @@ -163,8 +164,9 @@ namespace Language_en { LSTR MSG_CHOCOLATE = u8"Chocolate"; LSTR MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge"; LSTR MSG_LOAD_UNLOAD = u8"Load/Unload"; - LSTR MSG_FULL_LOAD = u8"Full Load"; - LSTR MSG_FULL_UNLOAD = u8"Full Unload"; + LSTR MSG_START_STOP = u8"Start/Stop"; + LSTR MSG_LOAD = u8"Load"; + LSTR MSG_UNLOAD = u8"Unload"; LSTR MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate"; LSTR MSG_PREHEAT_FINISHED = u8"Preheat finished"; LSTR MSG_PREHEAT = u8"Preheat"; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h index 5d715572fa27..48a0c1a96440 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h @@ -64,6 +64,7 @@ union screen_data_t { DECL_DATA_IF_INCLUDED(FTDI_ALERT_DIALOG_BOX) DECL_DATA_IF_INCLUDED(COCOA_PREHEAT_SCREEN) DECL_DATA_IF_INCLUDED(COCOA_LOAD_CHOCOLATE_SCREEN) + DECL_DATA_IF_INCLUDED(COCOA_FILES_SCREEN) }; extern screen_data_t screen_data; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp index ec627e313b13..ed210369c4f2 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp @@ -116,6 +116,8 @@ SCREEN_TABLE { DECL_SCREEN_IF_INCLUDED(COCOA_LEVELING_MENU) DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_XYZ_SCREEN) DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_E_SCREEN) + DECL_SCREEN_IF_INCLUDED(COCOA_CONFIRM_START_PRINT) + DECL_SCREEN_IF_INCLUDED(COCOA_FILES_SCREEN) }; SCREEN_TABLE_POST diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h index 1231d31dc387..4e706a645a06 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h @@ -1,4 +1,3 @@ - /**************************************************************************** * 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 * diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h index c6065af7f7ca..ce0423921323 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h @@ -1,4 +1,3 @@ - /**************************************************************************** * 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 * diff --git a/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp b/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp index 448d078cc41d..4e2d294a9b25 100644 --- a/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp @@ -33,13 +33,11 @@ #if DGUS_LCD_UI_IA_CREALITY +#include "ia_creality_extui.h" #include "FileNavigator.h" using namespace ExtUI; -#define DEBUG_OUT ENABLED(DEBUG_DWIN) -#include "../../../core/debug_out.h" - FileList FileNavigator::filelist; // Instance of the Marlin file API char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path uint16_t FileNavigator::lastindex; @@ -124,8 +122,6 @@ void FileNavigator::getFiles(uint16_t index) { const int filelen = strlen(filelist.filename()); if (filelen > 20) { char *buf = (char *)filelist.filename(); - //char buf[filelen]; - //strcpy(&buf[filelen], filelist.filename()); buf[18] = '\0'; // cutoff at screen edge rtscheck.RTS_SndData(buf, (SDFILE_ADDR + (fcnt * 20))); } diff --git a/Marlin/src/lcd/extui/ia_creality/FileNavigator.h b/Marlin/src/lcd/extui/ia_creality/FileNavigator.h index 29f562845560..28d97c67469d 100644 --- a/Marlin/src/lcd/extui/ia_creality/FileNavigator.h +++ b/Marlin/src/lcd/extui/ia_creality/FileNavigator.h @@ -30,9 +30,6 @@ * Written by Insanity Automation * ***************************************/ -#include "creality_extui.h" -#include "../ui_api.h" - #define MAX_FOLDER_DEPTH 4 // Limit folder depth TFT has a limit for the file path #define MAX_CMND_LEN 16 * MAX_FOLDER_DEPTH // Maximum Length for a Panel command #define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path diff --git a/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp index 547b50010619..1f40f2a037d2 100644 --- a/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp @@ -34,16 +34,8 @@ #if DGUS_LCD_UI_IA_CREALITY -#include "creality_extui.h" +#include "ia_creality_extui.h" #include "FileNavigator.h" -#include "../ui_api.h" - -#include -#include -#include - -#define DEBUG_OUT ENABLED(DEBUG_DWIN) -#include "../../../core/debug_out.h" namespace ExtUI { static uint16_t fileIndex = 0; @@ -87,6 +79,9 @@ namespace ExtUI { #ifndef CUSTOM_MACHINE_NAME #define CUSTOM_MACHINE_NAME MACHINE_NAME #endif + #ifndef IA_CREALITY_BOOT_DELAY + #define IA_CREALITY_BOOT_DELAY 500 + #endif void onStartup() { DWIN_SERIAL.begin(115200); @@ -94,7 +89,7 @@ namespace ExtUI { rtscheck.recdat.head[1] = rtscheck.snddat.head[1] = FHTWO; ZERO(rtscheck.databuf); - delay_ms(TERN(DWINOS_4, 1500, 500)); // Delay to allow screen startup + delay_ms(IA_CREALITY_BOOT_DELAY); // Delay to allow screen startup SetTouchScreenConfiguration(); rtscheck.RTS_SndData(StartSoundSet, SoundAddr); delay_ms(400); // Delay to allow screen to configure @@ -314,31 +309,31 @@ namespace ExtUI { else rtscheck.RTS_SndData(2, DisplayStandbyEnableIndicator); - rtscheck.RTS_SndData(uint16_t(getAxisSteps_per_mm(X)) * 10, StepMM_X); - rtscheck.RTS_SndData(uint16_t(getAxisSteps_per_mm(Y)) * 10, StepMM_Y); - rtscheck.RTS_SndData(uint16_t(getAxisSteps_per_mm(Z)) * 10, StepMM_Z); - rtscheck.RTS_SndData(uint16_t(getAxisSteps_per_mm(E0)) * 10, StepMM_E); + rtscheck.RTS_SndData(getAxisSteps_per_mm(X) * 10, StepMM_X); + rtscheck.RTS_SndData(getAxisSteps_per_mm(Y) * 10, StepMM_Y); + rtscheck.RTS_SndData(getAxisSteps_per_mm(Z) * 10, StepMM_Z); + rtscheck.RTS_SndData(getAxisSteps_per_mm(E0) * 10, StepMM_E); - rtscheck.RTS_SndData(uint16_t(getAxisMaxAcceleration_mm_s2(X)) / 100, Accel_X); - rtscheck.RTS_SndData(uint16_t(getAxisMaxAcceleration_mm_s2(Y)) / 100, Accel_Y); - rtscheck.RTS_SndData(uint16_t(getAxisMaxAcceleration_mm_s2(Z)) / 10, Accel_Z); - rtscheck.RTS_SndData(uint16_t(getAxisMaxAcceleration_mm_s2(E0)), Accel_E); + rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(X) / 100, Accel_X); + rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(Y) / 100, Accel_Y); + rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(Z) / 10, Accel_Z); + rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(E0), Accel_E); - rtscheck.RTS_SndData(uint16_t(getAxisMaxFeedrate_mm_s(X)), Feed_X); - rtscheck.RTS_SndData(uint16_t(getAxisMaxFeedrate_mm_s(Y)), Feed_Y); - rtscheck.RTS_SndData(uint16_t(getAxisMaxFeedrate_mm_s(Z)), Feed_Z); - rtscheck.RTS_SndData(uint16_t(getAxisMaxFeedrate_mm_s(E0)), Feed_E); + rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(X), Feed_X); + rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(Y), Feed_Y); + rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(Z), Feed_Z); + rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(E0), Feed_E); - rtscheck.RTS_SndData(uint16_t(getAxisMaxJerk_mm_s(X)) * 100, Jerk_X); - rtscheck.RTS_SndData(uint16_t(getAxisMaxJerk_mm_s(Y)) * 100, Jerk_Y); - rtscheck.RTS_SndData(uint16_t(getAxisMaxJerk_mm_s(Z)) * 100, Jerk_Z); - rtscheck.RTS_SndData(uint16_t(getAxisMaxJerk_mm_s(E0)) * 100, Jerk_E); + rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(X) * 100, Jerk_X); + rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(Y) * 100, Jerk_Y); + rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(Z) * 100, Jerk_Z); + rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(E0) * 100, Jerk_E); #if HAS_HOTEND_OFFSET - rtscheck.RTS_SndData(uint16_t(getNozzleOffset_mm(X, E1)) * 10, T2Offset_X); - rtscheck.RTS_SndData(uint16_t(getNozzleOffset_mm(Y, E1)) * 10, T2Offset_Y); - rtscheck.RTS_SndData(uint16_t(getNozzleOffset_mm(Z, E1)) * 10, T2Offset_Z); - rtscheck.RTS_SndData(uint16_t(getAxisSteps_per_mm(E1)) * 10, T2StepMM_E); + rtscheck.RTS_SndData(getNozzleOffset_mm(X, E1) * 10, T2Offset_X); + rtscheck.RTS_SndData(getNozzleOffset_mm(Y, E1) * 10, T2Offset_Y); + rtscheck.RTS_SndData(getNozzleOffset_mm(Z, E1) * 10, T2Offset_Z); + rtscheck.RTS_SndData(getAxisSteps_per_mm(E1) * 10, T2StepMM_E); #endif #if HAS_BED_PROBE @@ -349,13 +344,13 @@ namespace ExtUI { #if HAS_PID_HEATING rtscheck.RTS_SndData(pid_hotendAutoTemp, HotendPID_AutoTmp); rtscheck.RTS_SndData(pid_bedAutoTemp, BedPID_AutoTmp); - rtscheck.RTS_SndData(uint16_t(getPID_Kp(E0)) * 10, HotendPID_P); - rtscheck.RTS_SndData(uint16_t(getPID_Ki(E0)) * 10, HotendPID_I); - rtscheck.RTS_SndData(uint16_t(getPID_Kd(E0)) * 10, HotendPID_D); + rtscheck.RTS_SndData(getPID_Kp(E0) * 10, HotendPID_P); + rtscheck.RTS_SndData(getPID_Ki(E0) * 10, HotendPID_I); + rtscheck.RTS_SndData(getPID_Kd(E0) * 10, HotendPID_D); #if ENABLED(PIDTEMPBED) - rtscheck.RTS_SndData(uint16_t(getBedPID_Kp()) * 10, BedPID_P); - rtscheck.RTS_SndData(uint16_t(getBedPID_Ki()) * 10, BedPID_I); - rtscheck.RTS_SndData(uint16_t(getBedPID_Kd()) * 10, BedPID_D); + rtscheck.RTS_SndData(getBedPID_Kp() * 10, BedPID_P); + rtscheck.RTS_SndData(getBedPID_Ki() * 10, BedPID_I); + rtscheck.RTS_SndData(getBedPID_Kd() * 10, BedPID_D); #endif #endif } @@ -567,6 +562,25 @@ namespace ExtUI { RTS_SndData(); } + void RTSSHOW::RTS_SndData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + int16_t n = f; + if (cmd == VarAddr_W) { + snddat.data[0] = n; + snddat.len = 5; + } + else if (cmd == RegAddr_W) { + snddat.data[0] = n; + snddat.len = 3; + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + RTS_SndData(); + } + void RTSSHOW::RTS_SndData(const int n, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { if (cmd == VarAddr_W) { if ((unsigned int)n > 0xFFFF) { @@ -789,7 +803,6 @@ namespace ExtUI { } else { onStatusChanged(F("Requested Offset Beyond Limits")); - RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); } rtscheck.RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); @@ -1567,7 +1580,7 @@ namespace ExtUI { else if (recdat.data[0] == 4) { // Page Up injectCommands(F("M22\nM21")); } - else if (recdat.data[0] == 0) { // return to main page + else if (recdat.data[0] == 0) { // return to main page InforShowStatus = true; TPShowStatus = false; } @@ -1982,12 +1995,12 @@ namespace ExtUI { SetTouchScreenConfiguration(); } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // This is called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { #if HAS_MESH if (ExtUI::getMeshValid()) { uint8_t abl_probe_index = 0; @@ -2013,6 +2026,9 @@ namespace ExtUI { } #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 } diff --git a/Marlin/src/lcd/extui/ia_creality/creality_extui.h b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h similarity index 98% rename from Marlin/src/lcd/extui/ia_creality/creality_extui.h rename to Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h index 35162eebee80..0d932556638c 100644 --- a/Marlin/src/lcd/extui/ia_creality/creality_extui.h +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h @@ -22,7 +22,7 @@ #pragma once /* **************************************** - * lcd/extui/ia_creality/creality_extui.h + * lcd/extui/ia_creality/ia_creality_extui.h * **************************************** * Extensible_UI implementation for Creality DWIN * 10SPro, Max, CRX, and others @@ -32,7 +32,6 @@ * ***************************************/ #include "string.h" -#include #include "../ui_api.h" /*********************************/ @@ -232,10 +231,10 @@ namespace ExtUI { void RTS_SndData(char, const uint32_t, const uint8_t=VarAddr_W); void RTS_SndData(int, const uint32_t, const uint8_t=VarAddr_W); void RTS_SndData(unsigned long, const uint32_t, const uint8_t=VarAddr_W); + void RTS_SndData(const_float_t, const uint32_t, const uint8_t=VarAddr_W); void RTS_SndData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData((char *)str, addr, cmd); } void RTS_SndData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData(int(n), addr, cmd); } - void RTS_SndData(const_float_t n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData(int(n), addr, cmd); } void RTS_SndData(const long n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData((unsigned long)n, addr, cmd); } void RTS_SDcard_Stop(); diff --git a/Marlin/src/lcd/extui/malyan/malyan.cpp b/Marlin/src/lcd/extui/malyan/malyan.cpp index 06c9886f0131..66c52878cc98 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan.cpp @@ -326,8 +326,8 @@ void process_lcd_s_command(const char *command) { // select a file for printing during a print, there's // little reason not to do it this way. char message_buffer[MAX_CURLY_COMMAND]; - uint16_t file_count = card.get_num_Files(); - for (uint16_t i = 0; i < file_count; i++) { + int16_t file_count = card.get_num_items(); + for (int16_t i = 0; i < file_count; i++) { card.selectFileByIndex(i); sprintf_P(message_buffer, card.flag.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename()); write_to_lcd(message_buffer); diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index b978937defd0..8bffa442b68c 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -147,8 +147,8 @@ namespace ExtUI { void onStoreSettings(char*) {} void onLoadSettings(const char*) {} void onPostprocessSettings() {} - void onSettingsStored(bool) {} - void onSettingsLoaded(bool) {} + void onSettingsStored(const bool) {} + void onSettingsLoaded(const bool) {} #if HAS_MESH void onLevelingStart() {} @@ -158,6 +158,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp b/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp index 0199bc1f555d..6b41981fb857 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp @@ -72,11 +72,11 @@ uint8_t sel_id = 0; else card.cdroot(); - const uint16_t fileCnt = card.get_num_Files(); + const int16_t fileCnt = card.get_num_items(); - for (uint16_t i = 0; i < fileCnt; i++) { + for (int16_t i = 0; i < fileCnt; i++) { if (list_file.Sd_file_cnt == list_file.Sd_file_offset) { - card.getfilename_sorted(SD_ORDER(i, fileCnt)); + card.selectFileByIndexSorted(i); list_file.IsFolder[valid_name_cnt] = card.flag.filenameIsDir; strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp index e0c663e282e3..a9a25db11822 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp @@ -55,22 +55,22 @@ static void drawCross(uint16_t x, uint16_t y, uint16_t color) { void lv_update_touch_calibration_screen() { uint16_t x, y; - calibrationState calibration_stage = touch_calibration.get_calibration_state(); - if (calibration_stage == CALIBRATION_NONE) { + calibrationState stage = touch_calibration.get_calibration_state(); + if (stage == CALIBRATION_NONE) { // start and clear screen - calibration_stage = touch_calibration.calibration_start(); + stage = touch_calibration.calibration_start(); } else { // clear last cross - x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; - y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; + x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; + y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; drawCross(x, y, LV_COLOR_BACKGROUND.full); } const char *str = nullptr; - if (calibration_stage < CALIBRATION_SUCCESS) { + if (stage < CALIBRATION_SUCCESS) { // handle current state - switch (calibration_stage) { + switch (stage) { case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break; case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break; case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break; @@ -78,13 +78,13 @@ void lv_update_touch_calibration_screen() { default: break; } - x = touch_calibration.calibration_points[calibration_stage].x; - y = touch_calibration.calibration_points[calibration_stage].y; + x = touch_calibration.calibration_points[stage].x; + y = touch_calibration.calibration_points[stage].y; drawCross(x, y, LV_COLOR_WHITE.full); } else { // end calibration - str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED); + str = stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED); touch_calibration.calibration_end(); lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_TC_RETURN); } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp b/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp index d143234fd53e..dbe8577dc995 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp @@ -36,7 +36,7 @@ #if HAS_LEVELING #include "../../../feature/bedlevel/bedlevel.h" - bool leveling_was_active; + bool mks_leveling_was_active; #endif extern lv_group_t *g; @@ -110,7 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_M_RETURN: probe.offset.z = z_offset_backup; SET_SOFT_ENDSTOP_LOOSE(false); - TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); + TERN_(HAS_LEVELING, set_bed_leveling_enabled(mks_leveling_was_active)); #if HOMING_Z_WITH_PROBE && defined(PROBE_OFFSET_WIZARD_START_Z) set_axis_never_homed(Z_AXIS); // On cancel the Z position needs correction queue.inject_P(PSTR("G28Z")); @@ -149,8 +149,8 @@ void lv_draw_z_offset_wizard() { // Store Bed-Leveling-State and disable #if HAS_LEVELING - leveling_was_active = planner.leveling_active; - set_bed_leveling_enabled(leveling_was_active); + mks_leveling_was_active = planner.leveling_active; + set_bed_leveling_enabled(mks_leveling_was_active); #endif queue.inject_P(PSTR("G28")); diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index 86b5e6eb4cc6..d1679d402f09 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -76,7 +76,7 @@ constexpr static bool endstopz2_sta = true; #endif - #define ESTATE(S) (READ(S##_PIN) != S##_ENDSTOP_INVERTING) + #define ESTATE(S) (READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) void test_gpio_readlevel_L() { WRITE(WIFI_IO0_PIN, HIGH); diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index a5a8f7cbe41f..08db5ae7ad56 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -298,10 +298,8 @@ void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv W25QXX.init(SPI_QUARTER_SPEED); } -#define TICK_CYCLE 1 - -uint16_t getTickDiff(uint16_t curTick, uint16_t lastTick) { - return TICK_CYCLE * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick)); +uint16_t getTickDiff(const uint16_t curTick, const uint16_t lastTick) { + return (TICK_CYCLE) * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick)); } static bool get_point(int16_t *x, int16_t *y) { @@ -494,6 +492,7 @@ void lv_encoder_pin_init() { } #if 1 // HAS_ENCODER_ACTION + void lv_update_encoder() { static uint32_t encoder_time1; uint32_t tmpTime, diffTime = 0; @@ -554,7 +553,7 @@ void lv_encoder_pin_init() { #endif // HAS_ENCODER_WHEEL - } // next_button_update_ms + } // encoder_time1 } #endif // HAS_ENCODER_ACTION diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 215281d450a4..d6d2ce3945dc 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -55,11 +55,11 @@ #define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH); #define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW); -extern uint8_t Explore_Disk(char *path, uint8_t recu_level); +uint8_t Explore_Disk(const char * const path, const uint8_t recu_level, const bool with_longnames); extern uint8_t commands_in_queue; extern uint8_t sel_id; -extern uint16_t getTickDiff(uint16_t curTick, uint16_t lastTick); +uint16_t getTickDiff(const uint16_t curTick, const uint16_t lastTick); volatile SZ_USART_FIFO WifiRxFifo; @@ -114,33 +114,34 @@ extern CLOUD_PARA cloud_para; extern bool once_flag, flash_preview_begin, default_preview_flg, gcode_preview_over; extern bool flash_dma_mode; -uint32_t getWifiTick() { return millis(); } +millis_t getWifiTick() { return millis(); } -uint32_t getWifiTickDiff(int32_t lastTick, int32_t curTick) { - return (lastTick <= curTick ? curTick - lastTick : 0xFFFFFFFF - lastTick + curTick) * TICK_CYCLE; +millis_t getWifiTickDiff(const millis_t lastTick, const millis_t curTick) { + return (TICK_CYCLE) * (lastTick <= curTick ? curTick - lastTick : 0xFFFFFFFFUL - lastTick + curTick); } -void wifi_delay(int n) { - const uint32_t start = getWifiTick(); - while (getWifiTickDiff(start, getWifiTick()) < (uint32_t)n) +void wifi_delay(const uint16_t n) { + const millis_t start = getWifiTick(); + while (getWifiTickDiff(start, getWifiTick()) < millis_t(n)) hal.watchdog_refresh(); } void wifi_reset() { - uint32_t start = getWifiTick(); + const millis_t start = getWifiTick(); WIFI_RESET(); while (getWifiTickDiff(start, getWifiTick()) < 500) { /* nada */ } WIFI_SET(); } -void mount_file_sys(uint8_t disk_type) { - if (disk_type == FILE_SYS_SD) { - TERN_(SDSUPPORT, card.mount()); - } - else if (disk_type == FILE_SYS_USB) { +void mount_file_sys(const uint8_t disk_type) { + switch (disk_type) { + case FILE_SYS_SD: TERN_(SDSUPPORT, card.mount()); break; + case FILE_SYS_USB: break; } } +#define ILLEGAL_CHAR_REPLACE 0x5F // '_' + static bool longName2DosName(const char *longName, char *dosName) { uint8_t i = FILENAME_LENGTH; while (i) dosName[--i] = '\0'; @@ -152,18 +153,24 @@ static bool longName2DosName(const char *longName, char *dosName) { strcat_P(dosName, PSTR(".GCO")); return dosName[0] != '\0'; } + + // Fail for illegal characters + if (c < 0x21 || c == 0x7F) // Check size, non-printable characters + c = ILLEGAL_CHAR_REPLACE; // replace non-printable chars with underscore '_' else { - // Fail for illegal characters PGM_P p = PSTR("|<>^+=?/[];,*\"\\"); - while (uint8_t b = pgm_read_byte(p++)) if (b == c) return false; - if (c < 0x21 || c == 0x7F) return false; // Check size, non-printable characters - dosName[i++] = (c < 'a' || c > 'z') ? (c) : (c + ('A' - 'a')); // Uppercase required for 8.3 name + while (const uint8_t b = pgm_read_byte(p++)) + if (b == c) c = ILLEGAL_CHAR_REPLACE; // replace illegal chars with underscore '_' } + + dosName[i++] = (c < 'a' || c > 'z') ? (c) : (c + ('A' - 'a')); // Uppercase required for 8.3 name + if (i >= 5) { strcat_P(dosName, PSTR("~1.GCO")); return dosName[0] != '\0'; } } + return dosName[0] != '\0'; // Return true if any name was set } @@ -562,8 +569,8 @@ static bool longName2DosName(const char *longName, char *dosName) { #if ENABLED(MKS_WIFI_MODULE) - int raw_send_to_wifi(uint8_t *buf, int len) { - if (buf == 0 || len <= 0) return 0; + int raw_send_to_wifi(uint8_t * const buf, const int len) { + if (buf == nullptr || len <= 0) return 0; for (int i = 0; i < len; i++) WIFISERIAL.write(*(buf + i)); return len; } @@ -701,13 +708,13 @@ int package_to_wifi(WIFI_RET_TYPE type, uint8_t *buf, int len) { return 1; } +int send_to_wifi(uint8_t * const buf, const int len) { return package_to_wifi(WIFI_TRANS_INF, buf, len); } -#define SEND_OK_TO_WIFI send_to_wifi((uint8_t *)"ok\r\n", strlen("ok\r\n")) -int send_to_wifi(uint8_t *buf, int len) { return package_to_wifi(WIFI_TRANS_INF, buf, len); } +inline void send_ok_to_wifi() { send_to_wifi((uint8_t *)"ok\r\n", strlen("ok\r\n")); } void set_cur_file_sys(int fileType) { gCfgItems.fileSysType = fileType; } -void get_file_list(char *path) { +void get_file_list(const char * const path, const bool with_longnames) { if (!path) return; if (gCfgItems.fileSysType == FILE_SYS_SD) { @@ -716,7 +723,7 @@ void get_file_list(char *path) { else if (gCfgItems.fileSysType == FILE_SYS_USB) { // udisk } - Explore_Disk(path, 0); + Explore_Disk(path, 0, with_longnames); } char wait_ip_back_flag = 0; @@ -795,7 +802,7 @@ typedef struct { uint8_t tail; } ESP_PROTOC_FRAME; -static int cut_msg_head(uint8_t *msg, uint16_t msgLen, uint16_t cutLen) { +static int cut_msg_head(uint8_t * const msg, const uint16_t msgLen, uint16_t cutLen) { if (msgLen < cutLen) return 0; else if (msgLen == cutLen) { @@ -811,25 +818,31 @@ static int cut_msg_head(uint8_t *msg, uint16_t msgLen, uint16_t cutLen) { return msgLen - cutLen; } -uint8_t Explore_Disk(char *path , uint8_t recu_level) { - char tmp[200]; +uint8_t Explore_Disk(const char * const path, const uint8_t recu_level, const bool with_longnames) { char Fstream[200]; if (!path) return 0; - const uint8_t fileCnt = card.get_num_Files(); + const int16_t fileCnt = card.get_num_items(); - for (uint8_t i = 0; i < fileCnt; i++) { - card.getfilename_sorted(SD_ORDER(i, fileCnt)); - ZERO(tmp); - strcpy(tmp, card.filename); + MediaFile file; + MediaFile *diveDir; + for (int16_t i = 0; i < fileCnt; i++) { + card.selectFileByIndexSorted(i); ZERO(Fstream); - strcpy(Fstream, tmp); + strcpy(Fstream, card.filename); if (card.flag.filenameIsDir && recu_level <= 10) strcat_P(Fstream, PSTR(".DIR")); + strcat_P(Fstream, PSTR(" 0")); // report 0 file size + + if (with_longnames) { + strcat_P(Fstream, PSTR(" ")); + strcat_P(Fstream, card.longest_filename()); + } + strcat_P(Fstream, PSTR("\r\n")); send_to_wifi((uint8_t*)Fstream, strlen(Fstream)); } @@ -837,434 +850,449 @@ uint8_t Explore_Disk(char *path , uint8_t recu_level) { return fileCnt; } -static void wifi_gcode_exec(uint8_t *cmd_line) { +static void wifi_gcode_exec(uint8_t * const cmd_line) { int8_t tempBuf[100] = { 0 }; - uint8_t *tmpStr = 0; int cmd_value; volatile int print_rate; - if (strchr((char *)cmd_line, '\n') && (strchr((char *)cmd_line, 'G') || strchr((char *)cmd_line, 'M') || strchr((char *)cmd_line, 'T'))) { - tmpStr = (uint8_t *)strchr((char *)cmd_line, '\n'); - if (tmpStr) *tmpStr = '\0'; - - tmpStr = (uint8_t *)strchr((char *)cmd_line, '\r'); - if (tmpStr) *tmpStr = '\0'; - tmpStr = (uint8_t *)strchr((char *)cmd_line, '*'); - if (tmpStr) *tmpStr = '\0'; + // Only accept commands with a linefeed + char * const lfStr = strchr((char *)cmd_line, '\n'); + if (!lfStr) return; + + // Only accept commands with G, M, or T somewhere + const char * const gStr = strchr((char *)cmd_line, 'G'); + const char * const mStr = strchr((char *)cmd_line, 'M'); + const char * const tStr = strchr((char *)cmd_line, 'T'); + if (!(gStr || mStr || tStr)) return; + + // Replace the linefeed with nul terminator + *lfStr = '\0'; + + // Terminate on the first cr, if any + char * const crStr = strchr((char *)cmd_line, '\r'); + if (crStr) *crStr = '\0'; + + // Terminate on the checksum marker, if any + char * const aStr = strchr((char *)cmd_line, '*'); + if (aStr) *aStr = '\0'; + + // Handle some M commands here + if (mStr) { + cmd_value = atoi(mStr + 1); + char * const spStr = strchr(mStr, ' '); + + switch (cmd_value) { + + case 20: // M20: Print SD / µdisk file + file_writer.fileTransfer = 0; + if (uiCfg.print_state == IDLE) { + int index = 0; + if (spStr == nullptr) { + gCfgItems.fileSysType = FILE_SYS_SD; + send_to_wifi((uint8_t *)(STR_BEGIN_FILE_LIST "\r\n"), strlen(STR_BEGIN_FILE_LIST "\r\n")); + get_file_list("0:/", false); + send_to_wifi((uint8_t *)(STR_END_FILE_LIST "\r\n"), strlen(STR_END_FILE_LIST "\r\n")); + send_ok_to_wifi(); + break; + } - tmpStr = (uint8_t *)strchr((char *)cmd_line, 'M'); - if (tmpStr) { - cmd_value = atoi((char *)(tmpStr + 1)); - tmpStr = (uint8_t *)strchr((char *)tmpStr, ' '); + while (mStr[index] == ' ') index++; - switch (cmd_value) { + if (gCfgItems.wifi_type == ESP_WIFI) { + char * const path = (char *)tempBuf; + if (strlen(&mStr[index]) < 80) { + send_to_wifi((uint8_t *)(STR_BEGIN_FILE_LIST "\r\n"), strlen(STR_BEGIN_FILE_LIST "\r\n")); - case 20: // M20: Print SD / µdisk file - file_writer.fileTransfer = 0; - if (uiCfg.print_state == IDLE) { - int index = 0; + if (strncmp(&mStr[index], "1:", 2) == 0) + gCfgItems.fileSysType = FILE_SYS_SD; + else if (strncmp(&mStr[index], "0:", 2) == 0) + gCfgItems.fileSysType = FILE_SYS_USB; - if (tmpStr == 0) { - gCfgItems.fileSysType = FILE_SYS_SD; - send_to_wifi((uint8_t *)(STR_BEGIN_FILE_LIST "\r\n"), strlen(STR_BEGIN_FILE_LIST "\r\n")); - get_file_list((char *)"0:/"); + strcpy(path, &mStr[index]); + const bool with_longnames = strchr(mStr, 'L') != nullptr; + get_file_list(path, with_longnames); send_to_wifi((uint8_t *)(STR_END_FILE_LIST "\r\n"), strlen(STR_END_FILE_LIST "\r\n")); - SEND_OK_TO_WIFI; - break; } + send_ok_to_wifi(); + } + } + break; - while (tmpStr[index] == ' ') index++; + case 21: send_ok_to_wifi(); break; // Init SD card - if (gCfgItems.wifi_type == ESP_WIFI) { - char *path = (char *)tempBuf; + case 23: + // Select the file + if (uiCfg.print_state == IDLE) { + int index = 0; + while (mStr[index] == ' ') index++; - if (strlen((char *)&tmpStr[index]) < 80) { - send_to_wifi((uint8_t *)(STR_BEGIN_FILE_LIST "\r\n"), strlen(STR_BEGIN_FILE_LIST "\r\n")); + if (strstr_P(&mStr[index], PSTR(".g")) || strstr_P(&mStr[index], PSTR(".G"))) { + if (strlen(&mStr[index]) < 80) { + ZERO(list_file.file_name[sel_id]); + ZERO(list_file.long_name[sel_id]); + uint8_t has_path_selected = 0; - if (strncmp((char *)&tmpStr[index], "1:", 2) == 0) + if (gCfgItems.wifi_type == ESP_WIFI) { + if (strncmp_P(&mStr[index], PSTR("1:"), 2) == 0) { gCfgItems.fileSysType = FILE_SYS_SD; - else if (strncmp((char *)&tmpStr[index], "0:", 2) == 0) + has_path_selected = 1; + } + else if (strncmp_P(&mStr[index], PSTR("0:"), 2) == 0) { gCfgItems.fileSysType = FILE_SYS_USB; + has_path_selected = 1; + } + else if (mStr[index] != '/') + strcat_P((char *)list_file.file_name[sel_id], PSTR("/")); + + if (file_writer.fileTransfer == 1) { + char dosName[FILENAME_LENGTH]; + uint8_t fileName[sizeof(list_file.file_name[sel_id])]; + fileName[0] = '\0'; + if (has_path_selected == 1) { + strcat((char *)fileName, &mStr[index + 3]); + strcat_P((char *)list_file.file_name[sel_id], PSTR("/")); + } + else strcat((char *)fileName, &mStr[index]); + if (!longName2DosName((const char *)fileName, dosName)) + strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); + strcat((char *)list_file.file_name[sel_id], dosName); + strcat((char *)list_file.long_name[sel_id], (const char *)fileName); + } + else { + strcat((char *)list_file.file_name[sel_id], &mStr[index]); + strcat((char *)list_file.long_name[sel_id], &mStr[index]); + } + + } + else + strcpy(list_file.file_name[sel_id], &mStr[index]); + + char *cur_name = strrchr(list_file.file_name[sel_id],'/'); + + card.openFileRead(cur_name); - strcpy((char *)path, (char *)&tmpStr[index]); - get_file_list(path); - send_to_wifi((uint8_t *)(STR_END_FILE_LIST "\r\n"), strlen(STR_END_FILE_LIST "\r\n")); + if (card.isFileOpen()) + send_to_wifi((uint8_t *)"File selected\r\n", strlen("File selected\r\n")); + else { + send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n")); + strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); } - SEND_OK_TO_WIFI; + send_ok_to_wifi(); } } - break; - - case 21: SEND_OK_TO_WIFI; break; // Init SD card + } + break; - case 23: - // Select the file + case 24: + if (strcmp_P(list_file.file_name[sel_id], PSTR("notValid")) != 0) { if (uiCfg.print_state == IDLE) { - int index = 0; - while (tmpStr[index] == ' ') index++; - - if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) { - if (strlen((char *)&tmpStr[index]) < 80) { - ZERO(list_file.file_name[sel_id]); - ZERO(list_file.long_name[sel_id]); - uint8_t has_path_selected = 0; - - if (gCfgItems.wifi_type == ESP_WIFI) { - if (strncmp_P((char *)&tmpStr[index], PSTR("1:"), 2) == 0) { - gCfgItems.fileSysType = FILE_SYS_SD; - has_path_selected = 1; - } - else if (strncmp_P((char *)&tmpStr[index], PSTR("0:"), 2) == 0) { - gCfgItems.fileSysType = FILE_SYS_USB; - has_path_selected = 1; - } - else if (tmpStr[index] != '/') - strcat_P((char *)list_file.file_name[sel_id], PSTR("/")); + clear_cur_ui(); + reset_print_time(); + start_print_time(); + preview_gcode_prehandle(list_file.file_name[sel_id]); + uiCfg.print_state = WORKING; + lv_draw_printing(); - if (file_writer.fileTransfer == 1) { - char dosName[FILENAME_LENGTH]; - uint8_t fileName[sizeof(list_file.file_name[sel_id])]; - fileName[0] = '\0'; - if (has_path_selected == 1) { - strcat((char *)fileName, (char *)&tmpStr[index + 3]); - strcat_P((char *)list_file.file_name[sel_id], PSTR("/")); - } - else strcat((char *)fileName, (char *)&tmpStr[index]); - if (!longName2DosName((const char *)fileName, dosName)) - strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); - strcat((char *)list_file.file_name[sel_id], dosName); - strcat((char *)list_file.long_name[sel_id], dosName); - } - else { - strcat((char *)list_file.file_name[sel_id], (char *)&tmpStr[index]); - strcat((char *)list_file.long_name[sel_id], (char *)&tmpStr[index]); - } + #if ENABLED(SDSUPPORT) + if (!gcode_preview_over) { + char *cur_name = strrchr(list_file.file_name[sel_id], '/'); + MediaFile file; + MediaFile *curDir; + card.abortFilePrintNow(); + const char * const fname = card.diveToFile(false, curDir, cur_name); + if (!fname) return; + if (file.open(curDir, fname, O_READ)) { + gCfgItems.curFilesize = file.fileSize(); + file.close(); + update_spi_flash(); } - else - strcpy(list_file.file_name[sel_id], (char *)&tmpStr[index]); - - char *cur_name=strrchr(list_file.file_name[sel_id],'/'); - card.openFileRead(cur_name); - - if (card.isFileOpen()) - send_to_wifi((uint8_t *)"File selected\r\n", strlen("File selected\r\n")); - else { - send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n")); - strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); + if (card.isFileOpen()) { + //saved_feedrate_percentage = feedrate_percentage; + feedrate_percentage = 100; + #if HAS_EXTRUDERS + planner.flow_percentage[0] = 100; + planner.e_factor[0] = planner.flow_percentage[0] * 0.01f; + #endif + #if HAS_MULTI_EXTRUDER + planner.flow_percentage[1] = 100; + planner.e_factor[1] = planner.flow_percentage[1] * 0.01f; + #endif + card.startOrResumeFilePrinting(); + TERN_(POWER_LOSS_RECOVERY, recovery.prepare()); + once_flag = false; } - SEND_OK_TO_WIFI; } - } - } - break; - - case 24: - if (strcmp_P(list_file.file_name[sel_id], PSTR("notValid")) != 0) { - if (uiCfg.print_state == IDLE) { - clear_cur_ui(); - reset_print_time(); - start_print_time(); - preview_gcode_prehandle(list_file.file_name[sel_id]); - uiCfg.print_state = WORKING; - lv_draw_printing(); - - #if ENABLED(SDSUPPORT) - if (!gcode_preview_over) { - char *cur_name = strrchr(list_file.file_name[sel_id], '/'); - - MediaFile file; - MediaFile *curDir; - card.abortFilePrintNow(); - const char * const fname = card.diveToFile(false, curDir, cur_name); - if (!fname) return; - if (file.open(curDir, fname, O_READ)) { - gCfgItems.curFilesize = file.fileSize(); - file.close(); - update_spi_flash(); - } - card.openFileRead(cur_name); - if (card.isFileOpen()) { - //saved_feedrate_percentage = feedrate_percentage; - feedrate_percentage = 100; - #if HAS_EXTRUDERS - planner.flow_percentage[0] = 100; - planner.e_factor[0] = planner.flow_percentage[0] * 0.01f; - #endif - #if HAS_MULTI_EXTRUDER - planner.flow_percentage[1] = 100; - planner.e_factor[1] = planner.flow_percentage[1] * 0.01f; - #endif - card.startOrResumeFilePrinting(); - TERN_(POWER_LOSS_RECOVERY, recovery.prepare()); - once_flag = false; - } - } - #endif - } - else if (uiCfg.print_state == PAUSED) { - uiCfg.print_state = RESUMING; - clear_cur_ui(); - start_print_time(); - - if (gCfgItems.from_flash_pic) - flash_preview_begin = true; - else - default_preview_flg = true; - lv_draw_printing(); - } - else if (uiCfg.print_state == REPRINTING) { - uiCfg.print_state = REPRINTED; - clear_cur_ui(); - start_print_time(); - if (gCfgItems.from_flash_pic) - flash_preview_begin = true; - else - default_preview_flg = true; - lv_draw_printing(); - } + #endif } - SEND_OK_TO_WIFI; - break; - - case 25: - // Pause print file - if (uiCfg.print_state == WORKING) { - stop_print_time(); - + else if (uiCfg.print_state == PAUSED) { + uiCfg.print_state = RESUMING; clear_cur_ui(); + start_print_time(); - #if ENABLED(SDSUPPORT) - card.pauseSDPrint(); - uiCfg.print_state = PAUSING; - #endif if (gCfgItems.from_flash_pic) flash_preview_begin = true; else default_preview_flg = true; lv_draw_printing(); - SEND_OK_TO_WIFI; } - break; - - case 26: - // Stop print file - if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED) || (uiCfg.print_state == REPRINTING)) { - stop_print_time(); - + else if (uiCfg.print_state == REPRINTING) { + uiCfg.print_state = REPRINTED; clear_cur_ui(); - #if ENABLED(SDSUPPORT) - uiCfg.print_state = IDLE; - card.abortFilePrintSoon(); - #endif + start_print_time(); + if (gCfgItems.from_flash_pic) + flash_preview_begin = true; + else + default_preview_flg = true; + lv_draw_printing(); + } + } + send_ok_to_wifi(); + break; - lv_draw_ready_print(); + case 25: + // Pause print file + if (uiCfg.print_state == WORKING) { + stop_print_time(); - SEND_OK_TO_WIFI; - } - break; - - case 27: - // Report print rate - if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)|| (uiCfg.print_state == REPRINTING)) { - print_rate = uiCfg.totalSend; - ZERO(tempBuf); - sprintf_P((char *)tempBuf, PSTR("M27 %d\r\n"), print_rate); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); - } - break; + clear_cur_ui(); - case 28: - // Begin to transfer file to filesys - if (uiCfg.print_state == IDLE) { + #if ENABLED(SDSUPPORT) + card.pauseSDPrint(); + uiCfg.print_state = PAUSING; + #endif + if (gCfgItems.from_flash_pic) + flash_preview_begin = true; + else + default_preview_flg = true; + lv_draw_printing(); + send_ok_to_wifi(); + } + break; - int index = 0; - while (tmpStr[index] == ' ') index++; + case 26: + // Stop print file + if (uiCfg.print_state == WORKING || uiCfg.print_state == PAUSED || uiCfg.print_state == REPRINTING) { + stop_print_time(); - if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) { - strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]); + clear_cur_ui(); + #if ENABLED(SDSUPPORT) + uiCfg.print_state = IDLE; + card.abortFilePrintSoon(); + #endif - if (gCfgItems.fileSysType == FILE_SYS_SD) { - ZERO(tempBuf); - sprintf_P((char *)tempBuf, PSTR("%s"), file_writer.saveFileName); - } - else if (gCfgItems.fileSysType == FILE_SYS_USB) { - ZERO(tempBuf); - sprintf_P((char *)tempBuf, PSTR("%s"), (char *)file_writer.saveFileName); - } - mount_file_sys(gCfgItems.fileSysType); + lv_draw_ready_print(); - #if ENABLED(SDSUPPORT) - char *cur_name = strrchr(list_file.file_name[sel_id], '/'); - card.openFileWrite(cur_name); - if (card.isFileOpen()) { - ZERO(file_writer.saveFileName); - strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]); - ZERO(tempBuf); - sprintf_P((char *)tempBuf, PSTR("Writing to file: %s\r\n"), (char *)file_writer.saveFileName); - wifi_ret_ack(); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); - wifi_link_state = WIFI_WAIT_TRANS_START; - } - else { - wifi_link_state = WIFI_CONNECTED; - clear_cur_ui(); - lv_draw_dialog(DIALOG_TRANSFER_NO_DEVICE); - } - #endif - } - } - break; + send_ok_to_wifi(); + } + break; - case 105: - case 991: + case 27: + // Report print rate + if (uiCfg.print_state == WORKING || uiCfg.print_state == PAUSED|| uiCfg.print_state == REPRINTING) { + print_rate = uiCfg.totalSend; ZERO(tempBuf); - if (cmd_value == 105) { + sprintf_P((char *)tempBuf, PSTR("M27 %d\r\n"), print_rate); + send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + } + break; - SEND_OK_TO_WIFI; + case 28: + // Begin to transfer file to filesys + if (uiCfg.print_state == IDLE) { - char *outBuf = (char *)tempBuf; - char tbuf[34]; + int index = 0; + while (mStr[index] == ' ') index++; - sprintf_P(tbuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0)); + if (strstr_P(&mStr[index], PSTR(".g")) || strstr_P(&mStr[index], PSTR(".G"))) { + strcpy((char *)file_writer.saveFileName, &mStr[index]); - const int tlen = strlen(tbuf); - sprintf_P(outBuf, PSTR("T:%s"), tbuf); - outBuf += 2 + tlen; + if (gCfgItems.fileSysType == FILE_SYS_SD) { + ZERO(tempBuf); + sprintf_P((char *)tempBuf, PSTR("%s"), file_writer.saveFileName); + } + else if (gCfgItems.fileSysType == FILE_SYS_USB) { + ZERO(tempBuf); + sprintf_P((char *)tempBuf, PSTR("%s"), (char *)file_writer.saveFileName); + } + mount_file_sys(gCfgItems.fileSysType); - strcpy_P(outBuf, PSTR(" B:")); - outBuf += 3; - #if HAS_HEATED_BED - sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegBed(), thermalManager.degTargetBed()); - #else - strcpy_P(outBuf, PSTR("0 /0")); - #endif - outBuf += 4; - - strcat_P(outBuf, PSTR(" T0:")); - strcat(outBuf, tbuf); - outBuf += 4 + tlen; - - strcat_P(outBuf, PSTR(" T1:")); - outBuf += 4; - #if HAS_MULTI_HOTEND - sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1)); - #else - strcpy_P(outBuf, PSTR("0 /0")); + #if ENABLED(SDSUPPORT) + char *cur_name = strrchr(list_file.file_name[sel_id], '/'); + card.openFileWrite(cur_name); + if (card.isFileOpen()) { + ZERO(file_writer.saveFileName); + strcpy((char *)file_writer.saveFileName, &mStr[index]); + ZERO(tempBuf); + sprintf_P((char *)tempBuf, PSTR("Writing to file: %s\r\n"), (char *)file_writer.saveFileName); + wifi_ret_ack(); + send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + wifi_link_state = WIFI_WAIT_TRANS_START; + } + else { + wifi_link_state = WIFI_CONNECTED; + clear_cur_ui(); + lv_draw_dialog(DIALOG_TRANSFER_NO_DEVICE); + } #endif - outBuf += 4; - - strcat_P(outBuf, PSTR(" @:0 B@:0\r\n")); - } - else { - sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"), - thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0), - TERN0(HAS_HEATED_BED, thermalManager.wholeDegBed()), - TERN0(HAS_HEATED_BED, thermalManager.degTargetBed()), - thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0), - TERN0(HAS_MULTI_HOTEND, thermalManager.wholeDegHotend(1)), - TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1)) - ); } + } + break; - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); - queue.enqueue_one(F("M105")); - break; + case 105: + case 991: + ZERO(tempBuf); + if (cmd_value == 105) { + + send_ok_to_wifi(); + + char *outBuf = (char *)tempBuf; + char tbuf[34]; + + sprintf_P(tbuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0)); + + const int tlen = strlen(tbuf); + sprintf_P(outBuf, PSTR("T:%s"), tbuf); + outBuf += 2 + tlen; + + strcpy_P(outBuf, PSTR(" B:")); + outBuf += 3; + #if HAS_HEATED_BED + sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegBed(), thermalManager.degTargetBed()); + #else + strcpy_P(outBuf, PSTR("0 /0")); + #endif + outBuf += 4; + + strcat_P(outBuf, PSTR(" T0:")); + strcat(outBuf, tbuf); + outBuf += 4 + tlen; + + strcat_P(outBuf, PSTR(" T1:")); + outBuf += 4; + #if HAS_MULTI_HOTEND + sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1)); + #else + strcpy_P(outBuf, PSTR("0 /0")); + #endif + outBuf += 4; + + strcat_P(outBuf, PSTR(" @:0 B@:0\r\n")); + } + else { + sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"), + thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0), + TERN0(HAS_HEATED_BED, thermalManager.wholeDegBed()), + TERN0(HAS_HEATED_BED, thermalManager.degTargetBed()), + thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0), + TERN0(HAS_MULTI_HOTEND, thermalManager.wholeDegHotend(1)), + TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1)) + ); + } - case 992: - if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) { - ZERO(tempBuf); - sprintf_P((char *)tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10); - wifi_ret_ack(); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); - } - break; + send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + queue.enqueue_one(F("M105")); + break; - case 994: - if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) { - ZERO(tempBuf); - if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return; - sprintf_P((char *)tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize); - wifi_ret_ack(); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); - } - break; + case 992: + if (uiCfg.print_state == WORKING || uiCfg.print_state == PAUSED) { + ZERO(tempBuf); + sprintf_P((char *)tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10); + wifi_ret_ack(); + send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + } + break; - case 997: - if (uiCfg.print_state == IDLE) { + case 994: + if (uiCfg.print_state == WORKING || uiCfg.print_state == PAUSED) { + ZERO(tempBuf); + if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return; + sprintf_P((char *)tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize); + wifi_ret_ack(); + send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + } + break; + + case 997: + #define SENDIDLE "M997 IDLE\r\n" + #define SENDPRINTING "M997 PRINTING\r\n" + #define SENDPAUSE "M997 PAUSE\r\n" + switch (uiCfg.print_state) { + default: break; + case IDLE: wifi_ret_ack(); - send_to_wifi((uint8_t *)"M997 IDLE\r\n", strlen("M997 IDLE\r\n")); - } - else if (uiCfg.print_state == WORKING) { + send_to_wifi((uint8_t *)SENDIDLE, strlen(SENDIDLE)); + break; + case WORKING: wifi_ret_ack(); - send_to_wifi((uint8_t *)"M997 PRINTING\r\n", strlen("M997 PRINTING\r\n")); - } - else if (uiCfg.print_state == PAUSED) { + send_to_wifi((uint8_t *)SENDPRINTING, strlen(SENDPRINTING)); + break; + case PAUSED: wifi_ret_ack(); - send_to_wifi((uint8_t *)"M997 PAUSE\r\n", strlen("M997 PAUSE\r\n")); - } - else if (uiCfg.print_state == REPRINTING) { + send_to_wifi((uint8_t *)SENDPAUSE, strlen(SENDPAUSE)); + break; + case REPRINTING: wifi_ret_ack(); - send_to_wifi((uint8_t *)"M997 PAUSE\r\n", strlen("M997 PAUSE\r\n")); - } - if (!uiCfg.command_send) get_wifi_list_command_send(); - break; + send_to_wifi((uint8_t *)SENDPAUSE, strlen(SENDPAUSE)); + break; + } + if (!uiCfg.command_send) get_wifi_list_command_send(); + break; - case 998: - if (uiCfg.print_state == IDLE) { - const int v = atoi((char *)tmpStr); - if (v == 0 || v == 1) set_cur_file_sys(v); - wifi_ret_ack(); - } - break; + case 998: + if (uiCfg.print_state == IDLE) { + const int v = atoi(mStr); + if (v == 0 || v == 1) set_cur_file_sys(v); + wifi_ret_ack(); + } + break; - case 115: - ZERO(tempBuf); - SEND_OK_TO_WIFI; - send_to_wifi((uint8_t *)"FIRMWARE_NAME:Robin_nano\r\n", strlen("FIRMWARE_NAME:Robin_nano\r\n")); - break; - - default: - strcat_P((char *)cmd_line, PSTR("\n")); - - if (espGcodeFifo.wait_tick > 5) { - const uint32_t left = espGcodeFifo.r > espGcodeFifo.w - ? espGcodeFifo.r - espGcodeFifo.w - 1 - : WIFI_GCODE_BUFFER_SIZE + espGcodeFifo.r - espGcodeFifo.w - 1; - - if (left >= strlen((const char *)cmd_line)) { - for (uint32_t index = 0; index < strlen((const char *)cmd_line); index++) { - espGcodeFifo.Buffer[espGcodeFifo.w] = cmd_line[index] ; - espGcodeFifo.w = (espGcodeFifo.w + 1) % WIFI_GCODE_BUFFER_SIZE; - } - if (left - WIFI_GCODE_BUFFER_LEAST_SIZE >= strlen((const char *)cmd_line)) - SEND_OK_TO_WIFI; - else - need_ok_later = true; + case 115: + ZERO(tempBuf); + send_ok_to_wifi(); + #define SENDFW "FIRMWARE_NAME:Robin_nano\r\n" + send_to_wifi((uint8_t *)SENDFW, strlen(SENDFW)); + break; + + default: + strcat_P((char *)cmd_line, PSTR("\n")); + + if (espGcodeFifo.wait_tick > 5) { + uint32_t left = espGcodeFifo.r - espGcodeFifo.w - 1; + if (espGcodeFifo.r > espGcodeFifo.w) left += WIFI_GCODE_BUFFER_SIZE; + + if (left >= strlen((const char *)cmd_line)) { + for (uint32_t index = 0; index < strlen((const char *)cmd_line); index++) { + espGcodeFifo.Buffer[espGcodeFifo.w] = cmd_line[index]; + espGcodeFifo.w = (espGcodeFifo.w + 1) % (WIFI_GCODE_BUFFER_SIZE); } + if (left - (WIFI_GCODE_BUFFER_LEAST_SIZE) >= strlen((const char *)cmd_line)) + send_ok_to_wifi(); + else + need_ok_later = true; } - break; - } + } + break; } - else { - strcat_P((char *)cmd_line, PSTR("\n")); + } + else { + // Add another linefeed to the command, terminate with null + strcat_P((char *)cmd_line, PSTR("\n")); - if (espGcodeFifo.wait_tick > 5) { - const uint32_t left_g = espGcodeFifo.r > espGcodeFifo.w - ? espGcodeFifo.r - espGcodeFifo.w - 1 - : WIFI_GCODE_BUFFER_SIZE + espGcodeFifo.r - espGcodeFifo.w - 1; + if (espGcodeFifo.wait_tick > 5) { + uint32_t left_g = espGcodeFifo.r - espGcodeFifo.w - 1; + if (espGcodeFifo.r > espGcodeFifo.w) left_g += WIFI_GCODE_BUFFER_SIZE; - if (left_g >= strlen((const char *)cmd_line)) { - for (uint32_t index = 0; index < strlen((const char *)cmd_line); index++) { - espGcodeFifo.Buffer[espGcodeFifo.w] = cmd_line[index] ; - espGcodeFifo.w = (espGcodeFifo.w + 1) % WIFI_GCODE_BUFFER_SIZE; - } - if (left_g - WIFI_GCODE_BUFFER_LEAST_SIZE >= strlen((const char *)cmd_line)) - SEND_OK_TO_WIFI; - else - need_ok_later = true; + if (left_g >= strlen((char * const)cmd_line)) { + for (uint32_t index = 0; index < strlen((char * const)cmd_line); index++) { + espGcodeFifo.Buffer[espGcodeFifo.w] = cmd_line[index]; + espGcodeFifo.w = (espGcodeFifo.w + 1) % (WIFI_GCODE_BUFFER_SIZE); } + if (left_g - (WIFI_GCODE_BUFFER_LEAST_SIZE) >= strlen((char * const)cmd_line)) + send_ok_to_wifi(); + else + need_ok_later = true; } } } @@ -1281,7 +1309,7 @@ void get_wifi_list_command_send() { raw_send_to_wifi(cmd_wifi_list, COUNT(cmd_wifi_list)); } -static void net_msg_handle(uint8_t * msg, uint16_t msgLen) { +static void net_msg_handle(const uint8_t * const msg, const uint16_t msgLen) { int wifiNameLen, wifiKeyLen, hostLen, id_len, ver_len; if (msgLen <= 0) return; @@ -1316,7 +1344,7 @@ static void net_msg_handle(uint8_t * msg, uint16_t msgLen) { } } - cloud_para.state =msg[10 + wifiNameLen + wifiKeyLen]; + cloud_para.state = msg[10 + wifiNameLen + wifiKeyLen]; hostLen = msg[11 + wifiNameLen + wifiKeyLen]; if (cloud_para.state) { if (hostLen < 96) { @@ -1356,7 +1384,7 @@ static void net_msg_handle(uint8_t * msg, uint16_t msgLen) { } } -static void wifi_list_msg_handle(uint8_t * msg, uint16_t msgLen) { +static void wifi_list_msg_handle(const uint8_t * const msg, const uint16_t msgLen) { int wifiNameLen,wifiMsgIdex = 1; int8_t wifi_name_is_same = 0; int8_t i, j; @@ -1415,16 +1443,15 @@ static void wifi_list_msg_handle(uint8_t * msg, uint16_t msgLen) { } } -static void gcode_msg_handle(uint8_t * msg, uint16_t msgLen) { +static void gcode_msg_handle(const uint8_t * const msg, const uint16_t msgLen) { uint8_t gcodeBuf[100] = { 0 }; - char *index_s, *index_e; if (msgLen <= 0) return; - index_s = (char *)msg; - index_e = (char *)strchr((char *)msg, '\n'); + char *index_s = (char *)msg, + *index_e = strchr((char *)msg, '\n'); if (*msg == 'N') { - index_s = (char *)strchr((char *)msg, ' '); + index_s = strchr((char *)msg, ' '); while (*index_s == ' ') index_s++; } while ((index_e != 0) && ((int)index_s < (int)index_e)) { @@ -1435,7 +1462,7 @@ static void gcode_msg_handle(uint8_t * msg, uint16_t msgLen) { } while ((*index_e == '\r') || (*index_e == '\n')) index_e++; index_s = index_e; - index_e = (char *)strchr(index_s, '\n'); + index_e = strchr(index_s, '\n'); } } @@ -1482,8 +1509,8 @@ void utf8_2_unicode(uint8_t *source, uint8_t Len) { COPY(source, FileName_unicode); } -static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) { - uint8_t fileNameLen = *msg; +static void file_first_msg_handle(const uint8_t * const msg, const uint16_t msgLen) { + const uint8_t fileNameLen = *msg; if (msgLen != fileNameLen + 5) return; @@ -1565,8 +1592,8 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) { #define FRAG_MASK ~_BV32(31) -static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) { - uint32_t frag = *((uint32_t *)msg); +static void file_fragment_msg_handle(const uint8_t * const msg, const uint16_t msgLen) { + const uint32_t frag = *((uint32_t *)msg); if ((frag & FRAG_MASK) != (uint32_t)(lastFragment + 1)) { ZERO(public_buf); file_writer.write_index = 0; @@ -1842,7 +1869,7 @@ void wifi_rcv_handle() { } if (need_ok_later && !queue.ring_buffer.full()) { need_ok_later = false; - send_to_wifi((uint8_t *)"ok\r\n", strlen("ok\r\n")); + send_ok_to_wifi(); } } @@ -1872,7 +1899,7 @@ void wifi_rcv_handle() { if (wifiTransError.flag == 0x1) { wifiTransError.now_tick = getWifiTick(); - if (getWifiTickDiff(wifiTransError.start_tick, wifiTransError.now_tick) > WAIT_ESP_TRANS_TIMEOUT_TICK) { + if (getWifiTickDiff(wifiTransError.start_tick, wifiTransError.now_tick) > (WAIT_ESP_TRANS_TIMEOUT_TICK)) { wifiTransError.flag = 0; WIFI_IO1_RESET(); } @@ -1992,7 +2019,7 @@ void get_wifi_commands() { char wifi_char = espGcodeFifo.Buffer[espGcodeFifo.r]; - espGcodeFifo.r = (espGcodeFifo.r + 1) % WIFI_GCODE_BUFFER_SIZE; + espGcodeFifo.r = (espGcodeFifo.r + 1) % (WIFI_GCODE_BUFFER_SIZE); /** * If the character ends the line diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.h b/Marlin/src/lcd/extui/mks_ui/wifi_module.h index 36998899b483..851e85c512a0 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.h +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.h @@ -163,8 +163,8 @@ typedef struct { //uint8_t uartTxBuffer[UART_FIFO_BUFFER_SIZE]; } SZ_USART_FIFO; -#define WIFI_GCODE_BUFFER_LEAST_SIZE 96 -#define WIFI_GCODE_BUFFER_SIZE (WIFI_GCODE_BUFFER_LEAST_SIZE * 3) +#define WIFI_GCODE_BUFFER_LEAST_SIZE 96 +#define WIFI_GCODE_BUFFER_SIZE (WIFI_GCODE_BUFFER_LEAST_SIZE * 3) typedef struct { uint8_t wait_tick; uint8_t Buffer[WIFI_GCODE_BUFFER_SIZE]; @@ -179,14 +179,14 @@ extern CLOUD_PARA cloud_para; extern WIFI_GCODE_BUFFER espGcodeFifo; -uint32_t getWifiTick(); -uint32_t getWifiTickDiff(int32_t lastTick, int32_t curTick); +millis_t getWifiTick(); +millis_t getWifiTickDiff(const millis_t lastTick, const millis_t curTick); void mks_esp_wifi_init(); extern int cfg_cloud_flag; -int send_to_wifi(uint8_t *buf, int len); +int send_to_wifi(uint8_t * const buf, const int len); void wifi_looping(); -int raw_send_to_wifi(uint8_t *buf, int len); +int raw_send_to_wifi(uint8_t * const buf, const int len); int package_to_wifi(WIFI_RET_TYPE type, uint8_t *buf, int len); void get_wifi_list_command_send(); void get_wifi_commands(); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp index 44869d477098..398d35fdc3f3 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp @@ -38,10 +38,8 @@ extern SZ_USART_FIFO WifiRxFifo; -extern int readUsartFifo(SZ_USART_FIFO *fifo, int8_t *buf, int32_t len); -extern int writeUsartFifo(SZ_USART_FIFO * fifo, int8_t * buf, int32_t len); void esp_port_begin(uint8_t interrupt); -void wifi_delay(int n); +void wifi_delay(const uint16_t n); #define ARRAY_SIZE(a) sizeof(a) / sizeof((a)[0]) @@ -246,7 +244,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t const size_t headerLength = 8; - uint32_t startTime = getWifiTick(); + const millis_t startTime = getWifiTick(); uint8_t hdr[headerLength]; uint16_t hdrIdx = 0; diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.h b/Marlin/src/lcd/extui/mks_ui/wifi_upload.h index 2daa505d9088..524fb28f85fe 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.h +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.h @@ -59,8 +59,8 @@ typedef struct { UploadState state; uint32_t retriesPerBaudRate; uint32_t connectAttemptNumber; - uint32_t lastAttemptTime; - uint32_t lastResetTime; + millis_t lastAttemptTime; + millis_t lastResetTime; uint32_t uploadBlockNumber; uint32_t uploadNextPercentToReport; EspUploadResult uploadResult; diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index 433bbfbe8b88..bf40fe97ac71 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -79,12 +79,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -103,6 +103,9 @@ namespace ExtUI { #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 } diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 63c25177a679..8b7b36e9ce52 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -431,27 +431,27 @@ void NextionTFT::PanelInfo(uint8_t req) { case 36: // Endstop Info #if X_HOME_TO_MIN - SEND_VALasTXT("x1", READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("x1", READ(X_MIN_PIN) == X_MIN_ENDSTOP_HIT_STATE ? "triggered" : "open"); #elif X_HOME_TO_MAX - SEND_VALasTXT("x2", READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("x2", READ(X_MAX_PIN) == X_MAX_ENDSTOP_HIT_STATE ? "triggered" : "open"); #endif #if Y_HOME_TO_MIN - SEND_VALasTXT("y1", READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("y1", READ(Y_MIN_PIN) == Y_MIN_ENDSTOP_HIT_STATE ? "triggered" : "open"); #elif Y_HOME_TO_MAX - SEND_VALasTXT("y2", READ(X_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("y2", READ(X_MAX_PIN) == Y_MAX_ENDSTOP_HIT_STATE ? "triggered" : "open"); #endif #if Z_HOME_TO_MIN - SEND_VALasTXT("z1", READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("z1", READ(Z_MIN_PIN) == Z_MIN_ENDSTOP_HIT_STATE ? "triggered" : "open"); #elif Z_HOME_TO_MAX - SEND_VALasTXT("z2", READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("z2", READ(Z_MAX_PIN) == Z_MAX_ENDSTOP_HIT_STATE ? "triggered" : "open"); #endif #if HAS_Z2_MIN - SEND_VALasTXT("z2", READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("z2", READ(Z2_MIN_PIN) == Z2_MIN_ENDSTOP_HIT_STATE ? "triggered" : "open"); #elif HAS_Z2_MAX - SEND_VALasTXT("z2", READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); + SEND_VALasTXT("z2", READ(Z2_MAX_PIN) == Z2_MAX_ENDSTOP_HIT_STATE ? "triggered" : "open"); #endif #if HAS_BED_PROBE - //SEND_VALasTXT("bltouch", READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING ? "triggered" : "open"); + //SEND_VALasTXT("bltouch", READ(Z_MIN_PROBE_PIN) == Z_MIN_PROBE_ENDSTOP_HIT_STATE ? "triggered" : "open"); #else SEND_NA("bltouch"); #endif diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 1075816c4339..7e47bef9c147 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -112,9 +112,9 @@ namespace ExtUI { static struct { - uint8_t printer_killed : 1; + bool printer_killed : 1; #if ENABLED(JOYSTICK) - uint8_t jogging : 1; + bool jogging : 1; #endif } flags; @@ -926,7 +926,7 @@ namespace ExtUI { void setMeshPoint(const xy_uint8_t &pos, const_float_t zoff) { if (WITHIN(pos.x, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(pos.y, 0, (GRID_MAX_POINTS_Y) - 1)) { bedlevel.z_values[pos.x][pos.y] = zoff; - TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate()); + TERN_(ABL_BILINEAR_SUBDIVISION, bedlevel.refresh_bed_level()); } } @@ -1127,14 +1127,21 @@ namespace ExtUI { #endif } + void onSurviveInKilled() { + thermalManager.disable_all_heaters(); + flags.printer_killed = 0; + marlin_state = MF_RUNNING; + //SERIAL_ECHOLNPGM("survived at: ", millis()); + } + FileList::FileList() { refresh(); } - void FileList::refresh() { num_files = 0xFFFF; } + void FileList::refresh() { } bool FileList::seek(const uint16_t pos, const bool skip_range_check) { #if ENABLED(SDSUPPORT) if (!skip_range_check && (pos + 1) > count()) return false; - card.getfilename_sorted(SD_ORDER(pos, count())); + card.selectFileByIndexSorted(pos); return card.filename[0] != '\0'; #else UNUSED(pos); @@ -1160,7 +1167,7 @@ namespace ExtUI { } uint16_t FileList::count() { - return TERN0(SDSUPPORT, (num_files = (num_files == 0xFFFF ? card.get_num_Files() : num_files))); + return TERN0(SDSUPPORT, card.get_num_items()); } bool FileList::isAtRootDir() { @@ -1168,19 +1175,11 @@ namespace ExtUI { } void FileList::upDir() { - #if ENABLED(SDSUPPORT) - card.cdup(); - num_files = 0xFFFF; - #endif + TERN_(SDSUPPORT, card.cdup()); } void FileList::changeDir(const char * const dirname) { - #if ENABLED(SDSUPPORT) - card.cd(dirname); - num_files = 0xFFFF; - #else - UNUSED(dirname); - #endif + TERN(SDSUPPORT, card.cd(dirname), UNUSED(dirname)); } } // namespace ExtUI diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 46f0891bb706..209635ea0944 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -45,6 +45,7 @@ #include "../../inc/MarlinConfig.h" #include "../marlinui.h" #include "../../gcode/gcode.h" + #if M600_PURGE_MORE_RESUMABLE #include "../../feature/pause.h" #endif @@ -375,9 +376,6 @@ namespace ExtUI { void resumePrint(); class FileList { - private: - uint16_t num_files; - public: FileList(); void refresh(); @@ -406,6 +404,7 @@ namespace ExtUI { void onMediaRemoved(); void onPlayTone(const uint16_t frequency, const uint16_t duration); void onPrinterKilled(FSTR_P const error, FSTR_P const component); + void onSurviveInKilled(); void onPrintTimerStarted(); void onPrintTimerPaused(); void onPrintTimerStopped(); @@ -423,9 +422,10 @@ namespace ExtUI { void onStoreSettings(char *); void onLoadSettings(const char *); void onPostprocessSettings(); - void onSettingsStored(bool success); - void onSettingsLoaded(bool success); + void onSettingsStored(const bool success); + void onSettingsLoaded(const bool success); #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff); void onPowerLoss(); void onPowerLossResume(); #endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 0a695bfe0633..55f426017cef 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -866,11 +866,12 @@ namespace Language_en { LSTR MSG_HOST_SHUTDOWN = _UxGT("Host Shutdown"); - // These strings can be the same in all languages - LSTR MSG_MARLIN = _UxGT("Marlin"); LSTR MSG_SHORT_DAY = _UxGT("d"); // One character only LSTR MSG_SHORT_HOUR = _UxGT("h"); // One character only LSTR MSG_SHORT_MINUTE = _UxGT("m"); // One character only + + // These strings can be the same in all languages + LSTR MSG_MARLIN = _UxGT("Marlin"); LSTR MSG_PID_P = _UxGT("PID-P"); LSTR MSG_PID_P_E = _UxGT("PID-P *"); LSTR MSG_PID_I = _UxGT("PID-I"); @@ -882,12 +883,28 @@ namespace Language_en { LSTR MSG_PID_F = _UxGT("PID-F"); LSTR MSG_PID_F_E = _UxGT("PID-F *"); LSTR MSG_BACKLASH_N = _UxGT("@"); -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + // DGUS-Specific message strings, not used elsewhere + 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"); + LSTR DGUS_MSG_PID_AUTOTUNING = _UxGT("PID autotuning..."); + LSTR DGUS_MSG_INVALID_RECOVERY_DATA = _UxGT("Invalid recovery data"); + + LSTR DGUS_MSG_HOMING_REQUIRED = _UxGT("Homing required"); + LSTR DGUS_MSG_BUSY = _UxGT("Busy"); + LSTR DGUS_MSG_HOMING = _UxGT("Homing..."); + LSTR DGUS_MSG_FW_OUTDATED = _UxGT("DWIN GUI/OS update required"); + LSTR DGUS_MSG_ABL_REQUIRED = _UxGT("Auto bed leveling required"); + LSTR DGUS_MSG_PROBING_FAILED = _UxGT("Probing failed"); + LSTR DGUS_MSG_PROBING_SUCCESS = _UxGT("Probing successful"); + LSTR DGUS_MSG_RESET_EEPROM = _UxGT("EEPROM reset"); + LSTR DGUS_MSG_WRITE_EEPROM_FAILED = _UxGT("EEPROM write failed"); + LSTR DGUS_MSG_READ_EEPROM_FAILED = _UxGT("EEPROM read failed"); + LSTR DGUS_MSG_FILAMENT_RUNOUT = _UxGT("Filament runout E%d"); + +} diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index e274de8db63c..112832839140 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -443,9 +443,6 @@ namespace Language_fr { LSTR MSG_HALTED = _UxGT("IMPR. STOPPÉE"); LSTR MSG_PLEASE_RESET = _UxGT("Redémarrer SVP"); - LSTR MSG_SHORT_DAY = _UxGT("j"); // One character only - LSTR MSG_SHORT_HOUR = _UxGT("h"); // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("m"); // One character only LSTR MSG_HEATING = _UxGT("en chauffe..."); LSTR MSG_COOLING = _UxGT("Refroidissement"); @@ -631,4 +628,31 @@ namespace Language_fr { LSTR MSG_SD_CARD = _UxGT("Carte SD"); LSTR MSG_USB_DISK = _UxGT("Clé USB"); + + // DGUS-Specific message strings, not used elsewhere + 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"); + LSTR DGUS_MSG_PID_AUTOTUNING = _UxGT("Autocalibrage du PID..."); + LSTR DGUS_MSG_INVALID_RECOVERY_DATA = _UxGT("Donnees de recuperation non valides"); + + LSTR DGUS_MSG_HOMING_REQUIRED = _UxGT("Retour a l'origine necessaire..."); + LSTR DGUS_MSG_BUSY = _UxGT("Occupe"); + LSTR DGUS_MSG_HOMING = _UxGT("Retour a l'origine..."); + LSTR DGUS_MSG_FW_OUTDATED = _UxGT("Mise a jour DWIN GUI/OS necessaire"); + LSTR DGUS_MSG_ABL_REQUIRED = _UxGT("Nivellement du bed necessaire"); + LSTR DGUS_MSG_PROBING_FAILED = _UxGT("Echec du nivellement..."); + LSTR DGUS_MSG_PROBING_SUCCESS = _UxGT("Nivellement realise avec succes"); + LSTR DGUS_MSG_RESET_EEPROM = _UxGT("Reinitialisation de l'EEPROM"); + LSTR DGUS_MSG_WRITE_EEPROM_FAILED = _UxGT("Echec ecriture de l'EEPROM"); + LSTR DGUS_MSG_READ_EEPROM_FAILED = _UxGT("Echec lecture de l'EEPROM"); + LSTR DGUS_MSG_FILAMENT_RUNOUT = _UxGT("Sortie de filament E%d"); + + LSTR MSG_SHORT_DAY = _UxGT("j"); // One character only + LSTR MSG_SHORT_HOUR = _UxGT("h"); // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("m"); // One character only } diff --git a/Marlin/src/lcd/language/language_fr_na.h b/Marlin/src/lcd/language/language_fr_na.h new file mode 100644 index 000000000000..48030dd031d2 --- /dev/null +++ b/Marlin/src/lcd/language/language_fr_na.h @@ -0,0 +1,658 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * French (without accent for DWIN T5UID1) + * + * LCD Menu Messages + * See also https://marlinfw.org/docs/development/lcd_language.html + */ + +#define DISPLAY_CHARSET_ISO10646_1 +#define NOT_EXTENDED_ISO10646_1_5X7 + +namespace Language_fr_na { + using namespace Language_en; // Inherit undefined strings from English + + LSTR LANGUAGE = _UxGT("Francais"); + + LSTR WELCOME_MSG = MACHINE_NAME _UxGT(" prete."); + LSTR MSG_YES = _UxGT("Oui"); + LSTR MSG_NO = _UxGT("Non"); + LSTR MSG_BACK = _UxGT("Retour"); + LSTR MSG_MEDIA_ABORTING = _UxGT("Annulation..."); + LSTR MSG_MEDIA_INSERTED = _UxGT("Media insere"); + LSTR MSG_MEDIA_REMOVED = _UxGT("Media retire"); + LSTR MSG_MEDIA_WAITING = _UxGT("Attente media"); + LSTR MSG_MEDIA_READ_ERROR = _UxGT("Err lecture media"); + LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB debranche"); + LSTR MSG_MEDIA_USB_FAILED = _UxGT("Erreur media USB"); + LSTR MSG_LCD_ENDSTOPS = _UxGT("Butees"); + LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Butees SW"); + LSTR MSG_MAIN = _UxGT("Menu principal"); + LSTR MSG_ADVANCED_SETTINGS = _UxGT("Config. avancee"); + LSTR MSG_CONFIGURATION = _UxGT("Configuration"); + LSTR MSG_RUN_AUTO_FILES = _UxGT("Exec. auto.gcode"); + LSTR MSG_DISABLE_STEPPERS = _UxGT("Arreter moteurs"); + LSTR MSG_DEBUG_MENU = _UxGT("Menu debug"); + LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barre progress."); + LSTR MSG_HOMING = _UxGT("Origine"); + LSTR MSG_AUTO_HOME = _UxGT("Origine auto"); + LSTR MSG_AUTO_HOME_A = _UxGT("Origine @ auto"); + LSTR MSG_AUTO_HOME_X = _UxGT("Origine X auto"); + LSTR MSG_AUTO_HOME_Y = _UxGT("Origine Y auto"); + LSTR MSG_AUTO_HOME_Z = _UxGT("Origine Z auto"); + LSTR MSG_AUTO_Z_ALIGN = _UxGT("Align. Z auto"); + LSTR MSG_LEVEL_BED_HOMING = _UxGT("Origine XYZ..."); + LSTR MSG_LEVEL_BED_WAITING = _UxGT("Clic pour commencer"); + LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("Point suivant"); + LSTR MSG_LEVEL_BED_DONE = _UxGT("Mise a niveau OK!"); + LSTR MSG_Z_FADE_HEIGHT = _UxGT("Hauteur lissee"); + LSTR MSG_SET_HOME_OFFSETS = _UxGT("Regl. decal origine"); + LSTR MSG_HOME_OFFSET_X = _UxGT("Decal. origine X"); + LSTR MSG_HOME_OFFSET_Y = _UxGT("Decal. origine Y"); + LSTR MSG_HOME_OFFSET_Z = _UxGT("Decal. origine Z"); + LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Decalages appliques"); + LSTR MSG_TRAMMING_WIZARD = _UxGT("Assistant Molettes"); + LSTR MSG_SELECT_ORIGIN = _UxGT("Molette du lit"); // Not a selection of the origin + LSTR MSG_LAST_VALUE_SP = _UxGT("Ecart origine "); + #if HAS_PREHEAT + LSTR MSG_PREHEAT_1 = _UxGT("Prechauffage ") PREHEAT_1_LABEL; + LSTR MSG_PREHEAT_1_H = _UxGT("Prechauffage ") PREHEAT_1_LABEL " ~"; + LSTR MSG_PREHEAT_1_END = _UxGT("Prech. ") PREHEAT_1_LABEL _UxGT(" buse"); + LSTR MSG_PREHEAT_1_END_E = _UxGT("Prech. ") PREHEAT_1_LABEL _UxGT(" buse ~"); + LSTR MSG_PREHEAT_1_ALL = _UxGT("Prech. ") PREHEAT_1_LABEL _UxGT(" Tout"); + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Prech. ") PREHEAT_1_LABEL _UxGT(" lit"); + LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Regler prech. ") PREHEAT_1_LABEL; + + LSTR MSG_PREHEAT_M = _UxGT("Prechauffage $"); + LSTR MSG_PREHEAT_M_H = _UxGT("Prechauffage $ ~"); + LSTR MSG_PREHEAT_M_END = _UxGT("Prech. $ buse"); + LSTR MSG_PREHEAT_M_END_E = _UxGT("Prech. $ buse ~"); + LSTR MSG_PREHEAT_M_ALL = _UxGT("Prech. $ Tout"); + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Prech. $ lit"); + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Regler prech. $"); + #endif + LSTR MSG_PREHEAT_CUSTOM = _UxGT("Prechauf. perso"); + LSTR MSG_COOLDOWN = _UxGT("Refroidir"); + LSTR MSG_LASER_MENU = _UxGT("Controle Laser"); + LSTR MSG_LASER_POWER = _UxGT("Puissance"); + LSTR MSG_SPINDLE_REVERSE = _UxGT("Inverser broches"); + LSTR MSG_SWITCH_PS_ON = _UxGT("Allumer alim."); + LSTR MSG_SWITCH_PS_OFF = _UxGT("Eteindre alim."); + LSTR MSG_EXTRUDE = _UxGT("Extrusion"); + LSTR MSG_RETRACT = _UxGT("Retractation"); + LSTR MSG_MOVE_AXIS = _UxGT("Deplacer un axe"); + LSTR MSG_BED_LEVELING = _UxGT("Regler Niv. lit"); + LSTR MSG_LEVEL_BED = _UxGT("Niveau du lit"); + LSTR MSG_BED_TRAMMING = _UxGT("Niveau des coins"); + LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Relever le coin jusqu'a la sonde"); + LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Coins dans la tolerance. Niveau lit."); + LSTR MSG_NEXT_CORNER = _UxGT("Coin suivant"); + LSTR MSG_MESH_EDITOR = _UxGT("Modif. maille"); // 13 car. max + LSTR MSG_EDIT_MESH = _UxGT("Modifier grille"); + LSTR MSG_EDITING_STOPPED = _UxGT("Modification arretee"); + LSTR MSG_PROBING_POINT = _UxGT("Mesure point"); + LSTR MSG_MESH_X = _UxGT("Index X"); + LSTR MSG_MESH_Y = _UxGT("Index Y"); + LSTR MSG_MESH_EDIT_Z = _UxGT("Valeur Z"); + LSTR MSG_CUSTOM_COMMANDS = _UxGT("Commandes perso"); + + LSTR MSG_LCD_TILTING_MESH = _UxGT("Mesure point"); + LSTR MSG_M48_TEST = _UxGT("Ecart sonde Z M48"); + LSTR MSG_M48_DEVIATION = _UxGT("Ecart"); + LSTR MSG_M48_POINT = _UxGT("Point M48"); + LSTR MSG_IDEX_MENU = _UxGT("Mode IDEX"); + LSTR MSG_IDEX_MODE_AUTOPARK = _UxGT("Auto-Park"); + LSTR MSG_IDEX_MODE_DUPLICATE = _UxGT("Duplication"); + LSTR MSG_IDEX_MODE_MIRRORED_COPY = _UxGT("Copie miroir"); + LSTR MSG_IDEX_MODE_FULL_CTRL = _UxGT("Controle complet"); + LSTR MSG_OFFSETS_MENU = _UxGT("Offsets Outil"); + LSTR MSG_HOTEND_OFFSET_Z = _UxGT("Buse 2 Z"); + LSTR MSG_HOTEND_OFFSET_A = _UxGT("Buse 2 @"); + LSTR MSG_G26_HEATING_BED = _UxGT("G26: Chauffage du lit"); + LSTR MSG_G26_HEATING_NOZZLE = _UxGT("Buse en chauffe..."); + LSTR MSG_G26_MANUAL_PRIME = _UxGT("Amorce manuelle..."); + LSTR MSG_G26_FIXED_LENGTH = _UxGT("Amorce longueur fixe"); + LSTR MSG_G26_PRIME_DONE = _UxGT("Amorce terminee"); + LSTR MSG_G26_CANCELED = _UxGT("G26 annule"); + LSTR MSG_G26_LEAVING = _UxGT("Sortie G26"); + LSTR MSG_UBL_DOING_G29 = _UxGT("G29 en cours"); + LSTR MSG_UBL_TOOLS = _UxGT("Outils UBL"); + LSTR MSG_UBL_LEVEL_BED = _UxGT("Niveau lit unifie"); + LSTR MSG_UBL_MANUAL_MESH = _UxGT("Maillage manuel"); + LSTR MSG_UBL_BC_INSERT = _UxGT("Poser cale & mesurer"); + LSTR MSG_UBL_BC_INSERT2 = _UxGT("Mesure"); + LSTR MSG_UBL_BC_REMOVE = _UxGT("oter et mesurer lit"); + LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("Aller au suivant"); + LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("Activer l'UBL"); + LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("Desactiver l'UBL"); + LSTR MSG_UBL_SET_TEMP_BED = _UxGT("Temperature lit"); + LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("Temperature lit"); + LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("Temperature buse"); + LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("Temperature buse"); + LSTR MSG_UBL_MESH_EDIT = _UxGT("Modifier grille"); + LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("Modif. grille perso"); + LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("Reglage fin"); + LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Terminer"); + LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Creer la grille"); + #if HAS_PREHEAT + LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Creer grille $"); + LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Impr. grille $"); + #endif + LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Creer grille ..."); + LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("Mesure a froid"); + LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("Ajuster haut. couche"); + LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("Hauteur (x0.1mm)"); + LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("Verifier grille"); + LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Impr. grille ..."); + LSTR MSG_UBL_CONTINUE_MESH = _UxGT("Continuer grille"); + LSTR MSG_UBL_MESH_LEVELING = _UxGT("Niveau par mailles"); + LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("Niveau a 3 points"); + LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("Niveau par grille"); + LSTR MSG_UBL_MESH_LEVEL = _UxGT("Effectuer mesures"); + LSTR MSG_UBL_SIDE_POINTS = _UxGT("Points lateraux"); + LSTR MSG_UBL_MAP_TYPE = _UxGT("Type de carte"); + LSTR MSG_UBL_OUTPUT_MAP = _UxGT("Exporter grille"); + LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("Export pour hote"); + LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("Export en CSV"); + LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("Export sauvegarde"); + LSTR MSG_UBL_INFO_UBL = _UxGT("Infos debug UBL"); + LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("Nombre de points"); + LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Remplissage manuel"); + LSTR MSG_UBL_SMART_FILLIN = _UxGT("Remplissage auto"); + LSTR MSG_UBL_FILLIN_MESH = _UxGT("Remplissage grille"); + LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Tout effacer"); + LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Effacer le + pres"); + LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Reglage fin (tous)"); + LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("Reglage fin + pres"); + LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("Stockage grille"); + LSTR MSG_UBL_STORAGE_SLOT = _UxGT("Slot memoire"); + LSTR MSG_UBL_LOAD_MESH = _UxGT("Charger la grille"); + LSTR MSG_UBL_SAVE_MESH = _UxGT("Stocker la grille"); + LSTR MSG_MESH_LOADED = _UxGT("Grille %i chargee"); + LSTR MSG_MESH_SAVED = _UxGT("Grille %i enreg."); + LSTR MSG_UBL_NO_STORAGE = _UxGT("Pas de memoire"); + LSTR MSG_UBL_SAVE_ERROR = _UxGT("Err: Enreg. UBL"); + LSTR MSG_UBL_RESTORE_ERROR = _UxGT("Err: Ouvrir UBL"); + LSTR MSG_UBL_Z_OFFSET = _UxGT("Z-Offset: "); + LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Decal. Z arrete"); + LSTR MSG_UBL_STEP_BY_STEP_MENU = _UxGT("Assistant UBL"); + LSTR MSG_UBL_1_BUILD_COLD_MESH = _UxGT("1.Mesure a froid"); + LSTR MSG_UBL_2_SMART_FILLIN = _UxGT("2.Completer auto."); + LSTR MSG_UBL_3_VALIDATE_MESH_MENU = _UxGT("3.Verifier grille"); + LSTR MSG_UBL_4_FINE_TUNE_ALL = _UxGT("4.Reglage fin"); + LSTR MSG_UBL_5_VALIDATE_MESH_MENU = _UxGT("5.Verifier grille"); + LSTR MSG_UBL_6_FINE_TUNE_ALL = _UxGT("6.Reglage fin"); + LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7.Stocker grille"); + + LSTR MSG_LED_CONTROL = _UxGT("Controle LED"); + LSTR MSG_LEDS = _UxGT("Lumiere"); + LSTR MSG_LED_PRESETS = _UxGT("Preregl. LED"); + LSTR MSG_SET_LEDS_RED = _UxGT("Rouge"); + LSTR MSG_SET_LEDS_ORANGE = _UxGT("Orange"); + LSTR MSG_SET_LEDS_YELLOW = _UxGT("Jaune"); + LSTR MSG_SET_LEDS_GREEN = _UxGT("Vert"); + LSTR MSG_SET_LEDS_BLUE = _UxGT("Bleu"); + LSTR MSG_SET_LEDS_INDIGO = _UxGT("Indigo"); + LSTR MSG_SET_LEDS_VIOLET = _UxGT("Violet"); + LSTR MSG_SET_LEDS_WHITE = _UxGT("Blanc"); + LSTR MSG_SET_LEDS_DEFAULT = _UxGT("Defaut"); + LSTR MSG_CUSTOM_LEDS = _UxGT("LEDs perso."); + LSTR MSG_INTENSITY_R = _UxGT("Intensite rouge"); + LSTR MSG_INTENSITY_G = _UxGT("Intensite vert"); + LSTR MSG_INTENSITY_B = _UxGT("Intensite bleu"); + LSTR MSG_INTENSITY_W = _UxGT("Intensite blanc"); + LSTR MSG_LED_BRIGHTNESS = _UxGT("Luminosite"); + + LSTR MSG_MOVING = _UxGT("Deplacement..."); + LSTR MSG_FREE_XY = _UxGT("Debloquer XY"); + LSTR MSG_MOVE_X = _UxGT("Deplacer X"); + LSTR MSG_MOVE_Y = _UxGT("Deplacer Y"); + LSTR MSG_MOVE_Z = _UxGT("Deplacer Z"); + LSTR MSG_MOVE_N = _UxGT("Deplacer @"); + LSTR MSG_MOVE_E = _UxGT("Extruder"); + LSTR MSG_MOVE_EN = _UxGT("Extruder *"); + LSTR MSG_HOTEND_TOO_COLD = _UxGT("Buse trop froide"); + LSTR MSG_MOVE_N_MM = _UxGT("Deplacer $mm"); + LSTR MSG_MOVE_01MM = _UxGT("Deplacer 0.1mm"); + LSTR MSG_MOVE_1MM = _UxGT("Deplacer 1mm"); + LSTR MSG_MOVE_10MM = _UxGT("Deplacer 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Deplacer 50mm"); + LSTR MSG_MOVE_100MM = _UxGT("Deplacer 100mm"); + LSTR MSG_MOVE_0001IN = _UxGT("Deplacer 0.001\""); + LSTR MSG_MOVE_001IN = _UxGT("Deplacer 0.01\""); + LSTR MSG_MOVE_01IN = _UxGT("Deplacer 0.1\""); + LSTR MSG_MOVE_05IN = _UxGT("Deplacer 0.5\""); + LSTR MSG_MOVE_1IN = _UxGT("Deplacer 1\""); + LSTR MSG_SPEED = _UxGT("Vitesse"); + LSTR MSG_MESH_Z_OFFSET = _UxGT("Lit Z"); + LSTR MSG_NOZZLE = _UxGT("Buse"); + LSTR MSG_NOZZLE_N = _UxGT("Buse ~"); + LSTR MSG_BED = _UxGT("Lit"); + LSTR MSG_CHAMBER = _UxGT("Caisson"); + LSTR MSG_FAN_SPEED = _UxGT("Vit. ventil. "); // 15 car. max + LSTR MSG_FAN_SPEED_N = _UxGT("Vit. ventil. ~"); + LSTR MSG_STORED_FAN_N = _UxGT("Vit. enreg. ~"); + LSTR MSG_EXTRA_FAN_SPEED = _UxGT("Extra ventil. "); + LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("Extra ventil. ~"); + + LSTR MSG_FLOW = _UxGT("Flux"); + LSTR MSG_FLOW_N = _UxGT("Flux ~"); + LSTR MSG_CONTROL = _UxGT("Controler"); + LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" Min"); + LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); + LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Facteur"); + 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_SELECT_E = _UxGT("Selectionner *"); + LSTR MSG_ACC = _UxGT("Acceleration"); + LSTR MSG_JERK = _UxGT("Jerk"); + LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT(" jerk"); + LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT(" jerk"); + LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT(" jerk"); + LSTR MSG_VN_JERK = _UxGT("V@ jerk"); + LSTR MSG_VE_JERK = _UxGT("Ve jerk"); + LSTR MSG_MAX_SPEED = _UxGT("Max Velocite"); + LSTR MSG_VMAX_A = _UxGT("Vit. Max ") STR_A; + LSTR MSG_VMAX_B = _UxGT("Vit. Max ") STR_B; + LSTR MSG_VMAX_C = _UxGT("Vit. Max ") STR_C; + LSTR MSG_VMAX_N = _UxGT("Vit. Max @"); + LSTR MSG_VMAX_E = _UxGT("Vit. Max E"); + LSTR MSG_VMAX_EN = _UxGT("Vit. Max *"); + LSTR MSG_JUNCTION_DEVIATION = _UxGT("Deviat. jonct."); + LSTR MSG_VMIN = _UxGT("Vit. Min"); + LSTR MSG_VTRAV_MIN = _UxGT("Vmin course"); + LSTR MSG_ACCELERATION = _UxGT("Acceleration"); + LSTR MSG_AMAX_A = _UxGT("Max Accel. ") STR_A; + LSTR MSG_AMAX_B = _UxGT("Max Accel. ") STR_B; + LSTR MSG_AMAX_C = _UxGT("Max Accel. ") STR_C; + LSTR MSG_AMAX_N = _UxGT("Max Accel. @"); + LSTR MSG_AMAX_E = _UxGT("Max Accel. E"); + LSTR MSG_AMAX_EN = _UxGT("Max Accel. *"); + LSTR MSG_A_RETRACT = _UxGT("Acc.retraction"); + LSTR MSG_A_TRAVEL = _UxGT("Acc.course"); + LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("Frequence max"); + LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Vitesse min"); + LSTR MSG_STEPS_PER_MM = _UxGT("Pas/mm"); + LSTR MSG_A_STEPS = STR_A _UxGT(" pas/mm"); + LSTR MSG_B_STEPS = STR_B _UxGT(" pas/mm"); + LSTR MSG_C_STEPS = STR_C _UxGT(" pas/mm"); + LSTR MSG_N_STEPS = _UxGT("@ pas/mm"); + LSTR MSG_E_STEPS = _UxGT("E pas/mm"); + LSTR MSG_EN_STEPS = _UxGT("* pas/mm"); + LSTR MSG_TEMPERATURE = _UxGT("Temperature"); + LSTR MSG_MOTION = _UxGT("Mouvement"); + LSTR MSG_FILAMENT = _UxGT("Filament"); + LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E en mm") SUPERSCRIPT_THREE; + LSTR MSG_VOLUMETRIC_LIMIT = _UxGT("Limite en mm") SUPERSCRIPT_THREE; + LSTR MSG_VOLUMETRIC_LIMIT_E = _UxGT("Limite *"); + LSTR MSG_FILAMENT_DIAM = _UxGT("Diametre fil."); + LSTR MSG_FILAMENT_DIAM_E = _UxGT("Diametre fil. *"); + LSTR MSG_FILAMENT_UNLOAD = _UxGT("Retrait mm"); + LSTR MSG_FILAMENT_LOAD = _UxGT("Charger mm"); + LSTR MSG_ADVANCE_K = _UxGT("Avance K"); + LSTR MSG_ADVANCE_K_E = _UxGT("Avance K *"); + LSTR MSG_BRIGHTNESS = _UxGT("Luminosite LCD"); + LSTR MSG_CONTRAST = _UxGT("Contraste LCD"); + LSTR MSG_SCREEN_TIMEOUT = _UxGT("Veille LCD (m)"); + LSTR MSG_BRIGHTNESS_OFF = _UxGT("Eteindre l'ecran LCD"); + LSTR MSG_STORE_EEPROM = _UxGT("Enregistrer config."); + LSTR MSG_LOAD_EEPROM = _UxGT("Charger config."); + LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restaurer defauts"); + LSTR MSG_INIT_EEPROM = _UxGT("Initialiser EEPROM"); + LSTR MSG_SETTINGS_STORED = _UxGT("Config. enregistree"); + LSTR MSG_MEDIA_UPDATE = _UxGT("MaJ Firmware SD"); + LSTR MSG_RESET_PRINTER = _UxGT("RaZ imprimante"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualiser"); + LSTR MSG_INFO_SCREEN = _UxGT("Surveiller"); + LSTR MSG_PREPARE = _UxGT("Preparer"); + LSTR MSG_TUNE = _UxGT("Regler"); + LSTR MSG_START_PRINT = _UxGT("Demarrer impression"); + LSTR MSG_BUTTON_NEXT = _UxGT("Suivant"); + LSTR MSG_BUTTON_INIT = _UxGT("Init."); + LSTR MSG_BUTTON_STOP = _UxGT("Stop"); + LSTR MSG_BUTTON_PRINT = _UxGT("Imprimer"); + LSTR MSG_BUTTON_RESET = _UxGT("Reset"); + LSTR MSG_BUTTON_IGNORE = _UxGT("Ignorer"); + LSTR MSG_BUTTON_CANCEL = _UxGT("Annuler"); + LSTR MSG_BUTTON_DONE = _UxGT("Termine"); + LSTR MSG_BUTTON_BACK = _UxGT("Retour"); + LSTR MSG_BUTTON_PROCEED = _UxGT("Proceder"); + LSTR MSG_BUTTON_SKIP = _UxGT("Passer"); + LSTR MSG_PAUSING = _UxGT("Mise en pause..."); + LSTR MSG_PAUSE_PRINT = _UxGT("Pause impression"); + LSTR MSG_RESUME_PRINT = _UxGT("Reprendre impr."); + LSTR MSG_STOP_PRINT = _UxGT("Arreter impr."); + LSTR MSG_PRINTING_OBJECT = _UxGT("Impression objet"); + LSTR MSG_CANCEL_OBJECT = _UxGT("Annuler objet"); + LSTR MSG_CANCEL_OBJECT_N = _UxGT("Annuler objet ="); + LSTR MSG_OUTAGE_RECOVERY = _UxGT("Recup. coup."); + LSTR MSG_MEDIA_MENU = _UxGT("Impression SD"); + LSTR MSG_NO_MEDIA = _UxGT("Pas de media"); + LSTR MSG_DWELL = _UxGT("Repos..."); + LSTR MSG_USERWAIT = _UxGT("Attente utilis."); + LSTR MSG_PRINT_PAUSED = _UxGT("Impr. en pause"); + LSTR MSG_PRINTING = _UxGT("Impression"); + LSTR MSG_PRINT_ABORTED = _UxGT("Impr. annulee"); + LSTR MSG_NO_MOVE = _UxGT("Moteurs bloques"); + LSTR MSG_KILLED = _UxGT("KILLED"); + LSTR MSG_STOPPED = _UxGT("STOPPE"); + LSTR MSG_CONTROL_RETRACT = _UxGT("Retractation mm"); + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Ech. retr. mm"); + LSTR MSG_CONTROL_RETRACTF = _UxGT("Vit. retract") LCD_STR_DEGREE; + LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Saut Z mm"); + LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("Ret.reprise mm"); + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("Ech.reprise mm"); + LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("V.ret. reprise"); + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("V.ech. reprise"); + LSTR MSG_AUTORETRACT = _UxGT("Retraction auto"); + LSTR MSG_TOOL_CHANGE = _UxGT("Changement outil"); + LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Augmenter Z"); + LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Vitesse primaire"); + LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Purge Retract"); + LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Vitesse retract") LCD_STR_DEGREE; + LSTR MSG_FILAMENT_PARK_ENABLED = _UxGT("Garer Extrudeur"); + LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Vitesse reprise"); + LSTR MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Vit. ventil."); + LSTR MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Temps ventil."); + LSTR MSG_TOOL_MIGRATION_ON = _UxGT("Auto ON"); + LSTR MSG_TOOL_MIGRATION_OFF = _UxGT("Auto OFF"); + LSTR MSG_TOOL_MIGRATION = _UxGT("Migration d'outil"); + LSTR MSG_TOOL_MIGRATION_AUTO = _UxGT("Migration auto"); + LSTR MSG_TOOL_MIGRATION_END = _UxGT("Extrudeur Final"); + LSTR MSG_TOOL_MIGRATION_SWAP = _UxGT("Migrer vers *"); + LSTR MSG_NOZZLE_STANDBY = _UxGT("Attente buse"); + LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("Longueur retrait"); + LSTR MSG_FILAMENT_SWAP_EXTRA = _UxGT("Longueur Extra"); + LSTR MSG_FILAMENT_PURGE_LENGTH = _UxGT("Longueur de purge"); + LSTR MSG_FILAMENTCHANGE = _UxGT("Changer filament"); + LSTR MSG_FILAMENTCHANGE_E = _UxGT("Changer filament *"); + LSTR MSG_FILAMENTLOAD = _UxGT("Charger filament"); + LSTR MSG_FILAMENTLOAD_E = _UxGT("Charger filament *"); + LSTR MSG_FILAMENTUNLOAD = _UxGT("Retrait filament"); + LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Retrait filament *"); + LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Retirer tout"); + LSTR MSG_ATTACH_MEDIA = _UxGT("Charger le media"); + LSTR MSG_CHANGE_MEDIA = _UxGT("Actualiser media"); + LSTR MSG_RELEASE_MEDIA = _UxGT("Retirer le media"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonde Z hors lit"); + LSTR MSG_SKEW_FACTOR = _UxGT("Facteur ecart"); + LSTR MSG_BLTOUCH = _UxGT("BLTouch"); + LSTR MSG_BLTOUCH_SELFTEST = _UxGT("Self-Test"); + LSTR MSG_BLTOUCH_RESET = _UxGT("Reset"); + LSTR MSG_BLTOUCH_STOW = _UxGT("Ranger"); + LSTR MSG_BLTOUCH_DEPLOY = _UxGT("Deployer"); + LSTR MSG_BLTOUCH_SW_MODE = _UxGT("Mode SW"); + LSTR MSG_BLTOUCH_5V_MODE = _UxGT("Mode 5V"); + LSTR MSG_BLTOUCH_OD_MODE = _UxGT("Mode OD"); + LSTR MSG_BLTOUCH_MODE_STORE = _UxGT("Appliquer Mode"); + LSTR MSG_BLTOUCH_MODE_STORE_5V = _UxGT("Mise en 5V"); + LSTR MSG_BLTOUCH_MODE_STORE_OD = _UxGT("Mise en OD"); + LSTR MSG_BLTOUCH_MODE_ECHO = _UxGT("Afficher Mode"); + LSTR MSG_TOUCHMI_PROBE = _UxGT("TouchMI"); + LSTR MSG_TOUCHMI_INIT = _UxGT("Init. TouchMI"); + LSTR MSG_TOUCHMI_ZTEST = _UxGT("Test decalage Z"); + LSTR MSG_TOUCHMI_SAVE = _UxGT("Sauvegarde"); + LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Deployer TouchMI"); + LSTR MSG_MANUAL_DEPLOY = _UxGT("Deployer Sonde Z"); + LSTR MSG_MANUAL_STOW = _UxGT("Ranger Sonde Z"); + LSTR MSG_HOME_FIRST = _UxGT("Origine %s Premier"); + LSTR MSG_ZPROBE_OFFSETS = _UxGT("Position sonde Z"); + LSTR MSG_ZPROBE_XOFFSET = _UxGT("Decalage X"); + LSTR MSG_ZPROBE_YOFFSET = _UxGT("Decalage Y"); + LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Decalage Z"); + 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("Total"); + LSTR MSG_ENDSTOP_ABORT = _UxGT("Butee abandon"); + LSTR MSG_HEATING_FAILED_LCD = _UxGT("Err de chauffe"); + LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Err TEMP. REDONDANTE"); + LSTR MSG_THERMAL_RUNAWAY = _UxGT("Err THERMIQUE"); + LSTR MSG_ERR_MAXTEMP = _UxGT("Err TEMP. MAX"); + LSTR MSG_ERR_MINTEMP = _UxGT("Err TEMP. MIN"); + + LSTR MSG_HALTED = _UxGT("IMPR. STOPPEE"); + LSTR MSG_PLEASE_RESET = _UxGT("Redemarrer SVP"); + LSTR MSG_SHORT_DAY = _UxGT("j"); // One character only + LSTR MSG_SHORT_HOUR = _UxGT("h"); // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("m"); // One character only + + LSTR MSG_HEATING = _UxGT("en chauffe..."); + LSTR MSG_COOLING = _UxGT("Refroidissement"); + LSTR MSG_BED_HEATING = _UxGT("Lit en chauffe..."); + LSTR MSG_BED_COOLING = _UxGT("Refroid. du lit..."); + LSTR MSG_PROBE_HEATING = _UxGT("Probe en chauffe..."); + LSTR MSG_PROBE_COOLING = _UxGT("Refroid. Probe..."); + LSTR MSG_CHAMBER_HEATING = _UxGT("Chauffe caisson..."); + LSTR MSG_CHAMBER_COOLING = _UxGT("Refroid. caisson..."); + LSTR MSG_DELTA_CALIBRATE = _UxGT("Calibration Delta"); + LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Calibrer X"); + LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Calibrer Y"); + LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Calibrer Z"); + LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrer centre"); + LSTR MSG_DELTA_SETTINGS = _UxGT("Reglages Delta"); + LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Calibration Auto"); + LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diagonale"); + LSTR MSG_DELTA_HEIGHT = _UxGT("Hauteur"); + LSTR MSG_DELTA_RADIUS = _UxGT("Rayon"); + + LSTR MSG_INFO_MENU = _UxGT("Infos imprimante"); + LSTR MSG_INFO_PRINTER_MENU = _UxGT("Infos imprimante"); + LSTR MSG_3POINT_LEVELING = _UxGT("Niveau a 3 points"); + LSTR MSG_LINEAR_LEVELING = _UxGT("Niveau lineaire"); + LSTR MSG_BILINEAR_LEVELING = _UxGT("Niveau bilineaire"); + LSTR MSG_UBL_LEVELING = _UxGT("Niveau lit unifie"); + LSTR MSG_MESH_LEVELING = _UxGT("Niveau par grille"); + LSTR MSG_MESH_DONE = _UxGT("Niveau termine"); + LSTR MSG_INFO_STATS_MENU = _UxGT("Stats. imprimante"); + LSTR MSG_INFO_BOARD_MENU = _UxGT("Infos carte"); + LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Thermistances"); + LSTR MSG_INFO_EXTRUDERS = _UxGT("Extrudeurs"); + LSTR MSG_INFO_BAUDRATE = _UxGT("Bauds"); + LSTR MSG_INFO_PROTOCOL = _UxGT("Protocole"); + LSTR MSG_INFO_RUNAWAY_OFF = _UxGT("Protection inactive"); + LSTR MSG_INFO_RUNAWAY_ON = _UxGT("Protection active"); + LSTR MSG_HOTEND_IDLE_TIMEOUT = _UxGT("Hotend Idle Timeout"); + + LSTR MSG_CASE_LIGHT = _UxGT("Lumiere caisson"); + LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Luminosite"); + LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("Imprimante incorrecte"); + + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 + LSTR MSG_INFO_PRINT_COUNT = _UxGT("Nbre impressions"); + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Terminees"); + LSTR MSG_INFO_PRINT_TIME = _UxGT("Tps impr. total"); + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Impr. la + longue"); + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Total filament"); + #else + LSTR MSG_INFO_PRINT_COUNT = _UxGT("Impressions"); + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Terminees"); + LSTR MSG_INFO_PRINT_TIME = _UxGT("Total"); + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("+ long"); + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Filament"); + #endif + + LSTR MSG_INFO_MIN_TEMP = _UxGT("Temp Min"); + LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp Max"); + LSTR MSG_INFO_PSU = _UxGT("Alim."); + LSTR MSG_DRIVE_STRENGTH = _UxGT("Puiss. moteur "); + LSTR MSG_DAC_PERCENT_N = _UxGT("Driver @ %"); + LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM sauv."); + LSTR MSG_ERROR_TMC = _UxGT("ERREUR CONNEXION TMC"); + + LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("CHANGER FILAMENT"); + LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("IMPR. PAUSE"); + LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("CHARGER FIL"); + LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("DECHARGER FIL"); + LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("OPTIONS REPRISE:"); + LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Purger encore"); + LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Reprendre impr."); + LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Buse: "); + LSTR MSG_RUNOUT_SENSOR = _UxGT("Capteur fil."); + LSTR MSG_KILL_HOMING_FAILED = _UxGT("Echec origine"); + LSTR MSG_LCD_PROBING_FAILED = _UxGT("Echec sonde"); + + LSTR MSG_KILL_MMU2_FIRMWARE = _UxGT("MAJ firmware MMU!!"); + LSTR MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("CHOISIR FILAMENT"); + LSTR MSG_MMU2_MENU = _UxGT("MMU"); + LSTR MSG_MMU2_NOT_RESPONDING = _UxGT("MMU ne repond plus"); + LSTR MSG_MMU2_RESUME = _UxGT("Continuer Imp. MMU"); + LSTR MSG_MMU2_RESUMING = _UxGT("Reprise MMU..."); + LSTR MSG_MMU2_LOAD_FILAMENT = _UxGT("Charge dans MMU"); + LSTR MSG_MMU2_LOAD_ALL = _UxGT("Charger tous dans MMU"); + LSTR MSG_MMU2_LOAD_TO_NOZZLE = _UxGT("Charger dans buse"); + LSTR MSG_MMU2_EJECT_FILAMENT = _UxGT("Ejecter fil. du MMU"); + LSTR MSG_MMU2_EJECT_FILAMENT_N = _UxGT("Ejecter fil. ~"); + LSTR MSG_MMU2_UNLOAD_FILAMENT = _UxGT("Retrait filament"); + LSTR MSG_MMU2_LOADING_FILAMENT = _UxGT("Chargem. fil. %i..."); + LSTR MSG_MMU2_EJECTING_FILAMENT = _UxGT("Ejection fil..."); + LSTR MSG_MMU2_UNLOADING_FILAMENT = _UxGT("Retrait fil...."); + LSTR MSG_MMU2_ALL = _UxGT("Tous"); + LSTR MSG_MMU2_FILAMENT_N = _UxGT("Filament ~"); + LSTR MSG_MMU2_RESET = _UxGT("Reinit. MMU"); + LSTR MSG_MMU2_RESETTING = _UxGT("Reinit. MMU..."); + LSTR MSG_MMU2_EJECT_RECOVER = _UxGT("Retrait, click"); + + LSTR MSG_MIX_COMPONENT_N = _UxGT("Composante ="); + LSTR MSG_MIXER = _UxGT("Mixeur"); + LSTR MSG_GRADIENT = _UxGT("Degrade"); + LSTR MSG_FULL_GRADIENT = _UxGT("Degrade complet"); + LSTR MSG_TOGGLE_MIX = _UxGT("Toggle mix"); + LSTR MSG_CYCLE_MIX = _UxGT("Cycle mix"); + LSTR MSG_GRADIENT_MIX = _UxGT("Mix degrade"); + LSTR MSG_REVERSE_GRADIENT = _UxGT("Inverser degrade"); + LSTR MSG_ACTIVE_VTOOL = _UxGT("Active V-tool"); + LSTR MSG_START_VTOOL = _UxGT("Debut V-tool"); + LSTR MSG_END_VTOOL = _UxGT(" Fin V-tool"); + LSTR MSG_GRADIENT_ALIAS = _UxGT("Alias V-tool"); + LSTR MSG_RESET_VTOOLS = _UxGT("Reinit. V-tools"); + LSTR MSG_COMMIT_VTOOL = _UxGT("Valider Mix V-tool"); + LSTR MSG_VTOOLS_RESET = _UxGT("V-tools reinit. ok"); + LSTR MSG_START_Z = _UxGT("Debut Z:"); + LSTR MSG_END_Z = _UxGT(" Fin Z:"); + LSTR MSG_GAMES = _UxGT("Jeux"); + LSTR MSG_BRICKOUT = _UxGT("Casse-briques"); + LSTR MSG_INVADERS = _UxGT("Invaders"); + LSTR MSG_SNAKE = _UxGT("Sn4k3"); + LSTR MSG_MAZE = _UxGT("Labyrinthe"); + + LSTR MSG_BAD_PAGE = _UxGT("Erreur index page"); + LSTR MSG_BAD_PAGE_SPEED = _UxGT("Erreur vitesse page"); + + #if LCD_HEIGHT >= 4 + // Up to 3 lines allowed + LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_2_LINE("Presser bouton", "pour reprendre")); + LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("Parking...")); + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_2_LINE("Attente filament", "pour demarrer")); + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("Inserer filament", "et app. bouton", "pour continuer...")); + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("Presser le bouton", "pour chauffer...")); + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("Buse en chauffe", "Patienter SVP...")); + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("Attente", "retrait du filament")); + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("Attente", "chargement filament")); + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("Attente", "Purge filament")); + LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_2_LINE("Presser pour finir", "la purge du filament")); + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("Attente reprise", "impression")); + #else // LCD_HEIGHT < 4 + // Up to 2 lines allowed + LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("Clic pour continuer")); + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("Patience...")); + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("Inserer fil.")); + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("Chauffer ?")); + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("Chauffage...")); + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("Retrait fil...")); + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("Chargement...")); + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("Purge...")); + LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("Terminer ?")); + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("Reprise...")); + #endif // LCD_HEIGHT < 4 + + LSTR MSG_TMC_CURRENT = _UxGT("Courant driver"); + LSTR MSG_TMC_HYBRID_THRS = _UxGT("Seuil hybride"); + LSTR MSG_TMC_HOMING_THRS = _UxGT("Home sans capteur"); + LSTR MSG_TMC_STEPPING_MODE = _UxGT("Mode pas a pas"); + LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("StealthChop active"); + LSTR MSG_SERVICE_RESET = _UxGT("Reinit."); + LSTR MSG_SERVICE_IN = _UxGT(" dans:"); + LSTR MSG_BACKLASH_CORRECTION = _UxGT("Correction"); + LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Lissage"); + + LSTR MSG_LEVEL_X_AXIS = _UxGT("Niveau axe X"); + LSTR MSG_AUTO_CALIBRATE = _UxGT("Etalon. auto."); + #if ENABLED(TOUCH_UI_FTDI_EVE) + LSTR MSG_HEATER_TIMEOUT = _UxGT("En protection, temp. reduite. Ok pour rechauffer et continuer."); + #else + LSTR MSG_HEATER_TIMEOUT = _UxGT("En protection"); + #endif + LSTR MSG_REHEAT = _UxGT("Chauffer"); + LSTR MSG_REHEATING = _UxGT("Rechauffe..."); + + LSTR MSG_PROBE_WIZARD = _UxGT("Assistant Sonde Z"); + LSTR MSG_PROBE_WIZARD_PROBING = _UxGT("Mesure reference"); + LSTR MSG_PROBE_WIZARD_MOVING = _UxGT("Depl. vers pos"); + + LSTR MSG_SOUND = _UxGT("Sons"); + + LSTR MSG_TOP_LEFT = _UxGT("Coin haut gauche"); + LSTR MSG_BOTTOM_LEFT = _UxGT("Coin bas gauche"); + LSTR MSG_TOP_RIGHT = _UxGT("Coin haut droit"); + LSTR MSG_BOTTOM_RIGHT = _UxGT("Coin bas droit"); + LSTR MSG_CALIBRATION_COMPLETED = _UxGT("Calibration terminee"); + LSTR MSG_CALIBRATION_FAILED = _UxGT("Echec de l'etalonnage"); + + LSTR MSG_SD_CARD = _UxGT("Carte SD"); + LSTR MSG_USB_DISK = _UxGT("Cle USB"); + + // DGUS-Specific message strings, not used elsewhere + 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"); + LSTR DGUS_MSG_PID_AUTOTUNING = _UxGT("Autocalibrage du PID..."); + LSTR DGUS_MSG_INVALID_RECOVERY_DATA = _UxGT("Donnees de recuperation non valides"); + + LSTR DGUS_MSG_HOMING_REQUIRED = _UxGT("Retour a l'origine necessaire..."); + LSTR DGUS_MSG_BUSY = _UxGT("Occupe"); + LSTR DGUS_MSG_HOMING = _UxGT("Retour a l'origine..."); + LSTR DGUS_MSG_FW_OUTDATED = _UxGT("Mise a jour DWIN GUI/OS necessaire"); + LSTR DGUS_MSG_ABL_REQUIRED = _UxGT("Nivellement du bed necessaire"); + LSTR DGUS_MSG_PROBING_FAILED = _UxGT("Echec du nivellement..."); + LSTR DGUS_MSG_PROBING_SUCCESS = _UxGT("Nivellement realise avec succes"); + LSTR DGUS_MSG_RESET_EEPROM = _UxGT("Reinitialisation de l'EEPROM"); + LSTR DGUS_MSG_WRITE_EEPROM_FAILED = _UxGT("Echec ecriture de l'EEPROM"); + LSTR DGUS_MSG_READ_EEPROM_FAILED = _UxGT("Echec lecture de l'EEPROM"); + LSTR DGUS_MSG_FILAMENT_RUNOUT = _UxGT("Sortie de filament E%d"); + +} diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index e17de38747c7..caa8fc62df7b 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -490,9 +490,6 @@ namespace Language_hu { LSTR MSG_ERR_MINTEMP = _UxGT("Hiba: MIN höfok"); LSTR MSG_HALTED = _UxGT("A NYOMTATÓ LEÁLLT"); LSTR MSG_PLEASE_RESET = _UxGT("Indítsd újra!"); - LSTR MSG_SHORT_DAY = _UxGT("n"); // Csak egy karakter - LSTR MSG_SHORT_HOUR = _UxGT("ó"); // Csak egy karakter - LSTR MSG_SHORT_MINUTE = _UxGT("p"); // Csak egy karakter LSTR MSG_HEATING = _UxGT("Fütés..."); LSTR MSG_COOLING = _UxGT("Hütés..."); LSTR MSG_BED_HEATING = _UxGT("Ágy fütés..."); @@ -696,12 +693,8 @@ namespace Language_hu { LSTR MSG_SD_CARD = _UxGT("SD Kártya"); LSTR MSG_USB_DISK = _UxGT("USB Lemez"); -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + LSTR MSG_SHORT_DAY = _UxGT("n"); // Csak egy karakter + LSTR MSG_SHORT_HOUR = _UxGT("ó"); // Csak egy karakter + LSTR MSG_SHORT_MINUTE = _UxGT("p"); // Csak egy karakter +} diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 0caf950aa583..fb9178c67ecf 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -371,7 +371,7 @@ namespace Language_it { LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Verif.perdita calore"); LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Riscalda a >200C"); LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Raffredda a amb."); - LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Autotune"); + LSTR MSG_MPC_AUTOTUNE = _UxGT("Calibra MPC"); LSTR MSG_MPC_EDIT = _UxGT("Modif.MPC *"); LSTR MSG_MPC_POWER = _UxGT("Potenza riscald."); LSTR MSG_MPC_POWER_E = _UxGT("Potenza *"); @@ -577,6 +577,8 @@ namespace Language_it { 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_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_HOME_FIRST = _UxGT("Home %s prima"); @@ -608,9 +610,9 @@ namespace Language_it { LSTR MSG_HALTED = _UxGT("STAMPANTE FERMATA"); LSTR MSG_PLEASE_WAIT = _UxGT("Attendere prego..."); LSTR MSG_PLEASE_RESET = _UxGT("Riavviare prego"); - LSTR MSG_PREHEATING = _UxGT("Preriscaldam..."); + LSTR MSG_PREHEATING = _UxGT("Preriscaldamento..."); LSTR MSG_HEATING = _UxGT("Riscaldamento..."); - LSTR MSG_COOLING = _UxGT("Raffreddamento.."); + LSTR MSG_COOLING = _UxGT("Raffreddamento..."); LSTR MSG_BED_HEATING = _UxGT("Risc. piatto..."); LSTR MSG_BED_COOLING = _UxGT("Raffr. piatto..."); LSTR MSG_PROBE_HEATING = _UxGT("Risc. sonda..."); @@ -847,4 +849,28 @@ namespace Language_it { LSTR MSG_USB_DISK = _UxGT("Disco USB"); LSTR MSG_HOST_SHUTDOWN = _UxGT("Arresta host"); + +// DGUS-Specific message strings, not used elsewhere + 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_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"); + + LSTR DGUS_MSG_HOMING_REQUIRED = _UxGT("Azzeramento richiesto"); + 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_PROBING_FAILED = _UxGT("Sondaggio fallito"); + LSTR DGUS_MSG_PROBING_SUCCESS = _UxGT("Sondaggio effettuato"); + LSTR DGUS_MSG_RESET_EEPROM = _UxGT("Reset EEPROM"); + LSTR DGUS_MSG_WRITE_EEPROM_FAILED = _UxGT("Scrittura EEPROM fallita"); + LSTR DGUS_MSG_READ_EEPROM_FAILED = _UxGT("Lettura EEPROM fallita"); + LSTR DGUS_MSG_FILAMENT_RUNOUT = _UxGT("Filament runout E%d"); + } diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 15d6a29053e6..1b5715aedd90 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -538,11 +538,3 @@ namespace Language_pl { LSTR MSG_CALIBRATION_FAILED = _UxGT("Kalibracja nie powiodła się"); } - -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 4d9a8ae6da9c..7f09d71e4802 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -29,7 +29,7 @@ * See also https://marlinfw.org/docs/development/lcd_language.html */ - #define DISPLAY_CHARSET_ISO10646_1 +#define DISPLAY_CHARSET_ISO10646_1 namespace Language_pt { using namespace Language_en; // Inherit undefined strings from English diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 162f3a361619..938aa71c5772 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -606,11 +606,3 @@ namespace Language_ro { LSTR MSG_REHEAT = _UxGT("Reincalzire"); LSTR MSG_REHEATING = _UxGT("Reincalzire..."); } - -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index c8077582b687..ab5d7fca9864 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -606,9 +606,6 @@ namespace Language_ru { LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Ошибка: Т контр."); LSTR MSG_HALTED = _UxGT("ПРИНТЕР ОСТАНОВЛЕН"); LSTR MSG_PLEASE_RESET = _UxGT("Сделайте сброс"); - LSTR MSG_SHORT_DAY = _UxGT("д"); // One character only - LSTR MSG_SHORT_HOUR = _UxGT("ч"); // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("м"); // One character only LSTR MSG_HEATING = _UxGT("Нагрев..."); LSTR MSG_COOLING = _UxGT("Охлаждение..."); LSTR MSG_BED_HEATING = _UxGT("Нагрев стола..."); @@ -865,12 +862,8 @@ namespace Language_ru { LSTR MSG_SD_CARD = _UxGT("SD Карта"); LSTR MSG_USB_DISK = _UxGT("USB Диск"); -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + LSTR MSG_SHORT_DAY = _UxGT("д"); // One character only + LSTR MSG_SHORT_HOUR = _UxGT("ч"); // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("м"); // One character only +} diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index cb3c6a03ae5c..569b32b93dd8 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -26,10 +26,6 @@ * * LCD Menu Messages * See also https://marlinfw.org/docs/development/lcd_language.html - * - * Bu çeviri dosyasındaki sorunlar ve düzeltmeler için iletişim; - * Contact for issues and corrections in this translation file; - * Yücel Temel - (info@elektromanyetix.com) - https://elektromanyetix.com/ */ #define DISPLAY_CHARSET_ISO10646_TR @@ -40,38 +36,67 @@ namespace Language_tr { constexpr uint8_t CHARSIZE = 2; LSTR LANGUAGE = _UxGT("Turkish"); + // These strings should be translated LSTR WELCOME_MSG = MACHINE_NAME _UxGT(" hazır."); LSTR MSG_YES = _UxGT("EVET"); LSTR MSG_NO = _UxGT("HAYIR"); + LSTR MSG_HIGH = _UxGT("YÜKSEK"); + LSTR MSG_LOW = _UxGT("DÜŞÜK"); LSTR MSG_BACK = _UxGT("Geri"); + LSTR MSG_ERROR = _UxGT("Hata"); LSTR MSG_MEDIA_ABORTING = _UxGT("Durduruluyor..."); LSTR MSG_MEDIA_INSERTED = _UxGT("SD K. Yerleştirildi."); LSTR MSG_MEDIA_REMOVED = _UxGT("SD Kart Çıkarıldı."); LSTR MSG_MEDIA_WAITING = _UxGT("SD Kart Bekleniyor"); + LSTR MSG_MEDIA_INIT_FAIL = MEDIA_TYPE_EN _UxGT(" Başlatma Başarısız"); LSTR MSG_MEDIA_READ_ERROR = _UxGT("Kart Okuma Hatası"); LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB Çıkarıldı"); LSTR MSG_MEDIA_USB_FAILED = _UxGT("USB Başlat. Hatası"); - LSTR MSG_LCD_ENDSTOPS = _UxGT("Enstops"); // Max length 8 characters + LSTR MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Subcall Overflow"); + LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); // Max length 8 characters LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Yazılımsal Endstops"); LSTR MSG_MAIN = _UxGT("Ana"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Gelişmiş Ayarlar"); + LSTR MSG_TOOLBAR_SETUP = _UxGT("Araç Çubuğu Kurulumu"); + LSTR MSG_OPTION_DISABLED = _UxGT("Seçenek Devre Dışı"); LSTR MSG_CONFIGURATION = _UxGT("Yapılandırma"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Oto. Başlat"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motorları Durdur"); LSTR MSG_DEBUG_MENU = _UxGT("Hata Ayıklama"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Durum Çubuğu Testi"); + LSTR MSG_HOMING = _UxGT("Sıfırlanıyor"); LSTR MSG_AUTO_HOME = _UxGT("Eksenleri Sıfırla"); + LSTR MSG_AUTO_HOME_A = _UxGT("@ Sıfırla"); LSTR MSG_AUTO_HOME_X = _UxGT("X Sıfırla"); LSTR MSG_AUTO_HOME_Y = _UxGT("Y Sıfırla"); LSTR MSG_AUTO_HOME_Z = _UxGT("Z Sıfırla"); + LSTR MSG_FILAMENT_SET = _UxGT("Filament Ayarları"); + LSTR MSG_FILAMENT_MAN = _UxGT("Filament Yönetimi"); + LSTR MSG_MANUAL_LEVELING = _UxGT("Manuel Seviyeleme"); + LSTR MSG_LEVBED_FL = _UxGT("Sol Ön"); + LSTR MSG_LEVBED_FR = _UxGT("Ön Sağ"); + LSTR MSG_LEVBED_C = _UxGT("Orta"); + LSTR MSG_LEVBED_BL = _UxGT("Arka Sol"); + LSTR MSG_LEVBED_BR = _UxGT("Arka Sağ"); + LSTR MSG_MANUAL_MESH = _UxGT("Manuel Mesh"); + LSTR MSG_AUTO_MESH = _UxGT("Oto Mesh Oluştur"); LSTR MSG_AUTO_Z_ALIGN = _UxGT("Oto. Z-Hizalama"); + LSTR MSG_ITERATION = _UxGT("G34 Yinelemesi: %i"); + LSTR MSG_DECREASING_ACCURACY = _UxGT("Doğruluk Düşüyor!"); + LSTR MSG_ACCURACY_ACHIEVED = _UxGT("Doğruluk Sağlandı"); LSTR MSG_LEVEL_BED_HOMING = _UxGT("XYZ Sıfırlanıyor"); LSTR MSG_LEVEL_BED_WAITING = _UxGT("Başlatmak için tıkla"); LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("Sonraki Nokta"); - LSTR MSG_LEVEL_BED_DONE = _UxGT("Hizalama Tamam!"); + LSTR MSG_LEVEL_BED_DONE = _UxGT("Seviyeleme Tamam!"); LSTR MSG_Z_FADE_HEIGHT = _UxGT("Kaçınma Yüksekliği"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ofset Ayarla"); + LSTR MSG_HOME_OFFSET_X = _UxGT("X Ofset Sıfırla"); + LSTR MSG_HOME_OFFSET_Y = _UxGT("Y Ofset Sıfırla"); + LSTR MSG_HOME_OFFSET_Z = _UxGT("Z Ofset Sıfırla"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofset Tamam"); + LSTR MSG_TRAMMING_WIZARD = _UxGT("Hizalama Sihirbazı"); + LSTR MSG_SELECT_ORIGIN = _UxGT("Başlangıç Seç"); + LSTR MSG_LAST_VALUE_SP = _UxGT("Son değer "); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Ön Isınma ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Ön Isınma ") PREHEAT_1_LABEL " ~"; @@ -80,7 +105,14 @@ namespace Language_tr { LSTR MSG_PREHEAT_1_ALL = _UxGT("Ön Isınma ") PREHEAT_1_LABEL _UxGT(" Tüm"); LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Ön Isınma ") PREHEAT_1_LABEL _UxGT(" Tabla"); LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Ön Isınma ") PREHEAT_1_LABEL _UxGT(" Ayarlar"); - + #ifdef PREHEAT_2_LABEL + LSTR MSG_PREHEAT_2 = _UxGT("Ön Isınma ") PREHEAT_2_LABEL; + LSTR MSG_PREHEAT_2_SETTINGS = _UxGT("Ön Isınma ") PREHEAT_2_LABEL _UxGT(" Conf"); + #endif + #ifdef PREHEAT_3_LABEL + LSTR MSG_PREHEAT_3 = _UxGT("Ön Isınma ") PREHEAT_3_LABEL; + LSTR MSG_PREHEAT_3_SETTINGS = _UxGT("Ön Isınma ") PREHEAT_3_LABEL _UxGT(" Conf"); + #endif LSTR MSG_PREHEAT_M = _UxGT("Ön Isınma $"); LSTR MSG_PREHEAT_M_H = _UxGT("Ön Isınma $ ~"); LSTR MSG_PREHEAT_M_END = _UxGT("Ön Isınma $ Nozul"); @@ -91,30 +123,59 @@ namespace Language_tr { #endif LSTR MSG_PREHEAT_CUSTOM = _UxGT("Özel Ön Isınma"); LSTR MSG_COOLDOWN = _UxGT("Soğut/(Durdur)"); + + LSTR MSG_CUTTER_FREQUENCY = _UxGT("Frekans"); LSTR MSG_LASER_MENU = _UxGT("Lazer Kontrolü"); - LSTR MSG_LASER_POWER = _UxGT("Lazer Gücü"); LSTR MSG_SPINDLE_MENU = _UxGT("Spindle Kontrolü"); + LSTR MSG_LASER_POWER = _UxGT("Lazer Gücü"); LSTR MSG_SPINDLE_POWER = _UxGT("Spindle Gücü"); - LSTR MSG_SPINDLE_REVERSE = _UxGT("Spindle Ters Yön"); + LSTR MSG_LASER_TOGGLE = _UxGT("Lazer Değiştir"); + LSTR MSG_LASER_EVAC_TOGGLE = _UxGT("Üfleyici Değiştir"); + LSTR MSG_LASER_ASSIST_TOGGLE = _UxGT("Hava Desteği"); + LSTR MSG_LASER_PULSE_MS = _UxGT("Test Pulse ms"); + LSTR MSG_LASER_FIRE_PULSE = _UxGT("Fire Pulse"); + LSTR MSG_FLOWMETER_FAULT = _UxGT("Soğutucu Akış Hatası"); + LSTR MSG_SPINDLE_TOGGLE = _UxGT("Spindle Değiştir"); + LSTR MSG_SPINDLE_EVAC_TOGGLE = _UxGT("Vakum Değiştir"); + LSTR MSG_SPINDLE_FORWARD = _UxGT("Spindle İleri Yön"); + LSTR MSG_SPINDLE_REVERSE = _UxGT("Spindle Geri Yön"); LSTR MSG_SWITCH_PS_ON = _UxGT("Gücü Aç"); LSTR MSG_SWITCH_PS_OFF = _UxGT("Gücü Kapat"); LSTR MSG_EXTRUDE = _UxGT("Ekstrüzyon"); LSTR MSG_RETRACT = _UxGT("Geri Çek"); LSTR MSG_MOVE_AXIS = _UxGT("Eksen Hareketleri"); - LSTR MSG_BED_LEVELING = _UxGT("Tabla Hizalama"); - LSTR MSG_LEVEL_BED = _UxGT("Tabla Hizası"); - LSTR MSG_BED_TRAMMING = _UxGT("Hizalama Köşeleri"); + LSTR MSG_BED_LEVELING = _UxGT("Tabla Seviyeleme"); + LSTR MSG_LEVEL_BED = _UxGT("Tabla Seviyesi"); + LSTR MSG_BED_TRAMMING = _UxGT("Tabla Hizalama"); + LSTR MSG_BED_TRAMMING_MANUAL = _UxGT("Manuel Hizalama"); + LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Prob tetiklenene kadar tablayı ayarlayın."); + LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Köşeler tolerans dahilinde. Tabla hizalandı."); + LSTR MSG_BED_TRAMMING_GOOD_POINTS = _UxGT("İyi Noktalar: "); + LSTR MSG_BED_TRAMMING_LAST_Z = _UxGT("Son Z: "); LSTR MSG_NEXT_CORNER = _UxGT("Sonraki Köşe"); LSTR MSG_MESH_EDITOR = _UxGT("Mesh Editörü"); + LSTR MSG_MESH_VIEWER = _UxGT("Mesh görüntüleyici"); LSTR MSG_EDIT_MESH = _UxGT("Mesh Düzenle"); + LSTR MSG_MESH_VIEW = _UxGT("Mesh Göster"); LSTR MSG_EDITING_STOPPED = _UxGT("Mesh Düzenleme Durdu"); + LSTR MSG_NO_VALID_MESH = _UxGT("Geçerli Mesh yok"); + LSTR MSG_ACTIVATE_MESH = _UxGT("Seviyeleme Aç"); LSTR MSG_PROBING_POINT = _UxGT("Prop Noktası"); LSTR MSG_MESH_X = _UxGT("İndeks X"); LSTR MSG_MESH_Y = _UxGT("İndeks Y"); + LSTR MSG_MESH_INSET = _UxGT("Mesh Inset"); + LSTR MSG_MESH_MIN_X = _UxGT("Mesh X Minimum"); + LSTR MSG_MESH_MAX_X = _UxGT("Mesh X Maximum"); + LSTR MSG_MESH_MIN_Y = _UxGT("Mesh Y Minimum"); + LSTR MSG_MESH_MAX_Y = _UxGT("Mesh Y Maximum"); + LSTR MSG_MESH_AMAX = _UxGT("Alanı Büyüt"); + LSTR MSG_MESH_CENTER = _UxGT("Merkez Alan"); LSTR MSG_MESH_EDIT_Z = _UxGT("Z Değeri"); + LSTR MSG_MESH_CANCEL = _UxGT("Mesh iptal edildi"); LSTR MSG_CUSTOM_COMMANDS = _UxGT("Özel Komutlar"); LSTR MSG_M48_TEST = _UxGT("M48 Prob Testi"); LSTR MSG_M48_POINT = _UxGT("M48 Nokta"); + LSTR MSG_M48_OUT_OF_BOUNDS = _UxGT("Sınır dışı araştırma"); LSTR MSG_M48_DEVIATION = _UxGT("Sapma"); LSTR MSG_IDEX_MENU = _UxGT("IDEX Modu"); LSTR MSG_OFFSETS_MENU = _UxGT("Takım Ofsetleri"); @@ -122,21 +183,26 @@ namespace Language_tr { LSTR MSG_IDEX_MODE_DUPLICATE = _UxGT("Kopyala"); LSTR MSG_IDEX_MODE_MIRRORED_COPY = _UxGT("Yansıtılmış kopya"); LSTR MSG_IDEX_MODE_FULL_CTRL = _UxGT("Tam Kontrol"); + LSTR MSG_IDEX_DUPE_GAP = _UxGT("Yinelenen X-Boşluğu"); LSTR MSG_HOTEND_OFFSET_Z = _UxGT("2. nozul Z"); LSTR MSG_HOTEND_OFFSET_A = _UxGT("2. nozul @"); LSTR MSG_UBL_DOING_G29 = _UxGT("G29 Çalışıyor"); LSTR MSG_UBL_TOOLS = _UxGT("UBL Araçları"); - LSTR MSG_UBL_LEVEL_BED = _UxGT("UBL Yatak Hizalama"); + LSTR MSG_UBL_LEVEL_BED = _UxGT("UBL Tabla Seviyeleme"); LSTR MSG_LCD_TILTING_MESH = _UxGT("Eğim Noktası"); + LSTR MSG_UBL_TILT_MESH = _UxGT("Eğimli Mesh"); + LSTR MSG_UBL_TILTING_GRID = _UxGT("Eğimli Izgara Boyutu"); + LSTR MSG_UBL_MESH_TILTED = _UxGT("Mesh Eğildi"); LSTR MSG_UBL_MANUAL_MESH = _UxGT("Elle Mesh Oluştur"); + LSTR MSG_UBL_MESH_WIZARD = _UxGT("UBL Mesh Sihirbazı"); LSTR MSG_UBL_BC_INSERT = _UxGT("Altlık & Ölçü Ver"); - LSTR MSG_UBL_BC_INSERT2 = _UxGT("Ölçü"); - LSTR MSG_UBL_BC_REMOVE = _UxGT("Yataktan Ölçü Kaldır"); + LSTR MSG_UBL_BC_INSERT2 = _UxGT("Ölçüm"); + LSTR MSG_UBL_BC_REMOVE = _UxGT("Tablayı Kaldır & Ölç"); LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("Sonrakine Git"); LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("UBL'yi Etkinleştir"); LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("UBL'yi Etkisizleştir"); - LSTR MSG_UBL_SET_TEMP_BED = _UxGT("Yatak Sıcaklığı"); - LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("Yatak Sıcaklığı"); + LSTR MSG_UBL_SET_TEMP_BED = _UxGT("Tabla Sıcaklığı"); + LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("Tabla Sıcaklığı"); LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("Nozul Sıcaklığı"); LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("Nozul Sıcaklığı"); LSTR MSG_UBL_MESH_EDIT = _UxGT("Mesh Düzenleme"); @@ -145,14 +211,12 @@ namespace Language_tr { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Mesh Düzenleme Tamam"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Özel Mesh Oluştur"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Mesh Oluştur"); - #if HAS_PREHEAT - LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Mesh Oluştur ($)"); - LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Doğrulama Mesh ($)"); - #endif + LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Mesh Oluştur ($)"); LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("Soğuk Mesh Oluştur"); LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("Mesh Yükseklik Ayarı"); LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("Yükseklik miktarı"); LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("Doğrulama Mesh"); + LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Doğrulama Mesh ($)"); LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Özel Mesh Doğrulama"); LSTR MSG_G26_HEATING_BED = _UxGT("G26 Isıtma Tablası"); LSTR MSG_G26_HEATING_NOZZLE = _UxGT("G26 Isıtma Memesi"); @@ -162,29 +226,32 @@ namespace Language_tr { LSTR MSG_G26_CANCELED = _UxGT("G26 İptal edildi"); LSTR MSG_G26_LEAVING = _UxGT("Çıkış G26"); LSTR MSG_UBL_CONTINUE_MESH = _UxGT("Tabla Mesh Devam et"); - LSTR MSG_UBL_MESH_LEVELING = _UxGT("Mesh Hizalama"); - LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("3-Nokta Hizalama"); - LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("Kafes Mesh Hizalama"); + LSTR MSG_UBL_MESH_LEVELING = _UxGT("Mesh Seviyeleme"); + LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("3-Nokta Seviyeleme"); + LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("Kafes Mesh Seviyeleme"); LSTR MSG_UBL_MESH_LEVEL = _UxGT("Mesh Seviyesi"); LSTR MSG_UBL_SIDE_POINTS = _UxGT("Yan Noktalar"); LSTR MSG_UBL_MAP_TYPE = _UxGT("Haritalama Türü"); LSTR MSG_UBL_OUTPUT_MAP = _UxGT("Mesh Çıkış Haritası"); LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("Host için Çıktı"); LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("CSV için Çıktı"); - LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("Yazıcıda Yedek Kpalı"); + LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("Yedekleme Kapalı"); LSTR MSG_UBL_INFO_UBL = _UxGT("UBL Çıkış Bilgisi"); LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("Dolgu Miktarı"); LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Manuel Dolgu"); LSTR MSG_UBL_SMART_FILLIN = _UxGT("Akıllı Dogu"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Mesh Dolgu"); + LSTR MSG_UBL_MESH_FILLED = _UxGT("Eksikler Dolduruldu"); + LSTR MSG_UBL_MESH_INVALID = _UxGT("Geçersiz Mesh"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Tümünü Geçersiz Kıl"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Yakını Geçersiz Kıl"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Tümünü İnce Ayarla"); LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("Yakını İnce Ayarla"); LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("Mesh Depolama"); LSTR MSG_UBL_STORAGE_SLOT = _UxGT("Bellek Yuvası"); - LSTR MSG_UBL_LOAD_MESH = _UxGT("Yatak Mesh Yükle"); - LSTR MSG_UBL_SAVE_MESH = _UxGT("Yatak Mesh Kayıt Et"); + LSTR MSG_UBL_LOAD_MESH = _UxGT("Tabla Mesh Yükle"); + LSTR MSG_UBL_SAVE_MESH = _UxGT("Tabla Mesh Kayıt Et"); + LSTR MSG_UBL_INVALID_SLOT = _UxGT("Önce Mesh Yuvası Seç"); LSTR MSG_MESH_LOADED = _UxGT("Mesh %i yüklendi"); LSTR MSG_MESH_SAVED = _UxGT("Mesh %i kayıtlandı"); LSTR MSG_UBL_NO_STORAGE = _UxGT("Depolama Yok"); @@ -199,7 +266,7 @@ namespace Language_tr { LSTR MSG_UBL_4_FINE_TUNE_ALL = _UxGT("4.Tümünü İnce Ayarla"); LSTR MSG_UBL_5_VALIDATE_MESH_MENU = _UxGT("5.Doğrulama Mesh"); LSTR MSG_UBL_6_FINE_TUNE_ALL = _UxGT("6.Tümünü İnce Ayarla"); - LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7.Yatak Mesh Kayıt Et"); + LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7.Tabla Mesh Kaydet"); LSTR MSG_LED_CONTROL = _UxGT("LED Kontrolü"); LSTR MSG_LEDS = _UxGT("LEDler"); @@ -213,6 +280,10 @@ namespace Language_tr { LSTR MSG_SET_LEDS_VIOLET = _UxGT("Menekşe"); LSTR MSG_SET_LEDS_WHITE = _UxGT("Beyaz"); LSTR MSG_SET_LEDS_DEFAULT = _UxGT("Varsayılan"); + LSTR MSG_LED_CHANNEL_N = _UxGT("Kanal ="); + LSTR MSG_LEDS2 = _UxGT("Işıklar #2"); + LSTR MSG_NEO2_PRESETS = _UxGT("Işık #2 Ön Ayarları"); + LSTR MSG_NEO2_BRIGHTNESS = _UxGT("Parlaklık"); LSTR MSG_CUSTOM_LEDS = _UxGT("Özel Işıklar"); LSTR MSG_INTENSITY_R = _UxGT("Kırmızı Şiddeti"); LSTR MSG_INTENSITY_G = _UxGT("Yeşil Şiddeti"); @@ -222,7 +293,7 @@ namespace Language_tr { LSTR MSG_MOVING = _UxGT("Hareket Ediyor.."); LSTR MSG_FREE_XY = _UxGT("Durdur XY"); - LSTR MSG_MOVE_X = _UxGT("X Hareketi"); + LSTR MSG_MOVE_X = _UxGT("X Hareketi"); // Used by draw_edit_screen LSTR MSG_MOVE_Y = _UxGT("Y Hareketi"); LSTR MSG_MOVE_Z = _UxGT("Z Hareketi"); LSTR MSG_MOVE_N = _UxGT("@ Hareketi"); @@ -233,18 +304,36 @@ namespace Language_tr { LSTR MSG_MOVE_01MM = _UxGT("0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("1mm"); LSTR MSG_MOVE_10MM = _UxGT("10mm"); + LSTR MSG_MOVE_50MM = _UxGT("50mm"); LSTR MSG_MOVE_100MM = _UxGT("100mm"); + LSTR MSG_MOVE_0001IN = _UxGT("0.001in"); + LSTR MSG_MOVE_001IN = _UxGT("0.01in"); + LSTR MSG_MOVE_01IN = _UxGT("0.1in"); + LSTR MSG_MOVE_05IN = _UxGT("0.5in"); + LSTR MSG_MOVE_1IN = _UxGT("1.0in"); LSTR MSG_SPEED = _UxGT("Hız"); - LSTR MSG_MESH_Z_OFFSET = _UxGT("Z Mesafesi"); + LSTR MSG_BED_Z = _UxGT("Z Mesafesi"); LSTR MSG_NOZZLE = _UxGT("Nozul"); LSTR MSG_NOZZLE_N = _UxGT("Nozul ~"); + LSTR MSG_NOZZLE_PARKED = _UxGT("Nozul Park Edildi"); + LSTR MSG_NOZZLE_STANDBY = _UxGT("Nozul Beklemede"); LSTR MSG_BED = _UxGT("Tabla"); - LSTR MSG_CHAMBER = _UxGT("Çevirme"); + LSTR MSG_CHAMBER = _UxGT("Kabin"); + LSTR MSG_COOLER = _UxGT("Lazer Soğutucu"); + LSTR MSG_COOLER_TOGGLE = _UxGT("Soğutucuyu Değiştir"); + LSTR MSG_FLOWMETER_SAFETY = _UxGT("Akış Güvenliği"); + LSTR MSG_CUTTER = _UxGT("Kesici"); + LSTR MSG_LASER = _UxGT("Lazer"); LSTR MSG_FAN_SPEED = _UxGT("Fan Hızı"); LSTR MSG_FAN_SPEED_N = _UxGT("Fan Hızı ~"); LSTR MSG_STORED_FAN_N = _UxGT("Depolanan Fan ~"); LSTR MSG_EXTRA_FAN_SPEED = _UxGT("Ekstra Fan Hızı"); LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("Ekstra Fan Hızı ~"); + LSTR MSG_CONTROLLER_FAN = _UxGT("Kontrolör Fanı"); + LSTR MSG_CONTROLLER_FAN_IDLE_SPEED = _UxGT("Rölanti Hızı"); + LSTR MSG_CONTROLLER_FAN_AUTO_ON = _UxGT("Otomatik Mod"); + LSTR MSG_CONTROLLER_FAN_SPEED = _UxGT("Aktif Hız"); + LSTR MSG_CONTROLLER_FAN_DURATION = _UxGT("Rölanti Periyodu"); LSTR MSG_FLOW = _UxGT("Akış"); LSTR MSG_FLOW_N = _UxGT("Akış ~"); LSTR MSG_CONTROL = _UxGT("Kontrol"); @@ -256,34 +345,58 @@ namespace Language_tr { LSTR MSG_LCD_OFF = _UxGT("Kapalı"); LSTR MSG_PID_AUTOTUNE = _UxGT("PID Kalibrasyon"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Kalibrasyon *"); + LSTR MSG_PID_CYCLE = _UxGT("PID Döngüleri"); + LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID ayarı yapıldı"); + LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune başarısız!"); + LSTR MSG_BAD_EXTRUDER_NUM = _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_PID_BAD_EXTRUDER_NUM = _UxGT("Otomatik ayar başarısız! Kötü ekstruder."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Otomatik ayar başarısız! Sıcaklık çok yüksek."); + LSTR MSG_PID_TIMEOUT = _UxGT("Otomatik ayar başarısız! Zaman aşımı."); + LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Isı kaybı test ediliyor"); + LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Otomatik Ayarı"); + LSTR MSG_MPC_EDIT = _UxGT("Düzenle * MPC"); + LSTR MSG_MPC_POWER_E = _UxGT("Güç *"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Blok C *"); + LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Sensör çözünürlüğü *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ortam h *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Amb. h fan *"); + LSTR MSG_SELECT = _UxGT("Seç"); LSTR MSG_SELECT_E = _UxGT("Seç *"); LSTR MSG_ACC = _UxGT("İvme"); - - LSTR MSG_JERK = _UxGT("Sarsım"); - LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-Sarsım"); - LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-Sarsım"); - LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-Sarsım"); - LSTR MSG_VN_JERK = _UxGT("V@-Sarsım"); - LSTR MSG_VE_JERK = _UxGT("Ve-Sarsım"); + LSTR MSG_JERK = _UxGT("Sarsma"); + LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT(" Sarsma"); + LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT(" Sarsma"); + LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT(" Sarsma"); + LSTR MSG_VN_JERK = _UxGT("Max @ Sarsma"); + LSTR MSG_VE_JERK = _UxGT("Max E Sarsma"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Jonksiyon Sapması"); LSTR MSG_MAX_SPEED = _UxGT("Hız Vektörü"); - LSTR MSG_VMAX_A = _UxGT("HızVektör.max ") STR_A; - LSTR MSG_VMAX_B = _UxGT("HızVektör.max ") STR_B; - LSTR MSG_VMAX_C = _UxGT("HızVektör.max ") STR_C; - LSTR MSG_VMAX_N = _UxGT("HızVektör.max @"); - LSTR MSG_VMAX_E = _UxGT("HızVektör.max E"); - LSTR MSG_VMAX_EN = _UxGT("HızVektör.max *"); - LSTR MSG_VMIN = _UxGT("HızVektör.min"); - LSTR MSG_VTRAV_MIN = _UxGT("HV.gezinme min"); + LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Hız"); + LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Hız"); + LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Hız"); + LSTR MSG_VMAX_N = _UxGT("Max @ Hız"); + LSTR MSG_VMAX_E = _UxGT("Max E Hız"); + LSTR MSG_VMAX_EN = _UxGT("Max * Hız"); + LSTR MSG_VMIN = _UxGT("Min Hız"); + LSTR MSG_VTRAV_MIN = _UxGT("Min Gezme Hızı"); LSTR MSG_ACCELERATION = _UxGT("Ivme"); - LSTR MSG_AMAX_A = _UxGT("Max. ivme ") STR_A; - LSTR MSG_AMAX_B = _UxGT("Max. ivme ") STR_B; - LSTR MSG_AMAX_C = _UxGT("Max. ivme ") STR_C; - LSTR MSG_AMAX_N = _UxGT("Max. ivme @"); - LSTR MSG_AMAX_E = _UxGT("Max. ivme E"); - LSTR MSG_AMAX_EN = _UxGT("Max. ivme *"); - LSTR MSG_A_RETRACT = _UxGT("Ivme-geri çekme"); - LSTR MSG_A_TRAVEL = _UxGT("Ivme-gezinme"); + LSTR MSG_AMAX_A = _UxGT("Max ") STR_A _UxGT(" İvme"); + LSTR MSG_AMAX_B = _UxGT("Max ") STR_B _UxGT(" İvme"); + LSTR MSG_AMAX_C = _UxGT("Max ") STR_C _UxGT(" İvme"); + LSTR MSG_AMAX_N = _UxGT("Max @ İvme"); + LSTR MSG_AMAX_E = _UxGT("Max E İvme"); + LSTR MSG_AMAX_EN = _UxGT("Max * İvme"); + LSTR MSG_A_RETRACT = _UxGT("G.Çekme Hızı"); + LSTR MSG_A_TRAVEL = _UxGT("Gezinme Hızı"); + LSTR MSG_INPUT_SHAPING = _UxGT("Girdi Şekillendirme"); + LSTR MSG_SHAPING_ENABLE = _UxGT("Biçimleme @ aktif"); + LSTR MSG_SHAPING_DISABLE = _UxGT("Biçimleme @ pasif"); + LSTR MSG_SHAPING_FREQ = _UxGT("@ frekans"); + LSTR MSG_SHAPING_ZETA = _UxGT("@ sönümleme"); + LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("XY Frek. Sınırı"); + LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Min FR Factor"); LSTR MSG_STEPS_PER_MM = _UxGT("Adım/mm"); LSTR MSG_A_STEPS = STR_A _UxGT(" adım/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" adım/mm"); @@ -295,69 +408,133 @@ namespace Language_tr { LSTR MSG_MOTION = _UxGT("Hareket"); LSTR MSG_FILAMENT = _UxGT("Filaman"); LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("Ekstrüzyon/mm") SUPERSCRIPT_THREE; + LSTR MSG_VOLUMETRIC_LIMIT = _UxGT("E Limit in mm") SUPERSCRIPT_THREE; + LSTR MSG_VOLUMETRIC_LIMIT_E = _UxGT("E Limit *"); LSTR MSG_FILAMENT_DIAM = _UxGT("Filaman Çapı"); LSTR MSG_FILAMENT_DIAM_E = _UxGT("Filaman Çapı *"); LSTR MSG_FILAMENT_UNLOAD = _UxGT("Çıkart mm"); LSTR MSG_FILAMENT_LOAD = _UxGT("Yükle mm"); + LSTR MSG_SEGMENTS_PER_SECOND = _UxGT("Segment/Sn"); + LSTR MSG_DRAW_MIN_X = _UxGT("Draw Min X"); + LSTR MSG_DRAW_MAX_X = _UxGT("Draw Max X"); + LSTR MSG_DRAW_MIN_Y = _UxGT("Draw Min Y"); + LSTR MSG_DRAW_MAX_Y = _UxGT("Draw Max Y"); + LSTR MSG_MAX_BELT_LEN = _UxGT("Max Kayış Boyu"); LSTR MSG_ADVANCE_K = _UxGT("K İlerlet"); LSTR MSG_ADVANCE_K_E = _UxGT("K İlerlet *"); LSTR MSG_CONTRAST = _UxGT("LCD Kontrast"); + LSTR MSG_BRIGHTNESS = _UxGT("LCD Parlaklığı"); + LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Zaman Aşımı (m)"); + LSTR MSG_BRIGHTNESS_OFF = _UxGT("Arka Işık Kapalı"); LSTR MSG_STORE_EEPROM = _UxGT("Hafızaya Al"); LSTR MSG_LOAD_EEPROM = _UxGT("Hafızadan Yükle"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Fabrika Ayarları"); LSTR MSG_INIT_EEPROM = _UxGT("EEPROM'u başlat"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Hata: EEPROM CRC"); LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Hata: EEPROM Indeks"); - LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Hata: EEPROM Versiyonu"); + LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Hata: EEPROM Sürümü"); + LSTR MSG_SETTINGS_STORED = _UxGT("Ayarlar Kaydedildi"); LSTR MSG_MEDIA_UPDATE = _UxGT("SD Güncellemesi"); LSTR MSG_RESET_PRINTER = _UxGT("Yazıcıyı Resetle"); LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Yenile"); LSTR MSG_INFO_SCREEN = _UxGT("Bilgi Ekranı"); + LSTR MSG_INFO_MACHINENAME = _UxGT("Makine Adı"); + LSTR MSG_INFO_SIZE = _UxGT("Boyut"); + LSTR MSG_INFO_FWVERSION = _UxGT("Yazılım Sürümü"); + LSTR MSG_INFO_BUILD = _UxGT("Tarih & Saat Oluştur"); LSTR MSG_PREPARE = _UxGT("Hazırlık"); LSTR MSG_TUNE = _UxGT("Ayar"); + LSTR MSG_POWER_MONITOR = _UxGT("Güç monitörü"); + LSTR MSG_CURRENT = _UxGT("Akım"); + LSTR MSG_VOLTAGE = _UxGT("Voltaj"); + LSTR MSG_POWER = _UxGT("Güç"); LSTR MSG_START_PRINT = _UxGT("Yaz. Başlat"); LSTR MSG_BUTTON_NEXT = _UxGT("İleri"); - LSTR MSG_BUTTON_INIT = _UxGT("İçinde"); + LSTR MSG_BUTTON_INIT = _UxGT("Başlat"); LSTR MSG_BUTTON_STOP = _UxGT("Durdur"); LSTR MSG_BUTTON_PRINT = _UxGT("Yazdır"); LSTR MSG_BUTTON_RESET = _UxGT("Resetle"); + LSTR MSG_BUTTON_IGNORE = _UxGT("Yoksay"); LSTR MSG_BUTTON_CANCEL = _UxGT("İptal"); + LSTR MSG_BUTTON_CONFIRM = _UxGT("Onayla"); + LSTR MSG_BUTTON_CONTINUE = _UxGT("Sürdür"); LSTR MSG_BUTTON_DONE = _UxGT("Tamamlandı"); LSTR MSG_BUTTON_BACK = _UxGT("Geri"); - LSTR MSG_BUTTON_PROCEED = _UxGT("Devam ediyor"); + LSTR MSG_BUTTON_PROCEED = _UxGT("Devam Et"); + LSTR MSG_BUTTON_SKIP = _UxGT("Atla"); + LSTR MSG_BUTTON_INFO = _UxGT("Bilgi"); + LSTR MSG_BUTTON_LEVEL = _UxGT("Seviye"); + LSTR MSG_BUTTON_PAUSE = _UxGT("Duraklat"); + LSTR MSG_BUTTON_RESUME = _UxGT("Devam Et"); + LSTR MSG_BUTTON_ADVANCED = _UxGT("Gelişmiş"); + LSTR MSG_BUTTON_SAVE = _UxGT("Kaydet"); + LSTR MSG_BUTTON_PURGE = _UxGT("Temizle"); + LSTR MSG_PAUSING = _UxGT("Duraklatılıyor..."); LSTR MSG_PAUSE_PRINT = _UxGT("Duraklat"); - LSTR MSG_RESUME_PRINT = _UxGT("Sürdür"); - LSTR MSG_STOP_PRINT = _UxGT("Durdur"); - LSTR MSG_PRINTING_OBJECT = _UxGT("Yazdırma Nesnesi"); - LSTR MSG_CANCEL_OBJECT = _UxGT("Nesneyi İptal Et"); - LSTR MSG_CANCEL_OBJECT_N = _UxGT("Nesneyi İptal Et ="); + LSTR MSG_ADVANCED_PAUSE = _UxGT("Gelişmiş Duraklatma"); + LSTR MSG_RESUME_PRINT = _UxGT("Baskıyı Sürdür"); + LSTR MSG_STOP_PRINT = _UxGT("Baskıyı Durdur"); LSTR MSG_OUTAGE_RECOVERY = _UxGT("Kesinti Kurtarma"); - LSTR MSG_MEDIA_MENU = _UxGT("SD Karttan Yazdır"); + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 + LSTR MSG_HOST_START_PRINT = _UxGT("Host Baskıyı başlat"); + LSTR MSG_PRINTING_OBJECT = _UxGT("Yazdırma Nesnesi"); + LSTR MSG_CANCEL_OBJECT = _UxGT("Nesneyi İptal Et"); + LSTR MSG_CANCEL_OBJECT_N = _UxGT("Nesneyi İptal Et ="); + LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Yazdırmaya Devam Et"); + LSTR MSG_MEDIA_MENU = _UxGT("SD Karttan Yazdır"); + LSTR MSG_TURN_OFF = _UxGT("Yazıcıyı kapat"); + LSTR MSG_END_LOOPS = _UxGT("Tekrr Döngüler Bitir"); + #else + LSTR MSG_HOST_START_PRINT = _UxGT("Host Başlatma"); + LSTR MSG_PRINTING_OBJECT = _UxGT("Nesneyi Yazdır"); + LSTR MSG_CANCEL_OBJECT = _UxGT("Nesneyi İptal Et"); + LSTR MSG_CANCEL_OBJECT_N = _UxGT("Nesneyi İptal Et ="); + LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("İşe Devam Et"); + LSTR MSG_MEDIA_MENU = MEDIA_TYPE_EN _UxGT(" Yazdır"); + LSTR MSG_TURN_OFF = _UxGT("Şimdi kapat"); + LSTR MSG_END_LOOPS = _UxGT("Son Döngüler"); + #endif LSTR MSG_NO_MEDIA = _UxGT("SD Kart Yok!"); LSTR MSG_DWELL = _UxGT("Uyku..."); - LSTR MSG_USERWAIT = _UxGT("Operatör bekleniyor."); + LSTR MSG_USERWAIT = _UxGT("Devam için tıkla..."); LSTR MSG_PRINT_PAUSED = _UxGT("Baskı Duraklatıldı"); LSTR MSG_PRINTING = _UxGT("Baskı Yapılıyor..."); + LSTR MSG_STOPPING = _UxGT("Durduruluyor..."); + LSTR MSG_REMAINING_TIME = _UxGT("Kalan"); LSTR MSG_PRINT_ABORTED = _UxGT("Baskı Durduruldu!"); + LSTR MSG_PRINT_DONE = _UxGT("Yazdırma Bitti"); + LSTR MSG_PRINTER_KILLED = _UxGT("Yazıcı çöktü!"); LSTR MSG_NO_MOVE = _UxGT("İşlem yok."); - LSTR MSG_KILLED = _UxGT("Kilitlendi. "); - LSTR MSG_STOPPED = _UxGT("Durdu. "); + LSTR MSG_KILLED = _UxGT("ÇÖKTÜ. "); + LSTR MSG_STOPPED = _UxGT("DURDURULDU. "); + LSTR MSG_FWRETRACT = _UxGT("Yazılım Geri Çekme"); LSTR MSG_CONTROL_RETRACT = _UxGT("Geri Çek mm"); LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Swap Re.mm"); LSTR MSG_CONTROL_RETRACTF = _UxGT("Geri Çekme V"); LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Atlama mm"); - LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("Unretr. mm"); + LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("Geri Çek. mm"); LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("S Unretr. mm"); LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("Unretract V"); LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("S UnRet V"); LSTR MSG_AUTORETRACT = _UxGT("Oto. Geri Çekme"); LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("G.Çekme Boyu"); + LSTR MSG_FILAMENT_SWAP_EXTRA = _UxGT("Ekstra Değiştir"); LSTR MSG_FILAMENT_PURGE_LENGTH = _UxGT("Tasfiye uzunluğu"); LSTR MSG_TOOL_CHANGE = _UxGT("Takım Değişimi"); LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Z Yükselt"); LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Birincil Hız"); + LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Geri Çekme Sil"); LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Geri Çekme Hızı"); - LSTR MSG_NOZZLE_STANDBY = _UxGT("Nozul Beklemede"); + LSTR MSG_FILAMENT_PARK_ENABLED = _UxGT("Kafa Park"); + LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Kurtarma Hızı"); + LSTR MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Fan Hızı"); + LSTR MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Fan Süresi"); + LSTR MSG_TOOL_MIGRATION_ON = _UxGT("Otomatik AÇIK"); + LSTR MSG_TOOL_MIGRATION_OFF = _UxGT("Otomatik KAPALI"); + LSTR MSG_TOOL_MIGRATION = _UxGT("Takım Taşıma"); + LSTR MSG_TOOL_MIGRATION_AUTO = _UxGT("Otomatik-taşıma"); + LSTR MSG_TOOL_MIGRATION_END = _UxGT("Son Ekstruder"); + LSTR MSG_TOOL_MIGRATION_SWAP = _UxGT("* konumuna taşı"); LSTR MSG_FILAMENTCHANGE = _UxGT("Filaman Değiştir"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Filaman Değiştir *"); LSTR MSG_FILAMENTLOAD = _UxGT("Filaman Yükle"); @@ -365,36 +542,42 @@ namespace Language_tr { LSTR MSG_FILAMENTUNLOAD = _UxGT("Filaman Çıkart"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Filaman Çıkart *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Tümünü Çıkart"); - LSTR MSG_ATTACH_MEDIA = _UxGT("SD Kart Başlatılıyor"); - LSTR MSG_CHANGE_MEDIA = _UxGT("SD Kart Değiştir"); - LSTR MSG_RELEASE_MEDIA = _UxGT("SD Kart Çıkart"); - LSTR MSG_ZPROBE_OUT = _UxGT("Z Prob Açık. Tabla"); + LSTR MSG_ATTACH_MEDIA = _UxGT("Ekle ") MEDIA_TYPE_EN; + LSTR MSG_CHANGE_MEDIA = _UxGT("Değiştir ") MEDIA_TYPE_EN; + LSTR MSG_RELEASE_MEDIA = _UxGT("Çıkart ") MEDIA_TYPE_EN; + LSTR MSG_ZPROBE_OUT = _UxGT("Z Prob Tablayı Geçti"); LSTR MSG_SKEW_FACTOR = _UxGT("Çarpıklık Faktörü"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch K. Test"); - LSTR MSG_BLTOUCH_RESET = _UxGT("Reset"); + LSTR MSG_BLTOUCH_RESET = _UxGT("Sıfırla"); LSTR MSG_BLTOUCH_STOW = _UxGT("Kapat"); LSTR MSG_BLTOUCH_DEPLOY = _UxGT("Aç"); LSTR MSG_BLTOUCH_SW_MODE = _UxGT("SW-Modu"); + LSTR MSG_BLTOUCH_SPEED_MODE = _UxGT("Yüksek Hız"); LSTR MSG_BLTOUCH_5V_MODE = _UxGT("5V-Modu"); LSTR MSG_BLTOUCH_OD_MODE = _UxGT("OD-Modu"); LSTR MSG_BLTOUCH_MODE_STORE = _UxGT("Mode-Store"); LSTR MSG_BLTOUCH_MODE_STORE_5V = _UxGT("BLTouch 5V Ayarla"); LSTR MSG_BLTOUCH_MODE_STORE_OD = _UxGT("BLTouch OD Ayarla"); LSTR MSG_BLTOUCH_MODE_ECHO = _UxGT("Drenaj Raporu"); - LSTR MSG_BLTOUCH_MODE_CHANGE = _UxGT("TEHLIKE: Kötü ayarlar hasara neden olabilir! Yine de devam edilsin mi?"); + LSTR MSG_BLTOUCH_MODE_CHANGE = _UxGT("TEHLIKE: Kötü ayarlar zarar verebilir! Yine de devam edilsin mi?"); LSTR MSG_TOUCHMI_PROBE = _UxGT("TouchMI"); - LSTR MSG_TOUCHMI_INIT = _UxGT("Init TouchMI"); + LSTR MSG_TOUCHMI_INIT = _UxGT("TouchMI'yi Başlat"); LSTR MSG_TOUCHMI_ZTEST = _UxGT("Z Ofset Testi"); LSTR MSG_TOUCHMI_SAVE = _UxGT("Kaydet"); LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("TouchMI Aç"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Z-Probe Aç"); LSTR MSG_MANUAL_STOW = _UxGT("Z-Probe Kapat"); - LSTR MSG_HOME_FIRST = _UxGT("Önce %s Sıfırla"); + LSTR MSG_HOME_FIRST = _UxGT("Önce %s%s%s Sıfırla"); + LSTR MSG_ZPROBE_SETTINGS = _UxGT("Prob Ayarları"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Prob Ofsetleri"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("X Prob Ofset"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Y Prob Ofset"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z Prob Ofset"); + LSTR MSG_ZPROBE_MARGIN = _UxGT("Prob Payı"); + LSTR MSG_Z_FEED_RATE = _UxGT("Z İlerleme Hızı"); + LSTR MSG_ENABLE_HS_MODE = _UxGT("HS modunu aç"); + LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Nozülü Tablaya Taşı"); LSTR MSG_BABYSTEP_X = _UxGT("Miniadım X"); LSTR MSG_BABYSTEP_Y = _UxGT("Miniadım Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Miniadım Z"); @@ -402,23 +585,28 @@ namespace Language_tr { LSTR MSG_BABYSTEP_TOTAL = _UxGT("Toplam"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop iptal"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Isınma başarısız"); - LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Hata: Sıcaklık Aşımı"); - LSTR MSG_THERMAL_RUNAWAY = _UxGT("TERMAL PROBLEM"); - LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("TABLA TERMAL PROBLEM"); - LSTR MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("ODA TERMAL PROBLEM"); + LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Hata: ISI AŞIMI"); + LSTR MSG_THERMAL_RUNAWAY = _UxGT("ISI SORUNU"); + LSTR MSG_TEMP_MALFUNCTION = _UxGT("SICAKLIK ARIZASI"); + LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("TABLA ISI SORUNU"); + LSTR MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("KABİN ISI SORUNU"); + LSTR MSG_THERMAL_RUNAWAY_COOLER = _UxGT("Soğutucu Isı Sorunu"); + LSTR MSG_COOLING_FAILED = _UxGT("Soğutma Başarısız"); LSTR MSG_ERR_MAXTEMP = _UxGT("Hata: MAX.SICAKLIK"); LSTR MSG_ERR_MINTEMP = _UxGT("Hata: MIN.SICAKLIK"); LSTR MSG_HALTED = _UxGT("YAZICI DURDURULDU"); + LSTR MSG_PLEASE_WAIT = _UxGT("Lütfen bekleyin..."); LSTR MSG_PLEASE_RESET = _UxGT("Lütfen Resetleyin"); - LSTR MSG_SHORT_DAY = _UxGT("G"); // One character only - LSTR MSG_SHORT_HOUR = _UxGT("S"); // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("D"); // One character only + LSTR MSG_PREHEATING = _UxGT("ön ısıtma..."); LSTR MSG_HEATING = _UxGT("Isınıyor..."); LSTR MSG_COOLING = _UxGT("Soğuyor..."); LSTR MSG_BED_HEATING = _UxGT("Tabla Isınıyor..."); LSTR MSG_BED_COOLING = _UxGT("Tabla Soğuyor..."); - LSTR MSG_CHAMBER_HEATING = _UxGT("Oda Isınıyor..."); - LSTR MSG_CHAMBER_COOLING = _UxGT("Oda Soğuyor..."); + LSTR MSG_PROBE_HEATING = _UxGT("Prob ısınıyor..."); + LSTR MSG_PROBE_COOLING = _UxGT("Prob Soğuyor..."); + LSTR MSG_CHAMBER_HEATING = _UxGT("Kabin Isınıyor..."); + LSTR MSG_CHAMBER_COOLING = _UxGT("Kabin Soğuyor..."); + LSTR MSG_LASER_COOLING = _UxGT("Lazer Soğuyor..."); LSTR MSG_DELTA_CALIBRATE = _UxGT("Delta Kalibrasyonu"); LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Ayarla X"); LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Ayarla Y"); @@ -431,35 +619,59 @@ namespace Language_tr { LSTR MSG_DELTA_RADIUS = _UxGT("Yarıçap"); LSTR MSG_INFO_MENU = _UxGT("Yazıcı Hakkında"); LSTR MSG_INFO_PRINTER_MENU = _UxGT("Yazıcı Bilgisi"); - LSTR MSG_3POINT_LEVELING = _UxGT("3-Nokta Hizalama"); - LSTR MSG_LINEAR_LEVELING = _UxGT("Doğrusal Hizalama"); + LSTR MSG_3POINT_LEVELING = _UxGT("3-Nokta Seviyeleme"); + LSTR MSG_LINEAR_LEVELING = _UxGT("Doğrusal Seviyeleme"); LSTR MSG_BILINEAR_LEVELING = _UxGT("İki Yönlü Doğ. Hiza."); LSTR MSG_UBL_LEVELING = _UxGT("Birleşik Tabla Hiza."); - LSTR MSG_MESH_LEVELING = _UxGT("Mesh Hizalama"); + LSTR MSG_MESH_LEVELING = _UxGT("Mesh Seviyeleme"); + LSTR MSG_MESH_DONE = _UxGT("Mesh sondalama tamam"); LSTR MSG_INFO_STATS_MENU = _UxGT("İstatistikler"); LSTR MSG_INFO_BOARD_MENU = _UxGT("Kontrolcü Bilgisi"); LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Termistörler"); LSTR MSG_INFO_EXTRUDERS = _UxGT("Ekstruderler"); LSTR MSG_INFO_BAUDRATE = _UxGT("İletişim Hızı"); LSTR MSG_INFO_PROTOCOL = _UxGT("Protokol"); + LSTR MSG_INFO_RUNAWAY_OFF = _UxGT("Kaçak İzleme: KAPALI"); + LSTR MSG_INFO_RUNAWAY_ON = _UxGT("Kaçak İzleme: AÇIK"); + LSTR MSG_HOTEND_IDLE_TIMEOUT = _UxGT("Hotend Boşta Zamn Aş"); + LSTR MSG_FAN_SPEED_FAULT = _UxGT("Fan hızı hatası"); + LSTR MSG_CASE_LIGHT = _UxGT("Aydınlatmayı Aç"); - LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Aydınlatma Parlaklğı"); + LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Işık Parlaklğı"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("Yanlış Yazıcı"); + LSTR MSG_COLORS_GET = _UxGT("Renk Al"); + LSTR MSG_COLORS_SELECT = _UxGT("Renkleri Seç"); + LSTR MSG_COLORS_APPLIED = _UxGT("Uygulanan renkler"); + LSTR MSG_COLORS_RED = _UxGT("Kırmızı"); + LSTR MSG_COLORS_GREEN = _UxGT("Yeşil"); + LSTR MSG_COLORS_BLUE = _UxGT("Mavi"); + LSTR MSG_COLORS_WHITE = _UxGT("Beyaz"); + LSTR MSG_UI_LANGUAGE = _UxGT("UI Dili"); + LSTR MSG_SOUND_ENABLE = _UxGT("Sesi etkinleştir"); + LSTR MSG_LOCKSCREEN = _UxGT("Kilit Ekranı"); + LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Yazıcı Kilitlendi,"); + LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("Açmak için kaydırın."); + LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Y.Başlatma bekleyin."); + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 + LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Ortam yerleştirilmedi."); + LSTR MSG_PLEASE_PREHEAT = _UxGT("Lütfen önce hotend'i ısıtın."); + LSTR MSG_INFO_PRINT_COUNT_RESET = _UxGT("Baskı Sayısını Sıfırla"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Baskı Sayısı"); - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Tamamlanan"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Toplam Baskı Süresi"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("En Uzun Baskı Süresi"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Toplam Filaman"); #else + LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Medya Yok"); + LSTR MSG_PLEASE_PREHEAT = _UxGT("Ön Isıtma Lütfen"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Baskı"); - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Tamamlanan"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Süre"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("En Uzun"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Filaman"); #endif + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Tamamlanan"); LSTR MSG_INFO_MIN_TEMP = _UxGT("Min Sıc."); LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Sıc."); LSTR MSG_INFO_PSU = _UxGT("Güç Kaynağı"); @@ -474,9 +686,15 @@ namespace Language_tr { LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("Seçenekler:"); LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Daha Fazla Tasviye"); LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Baskıyı sürdür"); + LSTR MSG_FILAMENT_CHANGE_PURGE_CONTINUE = _UxGT("Temizle veya Devam?"); LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Nozul: "); LSTR MSG_RUNOUT_SENSOR = _UxGT("Runout Sensörü"); LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Aşınma Farkı mm"); + LSTR MSG_RUNOUT_ENABLE = _UxGT("Fil. Sens. Aç"); + LSTR MSG_RUNOUT_ACTIVE = _UxGT("Fil. Sens. Aktif"); + LSTR MSG_INVERT_EXTRUDER = _UxGT("Ekstruder Ters Çevir"); + LSTR MSG_EXTRUDER_MIN_TEMP = _UxGT("Ekstruder Min Isı"); + LSTR MSG_FANCHECK = _UxGT("Fan Takosu Kontrolü"); LSTR MSG_KILL_HOMING_FAILED = _UxGT("Sıfırlama Başarısız"); LSTR MSG_LCD_PROBING_FAILED = _UxGT("Probing Başarısız"); @@ -526,6 +744,20 @@ namespace Language_tr { LSTR MSG_SNAKE = _UxGT("Sn4k3"); LSTR MSG_MAZE = _UxGT("Maze"); + LSTR MSG_BAD_PAGE = _UxGT("Hatalı sayfa dizini"); + LSTR MSG_BAD_PAGE_SPEED = _UxGT("Kötü sayfa hızı"); + + LSTR MSG_EDIT_PASSWORD = _UxGT("Şifreyi Düzenle"); + LSTR MSG_LOGIN_REQUIRED = _UxGT("Giriş Gerekli"); + LSTR MSG_PASSWORD_SETTINGS = _UxGT("Şifre Ayarları"); + LSTR MSG_ENTER_DIGIT = _UxGT("Rakam girin"); + LSTR MSG_CHANGE_PASSWORD = _UxGT("Şifre Belirle/Düzenle"); + LSTR MSG_REMOVE_PASSWORD = _UxGT("Şifre Kaldır"); + LSTR MSG_PASSWORD_SET = _UxGT("Şifre "); + LSTR MSG_START_OVER = _UxGT("Yeniden Başla"); + LSTR MSG_REMINDER_SAVE_SETTINGS = _UxGT("Kaydetmeyi Unutma!"); + LSTR MSG_PASSWORD_REMOVED = _UxGT("Şifre Kaldırıldı"); + // // Filament Değişim ekranları 4 satırlı ekranda 3 satıra kadar gösterilir // ...veya 3 satırlı ekranda 2 satıra kadar @@ -567,12 +799,43 @@ namespace Language_tr { LSTR MSG_BACKLASH = _UxGT("Ters Tepki"); LSTR MSG_BACKLASH_CORRECTION = _UxGT("Düzeltme"); LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Yumuşatma"); -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + LSTR MSG_LEVEL_X_AXIS = _UxGT("Seviye X Ekseni"); + LSTR MSG_AUTO_CALIBRATE = _UxGT("Otomatik Kalibre Et"); + #if ENABLED(TOUCH_UI_FTDI_EVE) + LSTR MSG_HEATER_TIMEOUT = _UxGT("Boşta kalma zaman aşımı, sıcaklık düştü. Yeniden ısıtmak ve tekrar devam etmek için için Tamam'a basın."); + #else + LSTR MSG_HEATER_TIMEOUT = _UxGT("Isıtıcı Zaman Aşımı"); + #endif + LSTR MSG_REHEAT = _UxGT("Yeniden ısıt"); + LSTR MSG_REHEATING = _UxGT("Yeniden ısıtılıyor..."); + LSTR MSG_REHEATDONE = _UxGT("Y. Isıtma Tamam"); + + LSTR MSG_PROBE_WIZARD = _UxGT("Z Prob Sihirbazı"); + LSTR MSG_PROBE_WIZARD_PROBING = _UxGT("Z Referansını Tarama"); + LSTR MSG_PROBE_WIZARD_MOVING = _UxGT("Prob Konumuna Geçme"); + + LSTR MSG_XATC = _UxGT("X-Twist Sihirbazı"); + LSTR MSG_XATC_DONE = _UxGT("X-Twist Sihirbazı Bitti!"); + LSTR MSG_XATC_UPDATE_Z_OFFSET = _UxGT("Prob Z-Offset güncelle "); + + LSTR MSG_SOUND = _UxGT("Ses"); + + LSTR MSG_TOP_LEFT = _UxGT("Üst Sol"); + LSTR MSG_BOTTOM_LEFT = _UxGT("Alt Sol"); + LSTR MSG_TOP_RIGHT = _UxGT("Üst Sağ"); + LSTR MSG_BOTTOM_RIGHT = _UxGT("Alt Sağ"); + LSTR MSG_CALIBRATION_COMPLETED = _UxGT("Kalibrasyon Tamamlandı"); + LSTR MSG_CALIBRATION_FAILED = _UxGT("Kalibrasyon Başarısız"); + + LSTR MSG_DRIVER_BACKWARD = _UxGT(" driver backward"); + + LSTR MSG_SD_CARD = _UxGT("SD Kart"); + LSTR MSG_USB_DISK = _UxGT("USB Disk"); + + LSTR MSG_HOST_SHUTDOWN = _UxGT("Host'u Kapat"); + + LSTR MSG_SHORT_DAY = _UxGT("g"); // One character only + LSTR MSG_SHORT_HOUR = _UxGT("s"); // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("d"); // One character only +} diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index dc032655247c..7e7ef5eb37ee 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -625,9 +625,6 @@ namespace Language_uk { LSTR MSG_ERR_MINTEMP = _UxGT("МІНІМАЛЬНА Т") LCD_STR_DEGREE; LSTR MSG_HALTED = _UxGT("ПРИНТЕР ЗУПИНЕНО"); LSTR MSG_PLEASE_RESET = _UxGT("Перезавантажте"); - LSTR MSG_SHORT_DAY = _UxGT("д"); // One character only - LSTR MSG_SHORT_HOUR = _UxGT("г"); // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("х"); // One character only LSTR MSG_HEATING = _UxGT("Нагрівання..."); LSTR MSG_COOLING = _UxGT("Охолодження..."); LSTR MSG_BED_HEATING = _UxGT("Нагрів столу..."); @@ -913,12 +910,8 @@ namespace Language_uk { LSTR MSG_SD_CARD = _UxGT("SD Картка"); LSTR MSG_USB_DISK = _UxGT("USB Диск"); -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + LSTR MSG_SHORT_DAY = _UxGT("д"); // One character only + LSTR MSG_SHORT_HOUR = _UxGT("г"); // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("х"); // One character only +} diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index c01b2f44faa1..3925eb8b83a6 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -341,9 +341,6 @@ namespace Language_vi { LSTR MSG_ERR_MINTEMP = _UxGT("Điều sai: nhiệt độ tối thiểu"); // Err: MINTEMP LSTR MSG_HALTED = _UxGT("MÁY IN ĐÃ DỪNG LẠI"); // PRINTER HALTED LSTR MSG_PLEASE_RESET = _UxGT("Xin bặt lại"); // Please reset - LSTR MSG_SHORT_DAY = _UxGT("n"); // d - ngày - One character only - LSTR MSG_SHORT_HOUR = _UxGT("g"); // h - giờ - One character only - LSTR MSG_SHORT_MINUTE = _UxGT("p"); // m - phút - One character only LSTR MSG_HEATING = _UxGT("Đang sưởi nóng..."); // heating LSTR MSG_COOLING = _UxGT("Đang làm nguội..."); // cooling LSTR MSG_BED_HEATING = _UxGT("Đang sưởi nong bàn..."); // bed heating @@ -437,4 +434,8 @@ namespace Language_vi { LSTR MSG_TMC_HOMING_THRS = _UxGT("Vô cảm biến"); // Sensorless homing LSTR MSG_TMC_STEPPING_MODE = _UxGT("Chế độ từng bước"); // Stepping mode LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("CắtTàngHình được kích hoạt"); // StealthChop enabled + + LSTR MSG_SHORT_DAY = _UxGT("n"); // d - ngày - One character only + LSTR MSG_SHORT_HOUR = _UxGT("g"); // h - giờ - One character only + LSTR MSG_SHORT_MINUTE = _UxGT("p"); // m - phút - One character only } diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 4dccbc4f0950..0fd72b410cd4 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -438,9 +438,6 @@ namespace Language_zh_CN { LSTR MSG_ERR_MINTEMP = _UxGT("错误:最低温度"); // "Err: MINTEMP" LSTR MSG_HALTED = _UxGT("打印停机"); // "PRINTER HALTED" LSTR MSG_PLEASE_RESET = _UxGT("请重置"); // "Please reset" - LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only - LSTR MSG_SHORT_HOUR = _UxGT("时"); // "h" // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only LSTR MSG_HEATING = _UxGT("加热中 ..."); // "Heating..." LSTR MSG_COOLING = _UxGT("冷却中 ..."); LSTR MSG_BED_HEATING = _UxGT("加热热床中 ..."); // "Bed Heating..." @@ -608,12 +605,8 @@ namespace Language_zh_CN { LSTR MSG_HEATER_TIMEOUT = _UxGT("加热器超时"); LSTR MSG_REHEAT = _UxGT("重新加热"); LSTR MSG_REHEATING = _UxGT("重新加热中..."); -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only + LSTR MSG_SHORT_HOUR = _UxGT("时"); // "h" // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only +} diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 4ba94f3014ec..a00303864ad8 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -388,9 +388,6 @@ namespace Language_zh_TW { LSTR MSG_ERR_MINTEMP = _UxGT("錯誤:最低溫度"); // "Err: MINTEMP" LSTR MSG_HALTED = _UxGT("印表機停機"); // "PRINTER HALTED" LSTR MSG_PLEASE_RESET = _UxGT("請重置"); // "Please reset" - LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only - LSTR MSG_SHORT_HOUR = _UxGT("時"); // "h" // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only LSTR MSG_HEATING = _UxGT("加熱中 ..."); // "Heating..." LSTR MSG_COOLING = _UxGT("冷卻中 ..."); // "Cooling..." LSTR MSG_BED_HEATING = _UxGT("加熱熱床中 ..."); // "Bed Heating..." @@ -490,12 +487,8 @@ namespace Language_zh_TW { LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("按下完成..")); // "Click to finish" LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("恢復中 ...")); // "Resuming..." #endif // LCD_HEIGHT < 4 -} -#if FAN_COUNT == 1 - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED -#else - #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N - #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N -#endif + LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only + LSTR MSG_SHORT_HOUR = _UxGT("時"); // "h" // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only +} diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index d3f01e6d2322..88cdb990762d 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -351,7 +351,6 @@ void MarlinUI::init() { #if IS_DWIN_MARLINUI bool MarlinUI::did_first_redraw; - bool MarlinUI::old_is_printing; #endif #if ENABLED(SDSUPPORT) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index fa18878c1ba8..9d6d235e96de 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -503,7 +503,6 @@ class MarlinUI { #if IS_DWIN_MARLINUI static bool did_first_redraw; - static bool old_is_printing; #endif #if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index c529ae757a97..85b773bebc94 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -48,7 +48,7 @@ //////////////////////////////////////////// #if HAS_LEVELING && ANY(LCD_BED_TRAMMING, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) - bool leveling_was_active; // = false + bool menu_leveling_was_active; // = false #endif #if ANY(PROBE_MANUALLY, MESH_BED_LEVELING, X_AXIS_TWIST_COMPENSATION) uint8_t manual_probe_index; // = 0 diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index befffe5f72d2..9b9c67886880 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -264,7 +264,7 @@ inline void clear_menu_history() { screen_history_depth = 0; } #define STICKY_SCREEN(S) []{ ui.defer_status_screen(); ui.goto_screen(S); } #if HAS_LEVELING && ANY(LCD_BED_TRAMMING, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) - extern bool leveling_was_active; + extern bool menu_leveling_was_active; #endif #if ANY(PROBE_MANUALLY, MESH_BED_LEVELING, X_AXIS_TWIST_COMPENSATION) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 0e24d0ed8087..71188a86883d 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -597,7 +597,7 @@ void menu_backlash(); ; LOOP_LOGICAL_AXES(a) { - if (a == C_AXIS || TERN0(HAS_EXTRUDERS, a == E_AXIS)) + if (TERN0(HAS_C_AXIS, a == C_AXIS) || TERN0(HAS_EXTRUDERS, a == E_AXIS)) EDIT_ITEM_FAST_N(float52sign, a, MSG_VN_JERK, &planner.max_jerk[a], 0.1f, max_jerk_edit[a]); else EDIT_ITEM_FAST_N(float3, a, MSG_VN_JERK, &planner.max_jerk[a], 1.0f, max_jerk_edit[a]); diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index d25d35011e8f..a7fb54f68ddd 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -293,7 +293,7 @@ void menu_bed_leveling() { #endif #if ENABLED(LCD_BED_TRAMMING) - SUBMENU(MSG_BED_TRAMMING, _lcd_level_bed_corners); + SUBMENU(MSG_BED_TRAMMING, _lcd_bed_tramming); #endif #if ENABLED(EEPROM_SETTINGS) diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_tramming.cpp similarity index 67% rename from Marlin/src/lcd/menu/menu_bed_corners.cpp rename to Marlin/src/lcd/menu/menu_bed_tramming.cpp index 0e0051e65d6c..8129a347c314 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_tramming.cpp @@ -21,7 +21,7 @@ */ // -// Level Bed Corners menu +// Bed Tramming menu // #include "../../inc/MarlinConfigPre.h" @@ -43,6 +43,10 @@ #define BED_TRAMMING_HEIGHT 0.0 #endif +#if BOTH(HAS_STOWABLE_PROBE, BED_TRAMMING_USE_PROBE) && DISABLED(BLTOUCH) + #define NEEDS_PROBE_DEPLOY 1 +#endif + #if ENABLED(BED_TRAMMING_USE_PROBE) #include "../../module/probe.h" #include "../../module/endstops.h" @@ -54,7 +58,7 @@ #endif float last_z; int good_points; - bool corner_probing_done, wait_for_probe; + bool tramming_done, wait_for_probe; #if HAS_MARLINUI_U8GLIB #include "../dogm/marlinui_DOGM.h" @@ -66,6 +70,11 @@ static_assert(BED_TRAMMING_Z_HOP >= 0, "BED_TRAMMING_Z_HOP must be >= 0. Please update your configuration."); +#define LF 1 +#define RF 2 +#define RB 3 +#define LB 4 + #ifndef BED_TRAMMING_LEVELING_ORDER #define BED_TRAMMING_LEVELING_ORDER { LF, RF, LB, RB } // Default //#define BED_TRAMMING_LEVELING_ORDER { LF, LB, RF } // 3 hard-coded points @@ -75,18 +84,14 @@ static_assert(BED_TRAMMING_Z_HOP >= 0, "BED_TRAMMING_Z_HOP must be >= 0. Please //#define BED_TRAMMING_LEVELING_ORDER { LB, RB } // 3-Point tramming - Front #endif -#define LF 1 -#define RF 2 -#define RB 3 -#define LB 4 constexpr int lco[] = BED_TRAMMING_LEVELING_ORDER; -constexpr bool level_corners_3_points = COUNT(lco) == 2; -static_assert(level_corners_3_points || COUNT(lco) == 4, "BED_TRAMMING_LEVELING_ORDER must have exactly 2 or 4 corners."); +constexpr bool tramming_3_points = COUNT(lco) == 2; +static_assert(tramming_3_points || COUNT(lco) == 4, "BED_TRAMMING_LEVELING_ORDER must have exactly 2 or 4 corners."); constexpr int lcodiff = ABS(lco[0] - lco[1]); static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two BED_TRAMMING_LEVELING_ORDER corners must be on the same edge."); -constexpr int nr_edge_points = level_corners_3_points ? 3 : 4; +constexpr int nr_edge_points = tramming_3_points ? 3 : 4; constexpr int available_points = nr_edge_points + ENABLED(BED_TRAMMING_INCLUDE_CENTER); constexpr int center_index = TERN(BED_TRAMMING_INCLUDE_CENTER, available_points - 1, -1); constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB; @@ -96,38 +101,38 @@ constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] static int8_t bed_corner; /** - * Select next corner coordinates + * Move to the next corner coordinates */ -static void _lcd_level_bed_corners_get_next_position() { +static void _lcd_goto_next_corner() { + xy_pos_t corner_point = lf; // Left front - if (level_corners_3_points) { + if (tramming_3_points) { if (bed_corner >= available_points) bed_corner = 0; // Above max position -> move back to first corner switch (bed_corner) { case 0 ... 1: // First two corners set explicitly by the configuration - current_position = lf; // Left front switch (lco[bed_corner]) { - case RF: current_position.x = rb.x; break; // Right Front - case RB: current_position = rb; break; // Right Back - case LB: current_position.y = rb.y; break; // Left Back + case RF: corner_point.x = rb.x; break; // Right Front + case RB: corner_point = rb; break; // Right Back + case LB: corner_point.y = rb.y; break; // Left Back } break; case 2: // Determine which edge to probe for 3rd point - current_position.set(lf.x + (rb.x - lf.x) / 2, lf.y + (rb.y - lf.y) / 2); - if ((lco[0] == LB && lco[1] == RB) || (lco[0] == RB && lco[1] == LB)) current_position.y = lf.y; // Front Center - if ((lco[0] == LF && lco[1] == LB) || (lco[0] == LB && lco[1] == LF)) current_position.x = rb.x; // Center Right - if ((lco[0] == RF && lco[1] == RB) || (lco[0] == RB && lco[1] == RF)) current_position.x = lf.x; // Left Center - if ((lco[0] == LF && lco[1] == RF) || (lco[0] == RF && lco[1] == LF)) current_position.y = rb.y; // Center Back - #if DISABLED(BED_TRAMMING_INCLUDE_CENTER) && ENABLED(BED_TRAMMING_USE_PROBE) + corner_point.set(lf.x + (rb.x - lf.x) / 2, lf.y + (rb.y - lf.y) / 2); + if ((lco[0] == LB && lco[1] == RB) || (lco[0] == RB && lco[1] == LB)) corner_point.y = lf.y; // Front Center + if ((lco[0] == LF && lco[1] == LB) || (lco[0] == LB && lco[1] == LF)) corner_point.x = rb.x; // Center Right + if ((lco[0] == RF && lco[1] == RB) || (lco[0] == RB && lco[1] == RF)) corner_point.x = lf.x; // Left Center + if ((lco[0] == LF && lco[1] == RF) || (lco[0] == RF && lco[1] == LF)) corner_point.y = rb.y; // Center Back + #if ENABLED(BED_TRAMMING_USE_PROBE) && DISABLED(BED_TRAMMING_INCLUDE_CENTER) bed_corner++; // Must increment the count to ensure it resets the loop if the 3rd point is out of tolerance #endif break; #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) case 3: - current_position.set(X_CENTER, Y_CENTER); + corner_point.set(X_CENTER, Y_CENTER); break; #endif } @@ -135,23 +140,29 @@ static void _lcd_level_bed_corners_get_next_position() { else { // Four-Corner Bed Tramming with optional center if (TERN0(BED_TRAMMING_INCLUDE_CENTER, bed_corner == center_index)) { - current_position.set(X_CENTER, Y_CENTER); - TERN_(BED_TRAMMING_USE_PROBE, good_points--); // Decrement to allow one additional probe point + corner_point.set(X_CENTER, Y_CENTER); } else { - current_position = lf; // Left front switch (lco[bed_corner]) { - case RF: current_position.x = rb.x; break; // Right front - case RB: current_position = rb; break; // Right rear - case LB: current_position.y = rb.y; break; // Left rear + case RF: corner_point.x = rb.x; break; // Right Front + case RB: corner_point = rb; break; // Right Back + case LB: corner_point.y = rb.y; break; // Left Back } } } + + float z = BED_TRAMMING_Z_HOP; + #if BOTH(BED_TRAMMING_USE_PROBE, BLTOUCH) + z += bltouch.z_extra_clearance(); + #endif + line_to_z(z); + do_blocking_move_to_xy(DIFF_TERN(BED_TRAMMING_USE_PROBE, corner_point, probe.offset_xy), manual_feedrate_mm_s.x); + #if DISABLED(BED_TRAMMING_USE_PROBE) + line_to_z(BED_TRAMMING_HEIGHT); + if (++bed_corner >= available_points) bed_corner = 0; + #endif } -/** - * Level corners, starting in the front-left corner. - */ #if ENABLED(BED_TRAMMING_USE_PROBE) #define VALIDATE_POINT(X, Y, STR) static_assert(Probe::build_time::can_reach((X), (Y)), \ @@ -198,7 +209,7 @@ static void _lcd_level_bed_corners_get_next_position() { if (!ui.should_draw()) return; MenuItem_confirm::select_screen( GET_TEXT_F(MSG_BUTTON_DONE), GET_TEXT_F(MSG_BUTTON_SKIP) - , []{ corner_probing_done = true; wait_for_probe = false; } + , []{ tramming_done = true; wait_for_probe = false; } , []{ wait_for_probe = false; } , GET_TEXT_F(MSG_BED_TRAMMING_RAISE) ); @@ -207,37 +218,52 @@ static void _lcd_level_bed_corners_get_next_position() { void _lcd_draw_level_prompt() { if (!ui.should_draw()) return; MenuItem_confirm::select_screen( - GET_TEXT_F(TERN(HAS_LEVELING, MSG_BUTTON_LEVEL, MSG_BUTTON_DONE)), - TERN(HAS_LEVELING, GET_TEXT_F(MSG_BUTTON_BACK), nullptr) - , []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); } - , TERN(HAS_LEVELING, ui.goto_previous_screen_no_defer, []{}) + GET_TEXT_F(TERN(HAS_LEVELING, MSG_BUTTON_LEVEL, MSG_BUTTON_DONE)) + , TERN(HAS_LEVELING, GET_TEXT_F(MSG_BUTTON_BACK), nullptr) + , []{ + tramming_done = true; + queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); + ui.goto_previous_screen_no_defer(); + } + , []{ + tramming_done = true; + TERN_(HAS_LEVELING, ui.goto_previous_screen_no_defer()); + TERN_(NEEDS_PROBE_DEPLOY, probe.stow(true)); + } , GET_TEXT_F(MSG_BED_TRAMMING_IN_RANGE) ); } - bool _lcd_level_bed_corners_probe(bool verify=false) { - if (verify) do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP); // do clearance if needed + bool _lcd_bed_tramming_probe(const bool verify=false) { + if (verify) line_to_z(BED_TRAMMING_Z_HOP); // do clearance if needed TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.deploy()); // Deploy in LOW SPEED MODE on every probe action do_blocking_move_to_z(last_z - BED_TRAMMING_PROBE_TOLERANCE, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW)); // Move down to lower tolerance if (TEST(endstops.trigger_state(), Z_MIN_PROBE)) { // check if probe triggered endstops.hit_on_purpose(); set_current_from_steppers_for_axis(Z_AXIS); sync_plan_position(); + TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.stow()); // Stow in LOW SPEED MODE on every trigger + // Triggered outside tolerance range? if (ABS(current_position.z - last_z) > BED_TRAMMING_PROBE_TOLERANCE) { last_z = current_position.z; // Above tolerance. Set a new Z for subsequent corners. good_points = 0; // ...and start over } + + // Raise the probe after the last point to give clearance for stow + if (TERN0(NEEDS_PROBE_DEPLOY, good_points == nr_edge_points - 1)) + line_to_z(BED_TRAMMING_Z_HOP); + return true; // probe triggered } - do_blocking_move_to_z(last_z); // go back to tolerance middle point before raise + line_to_z(last_z); // go back to tolerance middle point before raise return false; // probe not triggered } - bool _lcd_level_bed_corners_raise() { + bool _lcd_bed_tramming_raise() { bool probe_triggered = false; - corner_probing_done = false; + tramming_done = false; wait_for_probe = true; ui.goto_screen(_lcd_draw_raise); // show raise screen ui.set_selection(true); @@ -264,25 +290,21 @@ static void _lcd_level_bed_corners_get_next_position() { ui.refresh(LCDVIEW_REDRAW_NOW); _lcd_draw_probing(); // update screen with # of good points - do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP + TERN0(BLTOUCH, bltouch.z_extra_clearance())); // clearance - - _lcd_level_bed_corners_get_next_position(); // Select next corner coordinates - current_position -= probe.offset_xy; // Account for probe offsets - do_blocking_move_to_xy(current_position); // Goto corner + _lcd_goto_next_corner(); // Goto corner TERN_(BLTOUCH, if (bltouch.high_speed_mode) bltouch.deploy()); // Deploy in HIGH SPEED MODE - if (!_lcd_level_bed_corners_probe()) { // Probe down to tolerance - if (_lcd_level_bed_corners_raise()) { // Prompt user to raise bed if needed - #if ENABLED(BED_TRAMMING_VERIFY_RAISED) // Verify - while (!_lcd_level_bed_corners_probe(true)) { // Loop while corner verified - if (!_lcd_level_bed_corners_raise()) { // Prompt user to raise bed if needed - if (corner_probing_done) return; // Done was selected + if (!_lcd_bed_tramming_probe()) { // Probe down to tolerance + if (_lcd_bed_tramming_raise()) { // Prompt user to raise bed if needed + #if ENABLED(BED_TRAMMING_VERIFY_RAISED) // Verify + while (!_lcd_bed_tramming_probe(true)) { // Loop while corner verified + if (!_lcd_bed_tramming_raise()) { // Prompt user to raise bed if needed + if (tramming_done) return; // Done was selected break; // Skip was selected } } #endif } - else if (corner_probing_done) // Done was selected + else if (tramming_done) // Done was selected return; } @@ -293,9 +315,9 @@ static void _lcd_level_bed_corners_get_next_position() { #if ENABLED(BLTOUCH) if (bltouch.high_speed_mode) { - // In HIGH SPEED MODE do clearance and stow at the very end - do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP); + // In HIGH SPEED MODE do stow and clearance at the very end bltouch.stow(); + do_z_clearance(BED_TRAMMING_Z_HOP); } #endif @@ -303,30 +325,29 @@ static void _lcd_level_bed_corners_get_next_position() { ui.set_selection(true); } -#else // !BED_TRAMMING_USE_PROBE +#endif // BED_TRAMMING_USE_PROBE - static void _lcd_goto_next_corner() { - line_to_z(BED_TRAMMING_Z_HOP); +void _lcd_bed_tramming_homing() { + if (!all_axes_homed() && TERN1(NEEDS_PROBE_DEPLOY, probe.deploy())) return; - // Select next corner coordinates - _lcd_level_bed_corners_get_next_position(); + #if HAS_LEVELING // Disable leveling so the planner won't mess with us + menu_leveling_was_active = planner.leveling_active; + set_bed_leveling_enabled(false); + #endif - line_to_current_position(manual_feedrate_mm_s.x); - line_to_z(BED_TRAMMING_HEIGHT); - if (++bed_corner >= available_points) bed_corner = 0; - } + #if ENABLED(BED_TRAMMING_USE_PROBE) -#endif // !BED_TRAMMING_USE_PROBE + if (!tramming_done) _lcd_test_corners(); // May set tramming_done + if (tramming_done) { + ui.goto_previous_screen_no_defer(); + TERN_(NEEDS_PROBE_DEPLOY, probe.stow(true)); + } + tramming_done = true; + TERN_(HAS_LEVELING, set_bed_leveling_enabled(menu_leveling_was_active)); + TERN_(BLTOUCH, endstops.enable_z_probe(false)); + + #else // !BED_TRAMMING_USE_PROBE -static void _lcd_level_bed_corners_homing() { - _lcd_draw_homing(); - if (!all_axes_homed()) return; - #if ENABLED(BED_TRAMMING_USE_PROBE) - _lcd_test_corners(); - if (corner_probing_done) ui.goto_previous_screen_no_defer(); - TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); - endstops.enable_z_probe(false); - #else bed_corner = 0; ui.goto_screen([]{ MenuItem_confirm::select_screen( @@ -334,7 +355,7 @@ static void _lcd_level_bed_corners_homing() { , _lcd_goto_next_corner , []{ line_to_z(BED_TRAMMING_Z_HOP); // Raise Z off the bed when done - TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); + TERN_(HAS_LEVELING, set_bed_leveling_enabled(menu_leveling_was_active)); ui.goto_previous_screen_no_defer(); } , GET_TEXT_F(TERN(BED_TRAMMING_INCLUDE_CENTER, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER)) @@ -343,23 +364,32 @@ static void _lcd_level_bed_corners_homing() { }); ui.set_selection(true); _lcd_goto_next_corner(); - #endif + + #endif // !BED_TRAMMING_USE_PROBE } -void _lcd_level_bed_corners() { - ui.defer_status_screen(); - if (!all_axes_trusted()) { - set_all_unhomed(); - queue.inject_P(G28_STR); +#if NEEDS_PROBE_DEPLOY + + void deploy_probe() { + if (!tramming_done) probe.deploy(true); + ui.goto_screen([]{ + if (ui.should_draw()) MenuItem_static::draw((LCD_HEIGHT - 1) / 2, GET_TEXT_F(MSG_MANUAL_DEPLOY)); + if (!probe.deploy() && !tramming_done) _lcd_bed_tramming_homing(); + }); } - // Disable leveling so the planner won't mess with us - #if HAS_LEVELING - leveling_was_active = planner.leveling_active; - set_bed_leveling_enabled(false); - #endif +#endif // NEEDS_PROBE_DEPLOY - ui.goto_screen(_lcd_level_bed_corners_homing); +void _lcd_bed_tramming() { + TERN_(BED_TRAMMING_USE_PROBE, tramming_done = false); + ui.defer_status_screen(); + set_all_unhomed(); + queue.inject(TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR))); + ui.goto_screen([]{ + _lcd_draw_homing(); + if (!all_axes_homed()) return; + TERN(NEEDS_PROBE_DEPLOY, deploy_probe(), ui.goto_screen(_lcd_bed_tramming_homing)); + }); } #endif // HAS_MARLINUI_MENU && LCD_BED_TRAMMING diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 5cc5f1114250..31868520024e 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -537,7 +537,7 @@ class MenuItem_bool : public MenuEditItemBase { #define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V) #if ENABLED(LCD_BED_TRAMMING) - void _lcd_level_bed_corners(); + void _lcd_bed_tramming(); #endif #if HAS_FAN @@ -555,6 +555,14 @@ class MenuItem_bool : public MenuEditItemBase { #define EDIT_EXTRA_FAN_SPEED(...) #endif + #if FAN_COUNT == 1 + #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED + #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED + #else + #define MSG_FIRST_FAN_SPEED MSG_FAN_SPEED_N + #define MSG_EXTRA_FIRST_FAN_SPEED MSG_EXTRA_FAN_SPEED_N + #endif + #define _FAN_EDIT_ITEMS(F,L) do{ \ editable.uint8 = thermalManager.fan_speed[F]; \ EDIT_ITEM_FAST_N(percent, F, MSG_##L, &editable.uint8, 0, 255, on_fan_update); \ diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 20ef6e3d198f..d43053da6256 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -109,10 +109,10 @@ void menu_media_filelist() { ui.encoder_direction_menus(); #if HAS_MARLINUI_U8GLIB - static uint16_t fileCnt; - if (ui.first_page) fileCnt = card.get_num_Files(); + static int16_t fileCnt; + if (ui.first_page) fileCnt = card.get_num_items(); #else - const uint16_t fileCnt = card.get_num_Files(); + const int16_t fileCnt = card.get_num_items(); #endif START_MENU(); @@ -129,9 +129,9 @@ void menu_media_filelist() { else if (card.isMounted()) ACTION_ITEM_F(F(LCD_STR_FOLDER " .."), lcd_sd_updir); - if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) { + if (ui.should_draw()) for (int16_t i = 0; i < fileCnt; i++) { if (_menuLineNr == _thisItemNr) { - card.getfilename_sorted(SD_ORDER(i, fileCnt)); + card.selectFileByIndexSorted(i); if (card.flag.filenameIsDir) MENU_ITEM(sdfolder, MSG_MEDIA_MENU, card); else diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index f18c5bbfebb9..f787d47d0f4d 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -112,7 +112,7 @@ static uint8_t v_index; #if HAS_DUAL_MIXING void _lcd_draw_mix(const uint8_t y) { char tmp[20]; // "100%_100%" - sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1])); + sprintf_P(tmp, PSTR("%3d%% %3d%% "), int(mixer.mix[0]), int(mixer.mix[1])); SETCURSOR(2, y); lcd_put_u8str(GET_TEXT_F(MSG_MIX)); SETCURSOR_RJ(10, y); lcd_put_u8str(tmp); } diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 6ce75d59aeb3..d5c1a8a38a9d 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -232,7 +232,7 @@ void menu_move() { else GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); - #if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD) + #if ANY(HAS_SWITCHING_EXTRUDER, HAS_SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD) #if EXTRUDERS >= 4 switch (active_extruder) { @@ -265,7 +265,7 @@ void menu_move() { #define SUBMENU_MOVE_E(N) SUBMENU_N(N, MSG_MOVE_EN, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(N); }, N); }); - #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) + #if HAS_SWITCHING_EXTRUDER || HAS_SWITCHING_NOZZLE // ...and the non-switching #if E_MANUAL == 7 || E_MANUAL == 5 || E_MANUAL == 3 @@ -411,7 +411,7 @@ void menu_motion() { #endif #if ENABLED(LCD_BED_TRAMMING) && DISABLED(LCD_BED_LEVELING) - SUBMENU(MSG_BED_TRAMMING, _lcd_level_bed_corners); + SUBMENU(MSG_BED_TRAMMING, _lcd_bed_tramming); #endif #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) diff --git a/Marlin/src/lcd/menu/menu_probe_offset.cpp b/Marlin/src/lcd/menu/menu_probe_offset.cpp index c7cbebaade82..428052bf2aff 100644 --- a/Marlin/src/lcd/menu/menu_probe_offset.cpp +++ b/Marlin/src/lcd/menu/menu_probe_offset.cpp @@ -51,7 +51,7 @@ inline void z_clearance_move() { void set_offset_and_go_back(const_float_t z) { probe.offset.z = z; SET_SOFT_ENDSTOP_LOOSE(false); - TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); + TERN_(HAS_LEVELING, set_bed_leveling_enabled(menu_leveling_was_active)); ui.goto_previous_screen_no_defer(); } @@ -143,7 +143,7 @@ void goto_probe_offset_wizard() { // Store Bed-Leveling-State and disable #if HAS_LEVELING - leveling_was_active = planner.leveling_active; + menu_leveling_was_active = planner.leveling_active; set_bed_leveling_enabled(false); #endif diff --git a/Marlin/src/lcd/menu/menu_tramming.cpp b/Marlin/src/lcd/menu/menu_tramming_wizard.cpp similarity index 92% rename from Marlin/src/lcd/menu/menu_tramming.cpp rename to Marlin/src/lcd/menu/menu_tramming_wizard.cpp index 1dd8a1cab6fd..4ce2cd646018 100644 --- a/Marlin/src/lcd/menu/menu_tramming.cpp +++ b/Marlin/src/lcd/menu/menu_tramming_wizard.cpp @@ -53,9 +53,7 @@ static int8_t reference_index; // = 0 #endif static bool probe_single_point() { - do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES)); - // Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety - const float z_probed_height = probe.probe_at_point(tramming_points[tram_index], TERN0(BLTOUCH, bltouch.high_speed_mode) ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, true); + const float z_probed_height = probe.probe_at_point(tramming_points[tram_index], PROBE_PT_RAISE, 0, true); z_measured[tram_index] = z_probed_height; if (reference_index < 0) reference_index = tram_index; move_to_tramming_wait_pos(); diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 8c4b2b1cfcd3..924760726969 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -156,37 +156,37 @@ void menu_tune() { #if HAS_FAN0 _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED); #endif - #if HAS_FAN1 + #if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1 FAN_EDIT_ITEMS(1); #elif SNFAN(1) singlenozzle_item(1); #endif - #if HAS_FAN2 + #if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2 FAN_EDIT_ITEMS(2); #elif SNFAN(2) singlenozzle_item(2); #endif - #if HAS_FAN3 + #if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3 FAN_EDIT_ITEMS(3); #elif SNFAN(3) singlenozzle_item(3); #endif - #if HAS_FAN4 + #if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4 FAN_EDIT_ITEMS(4); #elif SNFAN(4) singlenozzle_item(4); #endif - #if HAS_FAN5 + #if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5 FAN_EDIT_ITEMS(5); #elif SNFAN(5) singlenozzle_item(5); #endif - #if HAS_FAN6 + #if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6 FAN_EDIT_ITEMS(6); #elif SNFAN(6) singlenozzle_item(6); #endif - #if HAS_FAN7 + #if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7 FAN_EDIT_ITEMS(7); #elif SNFAN(7) singlenozzle_item(7); diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index a069b427c6bf..d1850a1eb2a1 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -46,7 +46,7 @@ float measured_z, z_offset; void xatc_wizard_done() { if (!ui.wait_for_move) { xatc.print_points(); - set_bed_leveling_enabled(leveling_was_active); + set_bed_leveling_enabled(menu_leveling_was_active); SET_SOFT_ENDSTOP_LOOSE(false); ui.goto_screen(menu_advanced_settings); } @@ -199,7 +199,7 @@ void xatc_wizard_homing() { void xatc_wizard_continue() { // Store Bed-Leveling-State and disable #if HAS_LEVELING - leveling_was_active = planner.leveling_active; + menu_leveling_was_active = planner.leveling_active; set_bed_leveling_enabled(false); #endif diff --git a/Marlin/src/lcd/tft/fontdata/Helvetica/Helvetica_19.cpp b/Marlin/src/lcd/tft/fontdata/Helvetica/Helvetica_19.cpp index 5b4570d010fa..ab2f91577a4d 100644 --- a/Marlin/src/lcd/tft/fontdata/Helvetica/Helvetica_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/Helvetica/Helvetica_19.cpp @@ -34,7 +34,8 @@ #include "../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define HELVETICA 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == HELVETICA #include diff --git a/Marlin/src/lcd/tft/fontdata/Helvetica/helvetica_14.cpp b/Marlin/src/lcd/tft/fontdata/Helvetica/helvetica_14.cpp index 44e7d40a2763..2fbf812369c4 100644 --- a/Marlin/src/lcd/tft/fontdata/Helvetica/helvetica_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/Helvetica/helvetica_14.cpp @@ -34,7 +34,8 @@ #include "../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define HELVETICA 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == HELVETICA #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_14.cpp index 9a5435176276..d9bdde8b2d2d 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_ASCII_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_ASCII_14.cpp index 3db57d8ebe09..0d452c94419d 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_ASCII_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_ASCII_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Cyrillic_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Cyrillic_14.cpp index f02086646c34..7c1fc2ac4e24 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Cyrillic_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Cyrillic_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Greek_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Greek_14.cpp index cbb789870d91..bb0cec7aca43 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Greek_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Greek_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Katakana_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Katakana_14.cpp index ae167c2c081d..eda142fef14d 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Katakana_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Katakana_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Korean_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Korean_14.cpp index 7d69f85f4a8e..258ccf879984 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Korean_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Korean_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Latin_Extended_A_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Latin_Extended_A_14.cpp index 4ff175700fc7..d736d12c1798 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Latin_Extended_A_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Latin_Extended_A_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Simplified_Chinese_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Simplified_Chinese_14.cpp index 01c7638e37d3..04825f3659d2 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Simplified_Chinese_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Simplified_Chinese_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Symbols_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Symbols_14.cpp index 07f3359dc491..a806753a97df 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Symbols_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Symbols_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Traditional_Chinese_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Traditional_Chinese_14.cpp index 63ea2fc74b8a..863d0c280514 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Traditional_Chinese_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Traditional_Chinese_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Vietnamese_14.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Vietnamese_14.cpp index dd6603f682e6..6a363582e1bc 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Vietnamese_14.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_14px/NotoSans_Medium_Vietnamese_14.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_16.cpp index 13699013382c..08ec0bf9d054 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_ASCII_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_ASCII_16.cpp index 0da231be38c7..cac0216a7581 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_ASCII_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_ASCII_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Cyrillic_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Cyrillic_16.cpp index 36ca1df54792..58ecea399fab 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Cyrillic_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Cyrillic_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Greek_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Greek_16.cpp index ff3ef3f8432d..f20b747cc479 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Greek_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Greek_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Katakana_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Katakana_16.cpp index a159a2694774..18c9345ca37a 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Katakana_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Katakana_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Korean_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Korean_16.cpp index 26e6799a8995..3839ed419e13 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Korean_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Korean_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Latin_Extended_A_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Latin_Extended_A_16.cpp index 0617ee275895..afce5184244b 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Latin_Extended_A_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Latin_Extended_A_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Simplified_Chinese_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Simplified_Chinese_16.cpp index cd9c617c7556..aa76df275a9d 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Simplified_Chinese_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Simplified_Chinese_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Symbols_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Symbols_16.cpp index ef20a4bcc6da..63a2a7d071fa 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Symbols_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Symbols_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Traditional_Chinese_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Traditional_Chinese_16.cpp index 177e741825c2..606625646bb6 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Traditional_Chinese_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Traditional_Chinese_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Vietnamese_16.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Vietnamese_16.cpp index 16cee9a7a29c..3905fba3e99e 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Vietnamese_16.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_16px/NotoSans_Medium_Vietnamese_16.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_19.cpp index c04f1c6d2d77..925254e7f858 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_ASCII_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_ASCII_19.cpp index 417db3946faf..97ef16cf4474 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_ASCII_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_ASCII_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Cyrillic_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Cyrillic_19.cpp index 413141c3b122..dba08111cec1 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Cyrillic_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Cyrillic_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Greek_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Greek_19.cpp index f4dcd225c85f..497e7fa8e86f 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Greek_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Greek_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Katakana_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Katakana_19.cpp index 3f8d4f761aaa..f5d92c5fd545 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Katakana_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Katakana_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Korean_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Korean_19.cpp index 7f030d656ddc..14a0073211f7 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Korean_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Korean_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Latin_Extended_A_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Latin_Extended_A_19.cpp index 00d90611fdcf..ccc23097fe1b 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Latin_Extended_A_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Latin_Extended_A_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Simplified_Chinese_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Simplified_Chinese_19.cpp index b5999beb7208..86621477e140 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Simplified_Chinese_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Simplified_Chinese_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Symbols_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Symbols_19.cpp index 5d2779308279..d28f2800d658 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Symbols_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Symbols_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Traditional_Chinese_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Traditional_Chinese_19.cpp index e5fd6077cc57..c34f5bb7f163 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Traditional_Chinese_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Traditional_Chinese_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Vietnamese_19.cpp b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Vietnamese_19.cpp index 1f77fbe87495..5ff24ab3b066 100644 --- a/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Vietnamese_19.cpp +++ b/Marlin/src/lcd/tft/fontdata/NotoSans/Medium_19px/NotoSans_Medium_Vietnamese_19.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define NOTOSANS 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == NOTOSANS #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_10.cpp index d22ee15a5f6e..2572cc60c42b 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_ASCII_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_ASCII_10.cpp index d4965cc061e2..27f3dcf3259d 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_ASCII_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_ASCII_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Cyrillic_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Cyrillic_10.cpp index 013a015ccaaa..1e112a1de1c9 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Cyrillic_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Cyrillic_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Greek_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Greek_10.cpp index 1febf8b5b3dd..71375485d28d 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Greek_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Greek_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Katakana_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Katakana_10.cpp index ae2819dba1a2..1e0d15629daa 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Katakana_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Katakana_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Korean_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Korean_10.cpp index e4516acac269..d1bf3ba514c6 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Korean_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Korean_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Latin_Extended_A_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Latin_Extended_A_10.cpp index 6059c6ccdd6c..8d381d276acb 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Latin_Extended_A_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Latin_Extended_A_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Simplified_Chinese_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Simplified_Chinese_10.cpp index b971dc92a0a0..3ce396d098ff 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Simplified_Chinese_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Simplified_Chinese_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Symbols_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Symbols_10.cpp index 9f804f7d69bb..8776bfba6c8a 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Symbols_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Symbols_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Traditional_Chinese_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Traditional_Chinese_10.cpp index 5f820cf8fc76..a9b1406441d7 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Traditional_Chinese_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Traditional_Chinese_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Vietnamese_10.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Vietnamese_10.cpp index 66ee7f01f621..d61d1be71bc6 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Vietnamese_10.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/10px/Unifont_Vietnamese_10.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_20.cpp index 9d6847722f44..023cc4f97816 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_ASCII_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_ASCII_20.cpp index 1e5d2280535c..e28b806b9fa1 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_ASCII_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_ASCII_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Cyrillic_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Cyrillic_20.cpp index 751b60c43ccc..8e82a228f1cd 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Cyrillic_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Cyrillic_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Greek_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Greek_20.cpp index fee79c3faef7..d5c175977a5d 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Greek_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Greek_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Katakana_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Katakana_20.cpp index f809a202592c..3b21375016e9 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Katakana_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Katakana_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Korean_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Korean_20.cpp index 7f750e7fa295..ac8dee91ef56 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Korean_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Korean_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Latin_Extended_A_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Latin_Extended_A_20.cpp index 49b80018261c..9a22047c9a91 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Latin_Extended_A_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Latin_Extended_A_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Simplified_Chinese_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Simplified_Chinese_20.cpp index 970d30bec73a..85e0d205d781 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Simplified_Chinese_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Simplified_Chinese_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Symbols_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Symbols_20.cpp index 5f663efc5640..a0d269e02f56 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Symbols_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Symbols_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Traditional_Chinese_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Traditional_Chinese_20.cpp index 70359bbc71c3..c541e1401d5d 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Traditional_Chinese_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Traditional_Chinese_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Vietnamese_20.cpp b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Vietnamese_20.cpp index 21fbc29d81ea..8c9b29153c17 100644 --- a/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Vietnamese_20.cpp +++ b/Marlin/src/lcd/tft/fontdata/Unifont/20px/Unifont_Vietnamese_20.cpp @@ -22,7 +22,8 @@ #include "../../../../../inc/MarlinConfigPre.h" -#if HAS_GRAPHICAL_TFT +#define UNIFONT 123 +#if HAS_GRAPHICAL_TFT && TFT_FONT == UNIFONT #include diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index cc800cddc38e..9482c85a4706 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -27,7 +27,7 @@ #include "touch.h" #include "../marlinui.h" // for ui methods -#include "../menu/menu_item.h" // for touch_screen_calibration +#include "../menu/menu_item.h" // for MSG_FIRST_FAN_SPEED #include "../../module/temperature.h" #include "../../module/planner.h" @@ -152,7 +152,7 @@ void Touch::touch(touch_control_t *control) { case CALIBRATE: if (touch_calibration.handleTouch(x, y)) ui.refresh(); break; - #endif // TOUCH_SCREEN_CALIBRATION + #endif case MENU_SCREEN: ui.goto_screen((screenFunc_t)control->data); break; case BACK: ui.goto_previous_screen(); break; diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index e8bec7e1a7ac..11e473023904 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -446,7 +446,7 @@ void MarlinUI::draw_status_screen() { #else 256, 130 #endif - , menu_main, imgSettings + , menu_main, imgSettings ); #if ENABLED(SDSUPPORT) const bool cm = card.isMounted(), pa = printingIsActive(); diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 705438e95be5..6fbde791548d 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -228,24 +228,24 @@ void MarlinUI::clear_lcd() { void MarlinUI::touch_calibration_screen() { uint16_t x, y; - calibrationState calibration_stage = touch_calibration.get_calibration_state(); + calibrationState stage = touch_calibration.get_calibration_state(); - if (calibration_stage == CALIBRATION_NONE) { + if (stage == CALIBRATION_NONE) { defer_status_screen(true); clear_lcd(); - calibration_stage = touch_calibration.calibration_start(); + stage = touch_calibration.calibration_start(); } else { - x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; - y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; + x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; + y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; tft.canvas(x - 15, y - 15, 31, 31); tft.set_background(COLOR_BACKGROUND); } touch.clear(); - if (calibration_stage < CALIBRATION_SUCCESS) { - switch (calibration_stage) { + if (stage < CALIBRATION_SUCCESS) { + switch (stage) { case CALIBRATION_TOP_LEFT: tft_string.set(GET_TEXT(MSG_TOP_LEFT)); break; case CALIBRATION_BOTTOM_LEFT: tft_string.set(GET_TEXT(MSG_BOTTOM_LEFT)); break; case CALIBRATION_TOP_RIGHT: tft_string.set(GET_TEXT(MSG_TOP_RIGHT)); break; @@ -253,8 +253,8 @@ void MarlinUI::clear_lcd() { default: break; } - x = touch_calibration.calibration_points[calibration_stage].x; - y = touch_calibration.calibration_points[calibration_stage].y; + x = touch_calibration.calibration_points[stage].x; + y = touch_calibration.calibration_points[stage].y; tft.canvas(x - 15, y - 15, 31, 31); tft.set_background(COLOR_BACKGROUND); @@ -264,7 +264,7 @@ void MarlinUI::clear_lcd() { touch.add_control(CALIBRATE, 0, 0, TFT_WIDTH, TFT_HEIGHT, uint32_t(x) << 16 | uint32_t(y)); } else { - tft_string.set(calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED)); + tft_string.set(stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED)); defer_status_screen(false); touch_calibration.calibration_end(); touch.add_control(BACK, 0, 0, TFT_WIDTH, TFT_HEIGHT); diff --git a/Marlin/src/lcd/tft_io/ili9328.h b/Marlin/src/lcd/tft_io/ili9328.h index b50517adfea5..823835f4483c 100644 --- a/Marlin/src/lcd/tft_io/ili9328.h +++ b/Marlin/src/lcd/tft_io/ili9328.h @@ -39,7 +39,7 @@ #define ILI9328_ETMOD_ID0 0x0010 // 0 - Horizontal Decrement / 1 - Horizontal Increment #define ILI9328_ETMOD_AM 0x0008 // 0 - Horizontal / 1 - Vertical -// MKS Robin TFT v1.1 - 320x240 ; Cable on the left side +// MKS Robin TFT v1.1 - 320x240 ; FPC cable on the left side #if TFT_ROTATION == TFT_ROTATE_180 #define ILI9328_DRVCTL_DATA 0x0000 diff --git a/Marlin/src/lcd/tft_io/ili9341.h b/Marlin/src/lcd/tft_io/ili9341.h index dda326df6d5b..4488287430bd 100644 --- a/Marlin/src/lcd/tft_io/ili9341.h +++ b/Marlin/src/lcd/tft_io/ili9341.h @@ -33,10 +33,10 @@ #define ILI9341_MADCTL_RGB 0x00 #define ILI9341_MADCTL_MH 0x04 // Horizontal Refresh Order -#define ILI9341_ORIENTATION_UP ILI9341_MADCTL_MY // 240x320 ; Cable on the upper side -#define ILI9341_ORIENTATION_RIGHT ILI9341_MADCTL_MV // 320x240 ; Cable on the right side -#define ILI9341_ORIENTATION_LEFT ILI9341_MADCTL_MY | ILI9341_MADCTL_MX | ILI9341_MADCTL_MV // 320x240 ; Cable on the left side -#define ILI9341_ORIENTATION_DOWN ILI9341_MADCTL_MX // 240x320 ; Cable on the upper side +#define ILI9341_ORIENTATION_TOP ILI9341_MADCTL_MY // 240x320 ; FPC cable on the top side +#define ILI9341_ORIENTATION_RIGHT ILI9341_MADCTL_MV // 320x240 ; FPC cable on the right side +#define ILI9341_ORIENTATION_LEFT ILI9341_MADCTL_MY | ILI9341_MADCTL_MX | ILI9341_MADCTL_MV // 320x240 ; FPC cable on the left side +#define ILI9341_ORIENTATION_BOTTOM ILI9341_MADCTL_MX // 240x320 ; FPC cable on the bottom side #define ILI9341_ORIENTATION IF_0((TFT_ORIENTATION) & TFT_EXCHANGE_XY, ILI9341_MADCTL_MV) | \ IF_0((TFT_ORIENTATION) & TFT_INVERT_X, ILI9341_MADCTL_MX) | \ @@ -52,7 +52,7 @@ #define ILI9341_NOP 0x00 // No Operation #define ILI9341_SWRESET 0x01 // Software Reset -#define ILI9341_RDDIDIF 0x04 // Read display identification information +#define ILI9341_RDDIDIF 0x04 // Read Display Identification Information #define ILI9341_RDDST 0x09 // Read Display Status #define ILI9341_RDDPM 0x0A // Read Display Power Mode #define ILI9341_RDDMADCTL 0x0B // Read Display MADCTL @@ -141,20 +141,21 @@ static const uint16_t ili9341_init[] = { DATASIZE_8BIT, ESC_REG(ILI9341_SWRESET), ESC_DELAY(100), ESC_REG(ILI9341_SLPOUT), ESC_DELAY(20), -/* - ESC_REG(ILI9341_PWCTRLA), 0x0039, 0x002C, 0x0000, 0x0034, 0x0002, // Power control A - ESC_REG(ILI9341_PWCTRLB), 0x0000, 0x00C1, 0x0030, // Power control B - ESC_REG(ILI9341_DRVTCTLA1), 0x0085, 0x0000, 0x0078, // Driver timing control A - ESC_REG(ILI9341_DRVTCTLB), 0x0000, 0x0000, // Driver timing control B - ESC_REG(ILI9341_PONSEQCTL), 0x0064, 0x0003, 0x0012, 0x0081, // Power on sequence control - ESC_REG(ILI9341_DISCTRL), 0x0008, 0x0082, 0x0027, // Display Function Control - ESC_REG(ILI9341_PUMPRCTL), 0x0020, // Pump ratio control - ESC_REG(ILI9341_VMCTRL1), 0x003E, 0x0028, // VCOM Control 1 - ESC_REG(ILI9341_VMCTRL2), 0x0086, // VCOM Control 2 - ESC_REG(ILI9341_FRMCTR1), 0x0000, 0x0018, // Frame Rate Control (In Normal Mode/Full Colors) - ESC_REG(ILI9341_PWCTRL1), 0x0023, // Power Control 1 - ESC_REG(ILI9341_PWCTRL2), 0x0010, // Power Control 2 -*/ + + ESC_REG(ILI9341_PWCTRLA), 0x0039, 0x002C, 0x0000, 0x0034, 0x0002, + ESC_REG(ILI9341_PWCTRLB), 0x0000, 0x00C1, 0x0030, + ESC_REG(ILI9341_DRVTCTLA1), 0x0085, 0x0000, 0x0078, + ESC_REG(ILI9341_DRVTCTLB), 0x0000, 0x0000, + ESC_REG(ILI9341_PONSEQCTL), 0x0064, 0x0003, 0x0012, 0x0081, + ESC_REG(ILI9341_DISCTRL), 0x0008, 0x0082, 0x0027, // Source Output Scan Direction: 0, Gate Output Scan Direction: 0 + ESC_REG(ILI9341_DINVOFF), + ESC_REG(ILI9341_PUMPRCTL), 0x0020, + ESC_REG(ILI9341_VMCTRL1), 0x003E, 0x0028, + ESC_REG(ILI9341_VMCTRL2), 0x0086, + ESC_REG(ILI9341_FRMCTR1), 0x0000, 0x0018, + ESC_REG(ILI9341_PWCTRL1), 0x0023, + ESC_REG(ILI9341_PWCTRL2), 0x0010, + ESC_REG(ILI9341_MADCTL), ILI9341_MADCTL_DATA, ESC_REG(ILI9341_PIXSET), 0x0055, diff --git a/Marlin/src/lcd/tft_io/ili9488.h b/Marlin/src/lcd/tft_io/ili9488.h index e71c0d16d775..fc2add662dbb 100644 --- a/Marlin/src/lcd/tft_io/ili9488.h +++ b/Marlin/src/lcd/tft_io/ili9488.h @@ -25,18 +25,18 @@ #include "../../inc/MarlinConfig.h" -#define ILI9488_MADCTL_MY 0x80 // Row Address Order -#define ILI9488_MADCTL_MX 0x40 // Column Address Order -#define ILI9488_MADCTL_MV 0x20 // Row/Column Exchange -#define ILI9488_MADCTL_ML 0x10 // Vertical Refresh Order -#define ILI9488_MADCTL_BGR 0x08 // RGB-BGR ORDER -#define ILI9488_MADCTL_RGB 0x00 -#define ILI9488_MADCTL_MH 0x04 // Horizontal Refresh Order +#define ILI9488_MADCTL_MY 0x80 // Row Address Order +#define ILI9488_MADCTL_MX 0x40 // Column Address Order +#define ILI9488_MADCTL_MV 0x20 // Row/Column Exchange +#define ILI9488_MADCTL_ML 0x10 // Vertical Refresh Order +#define ILI9488_MADCTL_BGR 0x08 // RGB-BGR ORDER +#define ILI9488_MADCTL_RGB 0x00 +#define ILI9488_MADCTL_MH 0x04 // Horizontal Refresh Order -#define ILI9488_ORIENTATION_UP ILI9488_MADCTL_MY // 320x480 ; Cable on the upper side -#define ILI9488_ORIENTATION_RIGHT ILI9488_MADCTL_MV // 480x320 ; Cable on the right side -#define ILI9488_ORIENTATION_LEFT ILI9488_MADCTL_MY | ILI9488_MADCTL_MX | ILI9488_MADCTL_MV // 480x320 ; Cable on the left side -#define ILI9488_ORIENTATION_DOWN ILI9488_MADCTL_MX // 320x480 ; Cable on the upper side +#define ILI9488_ORIENTATION_TOP ILI9488_MADCTL_MY // 320x480 ; FPC cable on the top side +#define ILI9488_ORIENTATION_RIGHT ILI9488_MADCTL_MV // 480x320 ; FPC cable on the right side +#define ILI9488_ORIENTATION_LEFT ILI9488_MADCTL_MY | ILI9488_MADCTL_MX | ILI9488_MADCTL_MV // 480x320 ; FPC cable on the left side +#define ILI9488_ORIENTATION_BOTTOM ILI9488_MADCTL_MX // 320x480 ; FPC cable on the bottom side #define ILI9488_ORIENTATION IF_0((TFT_ORIENTATION) & TFT_EXCHANGE_XY, ILI9488_MADCTL_MV) | \ IF_0((TFT_ORIENTATION) & TFT_INVERT_X, ILI9488_MADCTL_MX) | \ @@ -48,103 +48,113 @@ #define ILI9488_COLOR ILI9488_MADCTL_RGB #endif -#define ILI9488_MADCTL_DATA (ILI9488_ORIENTATION) | (ILI9488_COLOR) +#define ILI9488_MADCTL_DATA (ILI9488_ORIENTATION) | (ILI9488_COLOR) -#define ILI9488_NOP 0x00 // No Operation -#define ILI9488_SWRESET 0x01 // Software Reset -#define ILI9488_RDDIDIF 0x04 // Read Display Identification Information -#define ILI9488_RDNUMED 0x05 // Read Number of the Errors on DSI -#define ILI9488_RDDST 0x09 // Read Display Status -#define ILI9488_RDDPM 0x0A // Read Display Power Mode -#define ILI9488_RDDMADCTL 0x0B // Read Display MADCTL -#define ILI9488_RDDCOLMOD 0x0C // Read Display COLMOD -#define ILI9488_RDDIM 0x0D // Read Display Image Mode -#define ILI9488_RDDSM 0x0E // Read Display Signal Mode -#define ILI9488_RDDSDR 0x0F // Read Display Self-Diagnostic Result -#define ILI9488_SLPIN 0x10 // Sleep IN -#define ILI9488_SLPOUT 0x11 // Sleep OUT -#define ILI9488_PTLON 0x12 // Partial Mode ON -#define ILI9488_NORON 0x13 // Normal Display Mode ON -#define ILI9488_INVOFF 0x20 // Display Inversion OFF -#define ILI9488_INVON 0x21 // Display Inversion ON -#define ILI9488_ALLPOFF 0x22 // All Pixels OFF -#define ILI9488_ALLPON 0x23 // All Pixels ON -#define ILI9488_DISOFF 0x28 // Display OFF -#define ILI9488_DISON 0x29 // Display ON -#define ILI9488_CASET 0x2A // Column Address Set -#define ILI9488_PASET 0x2B // Page Address Set -#define ILI9488_RAMWR 0x2C // Memory Write -#define ILI9488_RAMRD 0x2E // Memory Read -#define ILI9488_PLTAR 0x30 // Partial Area -#define ILI9488_VSCRDEF 0x33 // Vertical Scrolling Definition -#define ILI9488_TEOFF 0x34 // Tearing Effect Line OFF -#define ILI9488_TEON 0x35 // Tearing Effect Line ON -#define ILI9488_MADCTL 0x36 // Memory Access Control -#define ILI9488_VSCRSADD 0x37 // Vertical Scrolling Start Address -#define ILI9488_IDMOFF 0x38 // Idle Mode OFF -#define ILI9488_IDMON 0x39 // Idle Mode ON -#define ILI9488_COLMOD 0x3A // Interface Pixel Format -#define ILI9488_RAMWRC 0x3C // Memory Write Continue -#define ILI9488_RAMRDRC 0x3E // Memory Read Continue -#define ILI9488_TESLWR 0x44 // Write Tear Scan Line -#define ILI9488_TESLRD 0x45 // Read Scan Line -#define ILI9488_WRDISBV 0x51 // Write Display Brightness Value -#define ILI9488_RDDISBV 0x52 // Read Display Brightness Value -#define ILI9488_WRCTRLD 0x53 // Write Control Display Value -#define ILI9488_RDCTRLD 0x54 // Read Control Display Value -#define ILI9488_WRCABC 0x55 // Write Content Adaptive Brightness Control Value -#define ILI9488_RDCABC 0x56 // Read Content Adaptive Brightness Control Value -#define ILI9488_WRCABCMB 0x5E // Write CABC Minimum Brightness -#define ILI9488_RDCABCMB 0x5F // Read CABC Minimum Brightness -#define ILI9488_RDABCSDR 0x68 // Read Automatic Brightness Control Self-diagnostic Result -#define ILI9488_RDID1 0xDA // Read ID1 -#define ILI9488_RDID2 0xDB // Read ID2 -#define ILI9488_RDID3 0xDC // Read ID3 +#define ILI9488_NOP 0x00 // No Operation +#define ILI9488_SWRESET 0x01 // Software Reset +#define ILI9488_RDDIDIF 0x04 // Read Display Identification Information +#define ILI9488_RDNUMED 0x05 // Read Number of the Errors on DSI +#define ILI9488_RDDST 0x09 // Read Display Status +#define ILI9488_RDDPM 0x0A // Read Display Power Mode +#define ILI9488_RDDMADCTL 0x0B // Read Display MADCTL +#define ILI9488_RDDCOLMOD 0x0C // Read Display COLMOD +#define ILI9488_RDDIM 0x0D // Read Display Image Mode +#define ILI9488_RDDSM 0x0E // Read Display Signal Mode +#define ILI9488_RDDSDR 0x0F // Read Display Self-Diagnostic Result +#define ILI9488_SLPIN 0x10 // Sleep IN +#define ILI9488_SLPOUT 0x11 // Sleep OUT +#define ILI9488_PTLON 0x12 // Partial Mode ON +#define ILI9488_NORON 0x13 // Normal Display Mode ON +#define ILI9488_INVOFF 0x20 // Display Inversion OFF +#define ILI9488_INVON 0x21 // Display Inversion ON +#define ILI9488_ALLPOFF 0x22 // All Pixels OFF +#define ILI9488_ALLPON 0x23 // All Pixels ON +#define ILI9488_DISOFF 0x28 // Display OFF +#define ILI9488_DISON 0x29 // Display ON +#define ILI9488_CASET 0x2A // Column Address Set +#define ILI9488_PASET 0x2B // Page Address Set +#define ILI9488_RAMWR 0x2C // Memory Write +#define ILI9488_RAMRD 0x2E // Memory Read +#define ILI9488_PLTAR 0x30 // Partial Area +#define ILI9488_VSCRDEF 0x33 // Vertical Scrolling Definition +#define ILI9488_TEOFF 0x34 // Tearing Effect Line OFF +#define ILI9488_TEON 0x35 // Tearing Effect Line ON +#define ILI9488_MADCTL 0x36 // Memory Access Control +#define ILI9488_VSCRSADD 0x37 // Vertical Scrolling Start Address +#define ILI9488_IDMOFF 0x38 // Idle Mode OFF +#define ILI9488_IDMON 0x39 // Idle Mode ON +#define ILI9488_COLMOD 0x3A // Interface Pixel Format +#define ILI9488_RAMWRC 0x3C // Memory Write Continue +#define ILI9488_RAMRDRC 0x3E // Memory Read Continue +#define ILI9488_TESLWR 0x44 // Write Tear Scan Line +#define ILI9488_TESLRD 0x45 // Read Scan Line +#define ILI9488_WRDISBV 0x51 // Write Display Brightness Value +#define ILI9488_RDDISBV 0x52 // Read Display Brightness Value +#define ILI9488_WRCTRLD 0x53 // Write Control Display Value +#define ILI9488_RDCTRLD 0x54 // Read Control Display Value +#define ILI9488_WRCABC 0x55 // Write Content Adaptive Brightness Control Value +#define ILI9488_RDCABC 0x56 // Read Content Adaptive Brightness Control Value +#define ILI9488_WRCABCMB 0x5E // Write CABC Minimum Brightness +#define ILI9488_RDCABCMB 0x5F // Read CABC Minimum Brightness +#define ILI9488_RDABCSDR 0x68 // Read Automatic Brightness Control Self-diagnostic Result +#define ILI9488_RDID1 0xDA // Read ID1 +#define ILI9488_RDID2 0xDB // Read ID2 +#define ILI9488_RDID3 0xDC // Read ID3 -#define ILI9488_IFMODE 0xB0 // Interface Mode Control -#define ILI9488_FRMCTR1 0xB1 // Frame Rate Control (In Normal Mode/Full Colors) -#define ILI9488_FRMCTR2 0xB2 // Frame Rate Control (In Idle Mode/8 Colors) -#define ILI9488_FRMCTR3 0xB3 // Frame Rate Control (In Partial Mode/Full Colors) -#define ILI9488_INVTR 0xB4 // Display Inversion Control -#define ILI9488_PRCTR 0xB5 // Blanking Porch Control -#define ILI9488_DISCTRL 0xB6 // Display Function Control -#define ILI9488_ETMOD 0xB7 // Entry Mode Set -#define ILI9488_CECTRL1 0xB9 // Color Enhancement Control 1 -#define ILI9488_CECTRL2 0xBA // Color Enhancement Control 2 -#define ILI9488_HSLCTRL 0xBE // HS Lanes Control -#define ILI9488_PWCTRL1 0xC0 // Power Control 1 -#define ILI9488_PWCTRL2 0xC1 // Power Control 2 -#define ILI9488_PWCTRL3 0xC2 // Power Control 3 (For Normal Mode) -#define ILI9488_PWCTRL4 0xC3 // Power Control 4 (For Idle Mode) -#define ILI9488_PWCTRL5 0xC4 // Power Control 5 (For Partial Mode) -#define ILI9488_VMCTRL 0xC5 // VCOM Control -#define ILI9488_CABCCTRL1 0xC6 // CABC Control 1 -#define ILI9488_CABCCTRL2 0xC8 // CABC Control 2 -#define ILI9488_CABCCTRL3 0xC9 // CABC Control 3 -#define ILI9488_CABCCTRL4 0xCA // CABC Control 4 -#define ILI9488_CABCCTRL5 0xCB // CABC Control 5 -#define ILI9488_CABCCTRL6 0xCC // CABC Control 6 -#define ILI9488_CABCCTRL7 0xCD // CABC Control 7 -#define ILI9488_CABCCTRL8 0xCE // CABC Control 8 -#define ILI9488_CABCCTRL9 0xCF // CABC Control 9 -#define ILI9488_NVMWR 0xD0 // NV Memory Write -#define ILI9488_NVMPKEY 0xD1 // NV Memory Protection Key -#define ILI9488_RDNVM 0xD2 // NV Memory Status Read -#define ILI9488_RDID4 0xD3 // Read ID4 - 0x009488 -#define ILI9488_ADJCTL1 0xD7 // Adjust Control 1 -#define ILI9488_RDIDV 0xD8 // Read ID Version -#define ILI9488_PGAMCTRL 0xE0 // Positive Gamma Control -#define ILI9488_NGAMCTRL 0xE1 // Negative Gamma Control -#define ILI9488_DGAMCTRL1 0xE2 // Ditigal Gamma Control 1 -#define ILI9488_DGAMCTRL2 0xE3 // Ditigal Gamma Control 2 -#define ILI9488_SETIMAGE 0xE9 // Set Image Function -#define ILI9488_ADJCTL2 0xF2 // Adjust Control 2 -#define ILI9488_ADJCTL3 0xF7 // Adjust Control 3 -#define ILI9488_ADJCTL4 0xF8 // Adjust Control 4 -#define ILI9488_ADJCTL5 0xF9 // Adjust Control 5 -#define ILI9488_RDEXTC 0xFB // Read EXTC command is SPI mode -#define ILI9488_ADJCTL6 0xFC // Adjust Control 6 -#define ILI9488_ADJCTL7 0xFF // Adjust Control 7 +#define ILI9488_IFMODE 0xB0 // Interface Mode Control +#define ILI9488_FRMCTR1 0xB1 // Frame Rate Control (In Normal Mode/Full Colors) +#define ILI9488_FRMCTR2 0xB2 // Frame Rate Control (In Idle Mode/8 Colors) +#define ILI9488_FRMCTR3 0xB3 // Frame Rate Control (In Partial Mode/Full Colors) +#define ILI9488_INVTR 0xB4 // Display Inversion Control +#define ILI9488_PRCTR 0xB5 // Blanking Porch Control +#define ILI9488_DISCTRL 0xB6 // Display Function Control +#define ILI9488_ETMOD 0xB7 // Entry Mode Set +#define ILI9488_CECTRL1 0xB9 // Color Enhancement Control 1 +#define ILI9488_CECTRL2 0xBA // Color Enhancement Control 2 +#define ILI9488_HSLCTRL 0xBE // HS Lanes Control +#define ILI9488_PWCTRL1 0xC0 // Power Control 1 +#define ILI9488_PWCTRL2 0xC1 // Power Control 2 +#define ILI9488_PWCTRL3 0xC2 // Power Control 3 (For Normal Mode) +#define ILI9488_PWCTRL4 0xC3 // Power Control 4 (For Idle Mode) +#define ILI9488_PWCTRL5 0xC4 // Power Control 5 (For Partial Mode) +#define ILI9488_VMCTRL 0xC5 // VCOM Control +#define ILI9488_CABCCTRL1 0xC6 // CABC Control 1 +#define ILI9488_CABCCTRL2 0xC8 // CABC Control 2 +#define ILI9488_CABCCTRL3 0xC9 // CABC Control 3 +#define ILI9488_CABCCTRL4 0xCA // CABC Control 4 +#define ILI9488_CABCCTRL5 0xCB // CABC Control 5 +#define ILI9488_CABCCTRL6 0xCC // CABC Control 6 +#define ILI9488_CABCCTRL7 0xCD // CABC Control 7 +#define ILI9488_CABCCTRL8 0xCE // CABC Control 8 +#define ILI9488_CABCCTRL9 0xCF // CABC Control 9 +#define ILI9488_NVMWR 0xD0 // NV Memory Write +#define ILI9488_NVMPKEY 0xD1 // NV Memory Protection Key +#define ILI9488_RDNVM 0xD2 // NV Memory Status Read +#define ILI9488_RDID4 0xD3 // Read ID4 - 0x009488 +#define ILI9488_ADJCTL1 0xD7 // Adjust Control 1 +#define ILI9488_RDIDV 0xD8 // Read ID Version +#define ILI9488_PGAMCTRL 0xE0 // Positive Gamma Control +#define ILI9488_NGAMCTRL 0xE1 // Negative Gamma Control +#define ILI9488_DGAMCTRL1 0xE2 // Ditigal Gamma Control 1 +#define ILI9488_DGAMCTRL2 0xE3 // Ditigal Gamma Control 2 +#define ILI9488_SETIMAGE 0xE9 // Set Image Function +#define ILI9488_ADJCTL2 0xF2 // Adjust Control 2 +#define ILI9488_ADJCTL3 0xF7 // Adjust Control 3 +#define ILI9488_ADJCTL4 0xF8 // Adjust Control 4 +#define ILI9488_ADJCTL5 0xF9 // Adjust Control 5 +#define ILI9488_RDEXTC 0xFB // Read EXTC command is SPI mode +#define ILI9488_ADJCTL6 0xFC // Adjust Control 6 +#define ILI9488_ADJCTL7 0xFF // Adjust Control 7 + +#if 0 + // https://forum.mikroe.com/viewtopic.php?t=74586 + #if ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 + #define TFT_DRIVER ILI9488 + #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) + #define TFT_RES_480x320 + #define TFT_INTERFACE_FSMC + #endif +#endif static const uint16_t ili9488_init[] = { DATASIZE_8BIT, @@ -154,10 +164,20 @@ static const uint16_t ili9488_init[] = { ESC_REG(ILI9488_MADCTL), ILI9488_MADCTL_DATA, ESC_REG(ILI9488_COLMOD), 0x0055, + ESC_REG(ILI9488_FRMCTR1), 0x00A0, + ESC_REG(ILI9488_INVTR), 0x0002, + ESC_REG(ILI9488_DISCTRL), 0x0002, 0x0002, // Gate Scan sequence: 0, Source Scan sequence: 0 + ESC_REG(ILI9488_PWCTRL1), 0x0015, 0x0017, + ESC_REG(ILI9488_PWCTRL2), 0x0041, + ESC_REG(ILI9488_VMCTRL), 0x0000, 0x0012, 0x0080, + ESC_REG(ILI9488_SETIMAGE), 0x0000, + ESC_REG(ILI9488_ADJCTL3), 0x00A9, 0x0051, 0x002C, 0x0082, + /* Gamma Correction. */ ESC_REG(ILI9488_PGAMCTRL), 0x0000, 0x0003, 0x0009, 0x0008, 0x0016, 0x000A, 0x003F, 0x0078, 0x004C, 0x0009, 0x000A, 0x0008, 0x0016, 0x001A, 0x000F, ESC_REG(ILI9488_NGAMCTRL), 0x0000, 0x0016, 0x0019, 0x0003, 0x000F, 0x0005, 0x0032, 0x0045, 0x0046, 0x0004, 0x000E, 0x000D, 0x0035, 0x0037, 0x000F, + ESC_REG(TERN(ILI9488_INVERTED, ILI9488_INVON, ILI9488_INVOFF)), // Display inversion ESC_REG(ILI9488_NORON), ESC_REG(ILI9488_DISON), ESC_END diff --git a/Marlin/src/lcd/tft_io/r65105.h b/Marlin/src/lcd/tft_io/r65105.h index 8be2afe4423c..4cc8c999426e 100644 --- a/Marlin/src/lcd/tft_io/r65105.h +++ b/Marlin/src/lcd/tft_io/r65105.h @@ -41,7 +41,7 @@ #define R61505_DRVCTRL_GS 0x8000 // Gate Scan direction -// MKS Robin TFT v1.1 - 320x240 ; Cable on the left side +// MKS Robin TFT v1.1 - 320x240 ; FPC cable on the left side #if TFT_ROTATION == TFT_ROTATE_180 #define R61505_DRVCTL_DATA 0x0000 diff --git a/Marlin/src/lcd/tft_io/st7789v.h b/Marlin/src/lcd/tft_io/st7789v.h index d0cf969c66ce..690e53071762 100644 --- a/Marlin/src/lcd/tft_io/st7789v.h +++ b/Marlin/src/lcd/tft_io/st7789v.h @@ -33,10 +33,11 @@ #define ST7789V_MADCTL_RGB 0x00 #define ST7789V_MADCTL_MH 0x04 // Horizontal Refresh Order -#define ST7789V_ORIENTATION_UP ST7789V_MADCTL_MX | ST7789V_MADCTL_MY // 240x320 ; Cable on the upper side -#define ST7789V_ORIENTATION_RIGHT ST7789V_MADCTL_MX | ST7789V_MADCTL_MV // 320x240 ; Cable on the right side -#define ST7789V_ORIENTATION_LEFT ST7789V_MADCTL_MY | ST7789V_MADCTL_MV // 320x240 ; Cable on the left side -#define ST7789V_ORIENTATION_DOWN 0 // 240x320 ; Cable on the lower side +// ST7789V-specific: "MX Inversion" is enabled by default in LCM Control register. +#define ST7789V_ORIENTATION_TOP ST7789V_MADCTL_MX | ST7789V_MADCTL_MY // 240x320 ; PFC cable on the top side +#define ST7789V_ORIENTATION_RIGHT ST7789V_MADCTL_MX | ST7789V_MADCTL_MV // 320x240 ; PFC cable on the right side +#define ST7789V_ORIENTATION_LEFT ST7789V_MADCTL_MY | ST7789V_MADCTL_MV // 320x240 ; PFC cable on the left side +#define ST7789V_ORIENTATION_BOTTOM 0 // 240x320 ; PFC cable on the bottom side #define ST7789V_ORIENTATION IF_0((TFT_ORIENTATION) & TFT_EXCHANGE_XY, ST7789V_MADCTL_MV) | \ IF_0((TFT_ORIENTATION) & TFT_INVERT_X, ST7789V_MADCTL_MX) | \ @@ -141,7 +142,22 @@ static const uint16_t st7789v_init[] = { ESC_REG(ST7789V_PORCTRL), 0x000C, 0x000C, 0x0000, 0x0033, 0x0033, ESC_REG(ST7789V_GCTRL), 0x0035, ESC_REG(ST7789V_VCOMS), 0x001F, - ESC_REG(ST7789V_LCMCTRL), 0x002C, + + /** + * LCM Control + * + * Default Power-on Value: 0x2C / 00101100b + * MY Inversion: 0 + * RGB/BGR Inversion: 1 + * Display Inversion: 0 + * MX Inversion: 1 + * MH (Source Output) Inversion: 1 + * MV Inversion: 0 + * Gate Scan Inversion: 0 + */ + ESC_REG(ST7789V_LCMCTRL), 0x002C, // Default Power-on Value + ESC_REG(ST7789V_GATECTRL), 0x0027, 0x0000, 0x0010, // Gate Scan Direction: 0 + ESC_REG(ST7789V_VDVVRHEN), 0x0001, 0x00C3, ESC_REG(ST7789V_VDVS), 0x0020, ESC_REG(ST7789V_FRCTRL2), 0x000F, diff --git a/Marlin/src/lcd/tft_io/st7796s.h b/Marlin/src/lcd/tft_io/st7796s.h index 6d79dd882ac2..bca8d602ef2a 100644 --- a/Marlin/src/lcd/tft_io/st7796s.h +++ b/Marlin/src/lcd/tft_io/st7796s.h @@ -33,6 +33,11 @@ #define ST7796S_MADCTL_RGB 0x00 #define ST7796S_MADCTL_MH 0x04 // Horizontal Refresh Order +#define ST7796S_ORIENTATION_TOP ST7796S_MADCTL_MX // 320x480 ; FPC cable on the top side +#define ST7796S_ORIENTATION_RIGHT ST7796S_MADCTL_MV // 480x320 ; FPC cable on the right side +#define ST7796S_ORIENTATION_LEFT ST7796S_MADCTL_MY | ST7796S_MADCTL_MX | ST7796S_MADCTL_MV // 480x320 ; FPC cable on the left side +#define ST7796S_ORIENTATION_BOTTOM ST7796S_MADCTL_MY // 320x480 ; FPC cable on the bottom side + #define ST7796S_ORIENTATION IF_0((TFT_ORIENTATION) & TFT_EXCHANGE_XY, ST7796S_MADCTL_MV) | \ IF_0((TFT_ORIENTATION) & TFT_INVERT_X, ST7796S_MADCTL_MX) | \ IF_0((TFT_ORIENTATION) & TFT_INVERT_Y, ST7796S_MADCTL_MY) @@ -132,6 +137,7 @@ static const uint16_t st7796s_init[] = { ESC_REG(ST7796S_COLMOD), 0x0055, ESC_REG(ST7796S_DIC), 0x0001, // 1-dot inversion + ESC_REG(ST7796S_DFC), 0x0080, 0x0002, 0x003B, // Source Output Scan Direction: 0, Gate Output Scan Direction: 0 ESC_REG(ST7796S_EM), 0x00C6, ESC_REG(ST7796S_PWR2), 0x0015, @@ -144,11 +150,7 @@ static const uint16_t st7796s_init[] = { ESC_REG(ST7796S_PGC), 0x00F0, 0x0004, 0x0008, 0x0009, 0x0008, 0x0015, 0x002F, 0x0042, 0x0046, 0x0028, 0x0015, 0x0016, 0x0029, 0x002D, ESC_REG(ST7796S_NGC), 0x00F0, 0x0004, 0x0009, 0x0009, 0x0008, 0x0015, 0x002E, 0x0046, 0x0046, 0x0028, 0x0015, 0x0015, 0x0029, 0x002D, - #if ENABLED(ST7796S_INVERTED) - ESC_REG(ST7796S_INVON), // Display inversion ON - #else - ESC_REG(ST7796S_NORON), - #endif + ESC_REG(TERN(ST7796S_INVERTED, ST7796S_INVON, ST7796S_NORON)), // Display inversion ESC_REG(ST7796S_WRCTRLD), 0x0024, ESC_REG(ST7796S_CSCON), 0x003C, // disable command 2 part I ESC_REG(ST7796S_CSCON), 0x0069, // disable command 2 part II diff --git a/Marlin/src/lcd/tft_io/tft_io.h b/Marlin/src/lcd/tft_io/tft_io.h index 9cfb2137df5e..7dd973ef704e 100644 --- a/Marlin/src/lcd/tft_io/tft_io.h +++ b/Marlin/src/lcd/tft_io/tft_io.h @@ -62,7 +62,7 @@ class TFT_IO { inline static void Abort() { io.Abort(); } inline static uint32_t GetID() { return io.GetID(); } - inline static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); } + inline static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); } inline static void DataTransferEnd() { io.DataTransferEnd(); } inline static void WriteData(uint16_t Data) { io.WriteData(Data); } diff --git a/Marlin/src/lcd/tft_io/tft_orientation.h b/Marlin/src/lcd/tft_io/tft_orientation.h index 7822fc6b04f2..c2c86435b2c0 100644 --- a/Marlin/src/lcd/tft_io/tft_orientation.h +++ b/Marlin/src/lcd/tft_io/tft_orientation.h @@ -59,9 +59,9 @@ #define TFT_COLOR_BGR _BV32(4) // Each TFT Driver is responsible for its default color mode. -// #ifndef TFT_COLOR -// #define TFT_COLOR TFT_COLOR_RGB -// #endif +//#ifndef TFT_COLOR +// #define TFT_COLOR TFT_COLOR_RGB +//#endif #define TOUCH_ORIENTATION_NONE 0 #define TOUCH_LANDSCAPE 1 @@ -82,4 +82,3 @@ #ifndef TOUCH_ORIENTATION #define TOUCH_ORIENTATION TOUCH_LANDSCAPE #endif - diff --git a/Marlin/src/lcd/tft_io/touch_calibration.cpp b/Marlin/src/lcd/tft_io/touch_calibration.cpp index 44ebc73d71a2..c239a94b41f9 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.cpp +++ b/Marlin/src/lcd/tft_io/touch_calibration.cpp @@ -41,6 +41,7 @@ touch_calibration_t TouchCalibration::calibration; calibrationState TouchCalibration::calibration_state = CALIBRATION_NONE; touch_calibration_point_t TouchCalibration::calibration_points[4]; uint8_t TouchCalibration::failed_count; +millis_t TouchCalibration::next_touch_update_ms; // = 0; void TouchCalibration::validate_calibration() { #define VALIDATE_PRECISION(XY, A, B) validate_precision_##XY(CALIBRATION_##A, CALIBRATION_##B) @@ -74,7 +75,7 @@ void TouchCalibration::validate_calibration() { else { calibration_state = CALIBRATION_FAIL; calibration_reset(); - if (need_calibration() && failed_count++ < TOUCH_CALIBRATION_MAX_RETRIES) calibration_state = CALIBRATION_TOP_LEFT; + if (need_calibration() && failed_count++ < TOUCH_CALIBRATION_MAX_RETRIES) calibration_state = CALIBRATION_NONE; } #undef CAL_PTS @@ -89,11 +90,11 @@ void TouchCalibration::validate_calibration() { } } -bool TouchCalibration::handleTouch(uint16_t x, uint16_t y) { - static millis_t next_button_update_ms = 0; +bool TouchCalibration::handleTouch(const uint16_t x, const uint16_t y) { const millis_t now = millis(); - if (PENDING(now, next_button_update_ms)) return false; - next_button_update_ms = now + BUTTON_DELAY_MENU; + + if (next_touch_update_ms && PENDING(now, next_touch_update_ms)) return false; + next_touch_update_ms = now + BUTTON_DELAY_MENU; if (calibration_state < CALIBRATION_SUCCESS) { calibration_points[calibration_state].raw_x = x; diff --git a/Marlin/src/lcd/tft_io/touch_calibration.h b/Marlin/src/lcd/tft_io/touch_calibration.h index abd566770007..030b4977db51 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.h +++ b/Marlin/src/lcd/tft_io/touch_calibration.h @@ -57,6 +57,7 @@ class TouchCalibration { public: static calibrationState calibration_state; static touch_calibration_point_t calibration_points[4]; + static millis_t next_touch_update_ms; static bool validate_precision(int32_t a, int32_t b) { return (a > b ? (100 * b) / a : (100 * a) / b) > TOUCH_SCREEN_CALIBRATION_PRECISION; } static bool validate_precision_x(uint8_t a, uint8_t b) { return validate_precision(calibration_points[a].raw_x, calibration_points[b].raw_x); } @@ -64,11 +65,12 @@ class TouchCalibration { static void validate_calibration(); static touch_calibration_t calibration; - static uint8_t failed_count; + static uint8_t failed_count; static void calibration_reset() { calibration = { TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y, TOUCH_OFFSET_X, TOUCH_OFFSET_Y, TOUCH_ORIENTATION }; } static bool need_calibration() { return !calibration.offset_x && !calibration.offset_y && !calibration.x && !calibration.y; } static calibrationState calibration_start() { + next_touch_update_ms = millis() + 750UL; calibration = { 0, 0, 0, 0, TOUCH_ORIENTATION_NONE }; calibration_state = CALIBRATION_TOP_LEFT; calibration_points[CALIBRATION_TOP_LEFT].x = 30; @@ -89,7 +91,7 @@ class TouchCalibration { return !need_calibration(); } - static bool handleTouch(uint16_t x, uint16_t y); + static bool handleTouch(const uint16_t x, const uint16_t y); }; extern TouchCalibration touch_calibration; diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index d641dd3b1c92..08554de0d3ca 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -91,7 +91,7 @@ uint8_t TouchButtons::read_buttons() { y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y; #endif #elif ENABLED(TFT_TOUCH_DEVICE_GT911) - bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? touchIO.getPoint(&y, &x) : touchIO.getPoint(&x, &y)); + const bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? touchIO.getPoint(&y, &x) : touchIO.getPoint(&x, &y)); if (!is_touched) return 0; #endif diff --git a/Marlin/src/libs/buzzer.h b/Marlin/src/libs/buzzer.h index cd8e17d00463..aa4d48ae5dd1 100644 --- a/Marlin/src/libs/buzzer.h +++ b/Marlin/src/libs/buzzer.h @@ -27,7 +27,9 @@ #include "circularqueue.h" - #define TONE_QUEUE_LENGTH 4 + #ifndef TONE_QUEUE_LENGTH + #define TONE_QUEUE_LENGTH 4 + #endif /** * @brief Tone structure diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 575e74a81472..74f61c33d018 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -225,38 +225,43 @@ Nozzle nozzle; #if ENABLED(NOZZLE_PARK_FEATURE) - float Nozzle::park_mode_0_height(const_float_t park_z) { - // Apply a minimum raise, if specified. Use park.z as a minimum height instead. - return _MAX(park_z, // Minimum height over 0 based on input - _MIN(Z_MAX_POS, // Maximum height is fixed - #ifdef NOZZLE_PARK_Z_RAISE_MIN - NOZZLE_PARK_Z_RAISE_MIN + // Minimum raise... - #endif - current_position.z // ...over current position - ) - ); - } + #if HAS_Z_AXIS + float Nozzle::park_mode_0_height(const_float_t park_z) { + // Apply a minimum raise, if specified. Use park.z as a minimum height instead. + return _MAX(park_z, // Minimum height over 0 based on input + _MIN(Z_MAX_POS, // Maximum height is fixed + #ifdef NOZZLE_PARK_Z_RAISE_MIN + NOZZLE_PARK_Z_RAISE_MIN + // Minimum raise... + #endif + current_position.z // ...over current position + ) + ); + } + #endif // HAS_Z_AXIS void Nozzle::park(const uint8_t z_action, const xyz_pos_t &park/*=NOZZLE_PARK_POINT*/) { - constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE, fr_z = NOZZLE_PARK_Z_FEEDRATE; + #if HAS_Z_AXIS + constexpr feedRate_t fr_z = NOZZLE_PARK_Z_FEEDRATE; - switch (z_action) { - case 1: // Go to Z-park height - do_blocking_move_to_z(park.z, fr_z); - break; + switch (z_action) { + case 1: // Go to Z-park height + do_blocking_move_to_z(park.z, fr_z); + break; - case 2: // Raise by Z-park height - do_blocking_move_to_z(_MIN(current_position.z + park.z, Z_MAX_POS), fr_z); - break; + case 2: // Raise by Z-park height + do_blocking_move_to_z(_MIN(current_position.z + park.z, Z_MAX_POS), fr_z); + break; - default: // Raise by NOZZLE_PARK_Z_RAISE_MIN, use park.z as a minimum height - do_blocking_move_to_z(park_mode_0_height(park.z), fr_z); - break; - } + default: // Raise by NOZZLE_PARK_Z_RAISE_MIN, use park.z as a minimum height + do_blocking_move_to_z(park_mode_0_height(park.z), fr_z); + break; + } + #endif // HAS_Z_AXIS #ifndef NOZZLE_PARK_MOVE #define NOZZLE_PARK_MOVE 0 #endif + constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE; switch (NOZZLE_PARK_MOVE) { case 0: do_blocking_move_to_xy(park, fr_xy); break; case 1: do_blocking_move_to_x(park.x, fr_xy); break; diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp index c28d1246d693..2938229a7ae1 100644 --- a/Marlin/src/libs/numtostr.cpp +++ b/Marlin/src/libs/numtostr.cpp @@ -28,7 +28,7 @@ char conv[9] = { 0 }; #define DIGIT(n) ('0' + (n)) -#define DIGIMOD(n, f) DIGIT((n)/(f) % 10) +#define DIGIMOD(n, f) DIGIT(((n)/(f)) % 10) #define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ') #define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-')) #define INTFLOAT(V,N) (((V) * 10 * pow(10, N) + ((V) < 0 ? -5: 5)) / 10) // pow10? @@ -423,3 +423,34 @@ const char* ftostr52sp(const_float_t f) { } return &conv[1]; } + +// Convert unsigned 16bit int to string 1, 12, 123 format, capped at 999 +const char* utostr3(const uint16_t x) { + return i16tostr3left(_MIN(x, 999U)); +} + +// Convert signed float to space-padded string with 1.23, 12.34, 123.45 format +const char* ftostr52sprj(const_float_t f) { + long i = INTFLOAT(f, 2); + LIMIT(i, -99999, 99999); // cap to -999.99 - 999.99 range + if (WITHIN(i, -999, 999)) { // -9.99 - 9.99 range + conv[1] = conv[2] = ' '; // default to ' ' for smaller numbers + conv[3] = MINUSOR(i, ' '); + } + else if (WITHIN(i, -9999, 9999)) { // -99.99 - 99.99 range + conv[1] = ' '; + conv[2] = MINUSOR(i, ' '); + conv[3] = DIGIMOD(i, 1000); + } + else { // -999.99 - 999.99 range + conv[1] = MINUSOR(i, ' '); + conv[2] = DIGIMOD(i, 10000); + conv[3] = DIGIMOD(i, 1000); + } + conv[4] = DIGIMOD(i, 100); // always convert last 3 digits + conv[5] = '.'; + conv[6] = DIGIMOD(i, 10); + conv[7] = DIGIMOD(i, 1); + + return &conv[1]; +} diff --git a/Marlin/src/libs/numtostr.h b/Marlin/src/libs/numtostr.h index 0c8ce0f79a1f..31e8db004884 100644 --- a/Marlin/src/libs/numtostr.h +++ b/Marlin/src/libs/numtostr.h @@ -129,3 +129,9 @@ FORCE_INLINE const char* ftostr3(const_float_t x) { return i16tostr3rj(int16_t(x // Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format FORCE_INLINE const char* ftostr4sign(const_float_t x) { return i16tostr4signrj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } #endif + +// Convert unsigned int to string 1, 12, 123 format, capped at 999 +const char* utostr3(const uint16_t x); + +// Convert signed float to space-padded string with 1.23, 12.34, 123.45 format +const char* ftostr52sprj(const_float_t f); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index ef5f5d06e120..6719925f15fa 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -109,284 +109,90 @@ Endstops::endstop_mask_t Endstops::live_state = 0; void Endstops::init() { + #define _INIT_ENDSTOP(T,A,N) TERN(ENDSTOPPULLUP_##A##T, SET_INPUT_PULLUP, TERN(ENDSTOPPULLDOWN_##A##T, SET_INPUT_PULLDOWN, SET_INPUT))(A##N##_##T##_PIN) #if HAS_X_MIN - #if ENABLED(ENDSTOPPULLUP_XMIN) - SET_INPUT_PULLUP(X_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMIN) - SET_INPUT_PULLDOWN(X_MIN_PIN); - #else - SET_INPUT(X_MIN_PIN); - #endif - #endif - - #if HAS_X2_MIN - #if ENABLED(ENDSTOPPULLUP_XMIN) - SET_INPUT_PULLUP(X2_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMIN) - SET_INPUT_PULLDOWN(X2_MIN_PIN); - #else - SET_INPUT(X2_MIN_PIN); - #endif - #endif - - #if HAS_Y_MIN - #if ENABLED(ENDSTOPPULLUP_YMIN) - SET_INPUT_PULLUP(Y_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMIN) - SET_INPUT_PULLDOWN(Y_MIN_PIN); - #else - SET_INPUT(Y_MIN_PIN); - #endif - #endif - - #if HAS_Y2_MIN - #if ENABLED(ENDSTOPPULLUP_YMIN) - SET_INPUT_PULLUP(Y2_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMIN) - SET_INPUT_PULLDOWN(Y2_MIN_PIN); - #else - SET_INPUT(Y2_MIN_PIN); - #endif - #endif - - #if HAS_Z_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z_MIN_PIN); - #else - SET_INPUT(Z_MIN_PIN); - #endif - #endif - - #if HAS_Z2_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z2_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z2_MIN_PIN); - #else - SET_INPUT(Z2_MIN_PIN); - #endif - #endif - - #if HAS_Z3_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z3_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z3_MIN_PIN); - #else - SET_INPUT(Z3_MIN_PIN); - #endif - #endif - - #if HAS_Z4_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z4_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z4_MIN_PIN); - #else - SET_INPUT(Z4_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,X,); #endif - #if HAS_X_MAX - #if ENABLED(ENDSTOPPULLUP_XMAX) - SET_INPUT_PULLUP(X_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMAX) - SET_INPUT_PULLDOWN(X_MAX_PIN); - #else - SET_INPUT(X_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,X,); + #endif + #if HAS_X2_MIN + _INIT_ENDSTOP(MIN,X,2); #endif - #if HAS_X2_MAX - #if ENABLED(ENDSTOPPULLUP_XMAX) - SET_INPUT_PULLUP(X2_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMAX) - SET_INPUT_PULLDOWN(X2_MAX_PIN); - #else - SET_INPUT(X2_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,X,2); + #endif + #if HAS_Y_MIN + _INIT_ENDSTOP(MIN,Y,); #endif - #if HAS_Y_MAX - #if ENABLED(ENDSTOPPULLUP_YMAX) - SET_INPUT_PULLUP(Y_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMAX) - SET_INPUT_PULLDOWN(Y_MAX_PIN); - #else - SET_INPUT(Y_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,Y,); + #endif + #if HAS_Y2_MIN + _INIT_ENDSTOP(MIN,Y,2); #endif - #if HAS_Y2_MAX - #if ENABLED(ENDSTOPPULLUP_YMAX) - SET_INPUT_PULLUP(Y2_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMAX) - SET_INPUT_PULLDOWN(Y2_MAX_PIN); - #else - SET_INPUT(Y2_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,Y,2); + #endif + #if HAS_Z_MIN + _INIT_ENDSTOP(MIN,Z,); #endif - #if HAS_Z_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z_MAX_PIN); - #else - SET_INPUT(Z_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,Z,); + #endif + #if HAS_Z2_MIN + _INIT_ENDSTOP(MIN,Z,2); #endif - #if HAS_Z2_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z2_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z2_MAX_PIN); - #else - SET_INPUT(Z2_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,Z,2); + #endif + #if HAS_Z3_MIN + _INIT_ENDSTOP(MIN,Z,3); #endif - #if HAS_Z3_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z3_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z3_MAX_PIN); - #else - SET_INPUT(Z3_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,Z,3); + #endif + #if HAS_Z4_MIN + _INIT_ENDSTOP(MIN,Z,4); #endif - #if HAS_Z4_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z4_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z4_MAX_PIN); - #else - SET_INPUT(Z4_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,Z,4); #endif - #if HAS_I_MIN - #if ENABLED(ENDSTOPPULLUP_IMIN) - SET_INPUT_PULLUP(I_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_IMIN) - SET_INPUT_PULLDOWN(I_MIN_PIN); - #else - SET_INPUT(I_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,I,); #endif - #if HAS_I_MAX - #if ENABLED(ENDSTOPPULLUP_IMAX) - SET_INPUT_PULLUP(I_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_IMAX) - SET_INPUT_PULLDOWN(I_MAX_PIN); - #else - SET_INPUT(I_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,I,); #endif - #if HAS_J_MIN - #if ENABLED(ENDSTOPPULLUP_JMIN) - SET_INPUT_PULLUP(J_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_IMIN) - SET_INPUT_PULLDOWN(J_MIN_PIN); - #else - SET_INPUT(J_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,J,); #endif - #if HAS_J_MAX - #if ENABLED(ENDSTOPPULLUP_JMAX) - SET_INPUT_PULLUP(J_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_JMAX) - SET_INPUT_PULLDOWN(J_MAX_PIN); - #else - SET_INPUT(J_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,J,); #endif - #if HAS_K_MIN - #if ENABLED(ENDSTOPPULLUP_KMIN) - SET_INPUT_PULLUP(K_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_KMIN) - SET_INPUT_PULLDOWN(K_MIN_PIN); - #else - SET_INPUT(K_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,K,); #endif - #if HAS_K_MAX - #if ENABLED(ENDSTOPPULLUP_KMAX) - SET_INPUT_PULLUP(K_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_KMIN) - SET_INPUT_PULLDOWN(K_MAX_PIN); - #else - SET_INPUT(K_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,K,); #endif - #if HAS_U_MIN - #if ENABLED(ENDSTOPPULLUP_UMIN) - SET_INPUT_PULLUP(U_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_UMIN) - SET_INPUT_PULLDOWN(U_MIN_PIN); - #else - SET_INPUT(U_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,U,); #endif - #if HAS_U_MAX - #if ENABLED(ENDSTOPPULLUP_UMAX) - SET_INPUT_PULLUP(U_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_UMIN) - SET_INPUT_PULLDOWN(U_MAX_PIN); - #else - SET_INPUT(U_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,U,); #endif - #if HAS_V_MIN - #if ENABLED(ENDSTOPPULLUP_VMIN) - SET_INPUT_PULLUP(V_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_VMIN) - SET_INPUT_PULLDOWN(V_MIN_PIN); - #else - SET_INPUT(V_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,V,); #endif - #if HAS_V_MAX - #if ENABLED(ENDSTOPPULLUP_VMAX) - SET_INPUT_PULLUP(V_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_VMIN) - SET_INPUT_PULLDOWN(V_MAX_PIN); - #else - SET_INPUT(V_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,V,); #endif - #if HAS_W_MIN - #if ENABLED(ENDSTOPPULLUP_WMIN) - SET_INPUT_PULLUP(W_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_WMIN) - SET_INPUT_PULLDOWN(W_MIN_PIN); - #else - SET_INPUT(W_MIN_PIN); - #endif + _INIT_ENDSTOP(MIN,W,); #endif - #if HAS_W_MAX - #if ENABLED(ENDSTOPPULLUP_WMAX) - SET_INPUT_PULLUP(W_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_WMIN) - SET_INPUT_PULLDOWN(W_MAX_PIN); - #else - SET_INPUT(W_MAX_PIN); - #endif + _INIT_ENDSTOP(MAX,W,); #endif #if PIN_EXISTS(CALIBRATION) @@ -577,7 +383,7 @@ static void print_es_state(const bool is_hit, FSTR_P const flabel=nullptr) { void __O2 Endstops::report_states() { TERN_(BLTOUCH, bltouch._set_SW_mode()); SERIAL_ECHOLNPGM(STR_M119_REPORT); - #define ES_REPORT(S) print_es_state(READ_ENDSTOP(S##_PIN) != S##_ENDSTOP_INVERTING, F(STR_##S)) + #define ES_REPORT(S) print_es_state(READ_ENDSTOP(S##_PIN) == S##_ENDSTOP_HIT_STATE, F(STR_##S)) #if HAS_X_MIN ES_REPORT(X_MIN); #endif @@ -693,7 +499,7 @@ void __O2 Endstops::report_states() { #define __ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN -#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING +#define _ENDSTOP_HIT_STATE(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_HIT_STATE #define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX) /** @@ -708,7 +514,7 @@ void Endstops::update() { #endif // Macros to update / copy the live_state - #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ_ENDSTOP(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) + #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ_ENDSTOP(_ENDSTOP_PIN(AXIS, MINMAX)) == _ENDSTOP_HIT_STATE(AXIS, MINMAX))) #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT)) #if ENABLED(G38_PROBE_TARGET) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX) @@ -1337,7 +1143,7 @@ void Endstops::update() { #endif )) { SBI(live_state, X_ENDSTOP); hit = true; } #if ENABLED(X_DUAL_ENDSTOPS) - if (tmc_spi_homing.x && stepperX2.test_stall_status()) { SBI(live_state, X2_ENDSTOP); hit = true; } + if (tmc_spi_homing.x && stepperX2.test_stall_status()) { SBI(live_state, X2_ENDSTOP); hit = true; } #endif #endif #if Y_SPI_SENSORLESS @@ -1349,7 +1155,7 @@ void Endstops::update() { #endif )) { SBI(live_state, Y_ENDSTOP); hit = true; } #if ENABLED(Y_DUAL_ENDSTOPS) - if (tmc_spi_homing.y && stepperY2.test_stall_status()) { SBI(live_state, Y2_ENDSTOP); hit = true; } + if (tmc_spi_homing.y && stepperY2.test_stall_status()) { SBI(live_state, Y2_ENDSTOP); hit = true; } #endif #endif #if Z_SPI_SENSORLESS diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 4d64455b21e1..76c8d454d7b8 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -86,7 +86,7 @@ enum EndstopEnum : char { #if HAS_X_MIN || HAS_X_MAX , X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN) #if ENABLED(X_DUAL_ENDSTOPS) - , X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN) + , X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN) #endif #endif #if HAS_Y_MIN || HAS_Y_MAX @@ -115,7 +115,7 @@ enum EndstopEnum : char { class Endstops { public: - typedef IF<(NUM_ENDSTOP_STATES > 8), uint16_t, uint8_t>::type endstop_mask_t; + typedef bits_t(NUM_ENDSTOP_STATES) endstop_mask_t; #if ENABLED(X_DUAL_ENDSTOPS) static float x2_endstop_adj; diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp new file mode 100644 index 000000000000..dfef961c7968 --- /dev/null +++ b/Marlin/src/module/ft_motion.cpp @@ -0,0 +1,924 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "../inc/MarlinConfig.h" + +#if ENABLED(FT_MOTION) + +#include "ft_motion.h" +#include "stepper.h" // Access stepper block queue function and abort status. + +FxdTiCtrl fxdTiCtrl; + +//-----------------------------------------------------------------// +// Variables. +//-----------------------------------------------------------------// + +// Public variables. +ftMotionMode_t FxdTiCtrl::cfg_mode = FTM_DEFAULT_MODE; // Mode / active compensation mode configuration. + +#if HAS_EXTRUDERS + bool FxdTiCtrl::cfg_linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration. + float FxdTiCtrl::cfg_linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain. +#endif + +dynFreqMode_t FxdTiCtrl::cfg_dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration. +#if !HAS_Z_AXIS + static_assert(FTM_DEFAULT_DYNFREQ_MODE != dynFreqMode_Z_BASED, "dynFreqMode_Z_BASED requires a Z axis."); +#endif +#if !(HAS_X_AXIS && HAS_EXTRUDERS) + static_assert(FTM_DEFAULT_DYNFREQ_MODE != dynFreqMode_MASS_BASED, "dynFreqMode_MASS_BASED requires an X axis and an extruder."); +#endif + +#if HAS_X_AXIS + float FxdTiCtrl::cfg_baseFreq[] = { FTM_SHAPING_DEFAULT_X_FREQ // Base frequency. [Hz] + OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) }; + float FxdTiCtrl::cfg_dynFreqK[] = { 0.0f OPTARG(HAS_Y_AXIS, 0.0f) }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] +#endif + +ft_command_t FxdTiCtrl::stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Buffer of stepper commands. +hal_timer_t FxdTiCtrl::stepperCmdBuff_StepRelativeTi[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Buffer of the stepper command timing. +uint8_t FxdTiCtrl::stepperCmdBuff_ApplyDir[FTM_STEPPERCMD_DIR_SIZE] = {0U}; // Buffer of whether DIR needs to be updated. +uint32_t FxdTiCtrl::stepperCmdBuff_produceIdx = 0, // Index of next stepper command write to the buffer. + FxdTiCtrl::stepperCmdBuff_consumeIdx = 0; // Index of next stepper command read from the buffer. + +bool FxdTiCtrl::sts_stepperBusy = false; // The stepper buffer has items and is in use. + +// Private variables. +// NOTE: These are sized for Ulendo FBS use. +#if HAS_X_AXIS + float FxdTiCtrl::xd[2 * (FTM_BATCH_SIZE)], // = {0.0f} Storage for fixed-time-based trajectory. + FxdTiCtrl::xm[FTM_BATCH_SIZE]; // = {0.0f} Storage for modified fixed-time-based trajectory. +#endif +#if HAS_Y_AXIS + float FxdTiCtrl::yd[2 * (FTM_BATCH_SIZE)], FxdTiCtrl::ym[FTM_BATCH_SIZE]; +#endif +#if HAS_Z_AXIS + float FxdTiCtrl::zd[2 * (FTM_BATCH_SIZE)], FxdTiCtrl::zm[FTM_BATCH_SIZE]; +#endif +#if HAS_EXTRUDERS + float FxdTiCtrl::ed[2 * (FTM_BATCH_SIZE)], FxdTiCtrl::em[FTM_BATCH_SIZE]; +#endif + +block_t* FxdTiCtrl::current_block_cpy = nullptr; // Pointer to current block being processed. +bool FxdTiCtrl::blockProcRdy = false, // Indicates a block is ready to be processed. + FxdTiCtrl::blockProcRdy_z1 = false, // Storage for the previous indicator. + FxdTiCtrl::blockProcDn = false; // Indicates current block is done being processed. +bool FxdTiCtrl::batchRdy = false; // Indicates a batch of the fixed time trajectory + // has been generated, is now available in the upper - + // half of xd, yd, zd, ed vectors, and is ready to be + // post processed, if applicable, then interpolated. +bool FxdTiCtrl::batchRdyForInterp = false; // Indicates the batch is done being post processed, + // if applicable, and is ready to be converted to step commands. +bool FxdTiCtrl::runoutEna = false; // True if runout of the block hasn't been done and is allowed. + +// Trapezoid data variables. +#if HAS_X_AXIS + float FxdTiCtrl::x_startPosn, // (mm) Start position of block + FxdTiCtrl::x_endPosn_prevBlock = 0.0f, // (mm) Start position of block + FxdTiCtrl::x_Ratio; // (ratio) Axis move ratio of block +#endif +#if HAS_Y_AXIS + float FxdTiCtrl::y_startPosn, + FxdTiCtrl::y_endPosn_prevBlock = 0.0f, + FxdTiCtrl::y_Ratio; +#endif +#if HAS_Z_AXIS + float FxdTiCtrl::z_startPosn, + FxdTiCtrl::z_endPosn_prevBlock = 0.0f, + FxdTiCtrl::z_Ratio; +#endif +#if HAS_EXTRUDERS + float FxdTiCtrl::e_startPosn, + FxdTiCtrl::e_endPosn_prevBlock = 0.0f, + FxdTiCtrl::e_Ratio; +#endif +float FxdTiCtrl::accel_P, // Acceleration prime of block. [mm/sec/sec] + FxdTiCtrl::decel_P, // Deceleration prime of block. [mm/sec/sec] + FxdTiCtrl::F_P, // Feedrate prime of block. [mm/sec] + FxdTiCtrl::f_s, // Starting feedrate of block. [mm/sec] + FxdTiCtrl::s_1e, // Position after acceleration phase of block. + FxdTiCtrl::s_2e; // Position after acceleration and coasting phase of block. + +uint32_t FxdTiCtrl::N1, // Number of data points in the acceleration phase. + FxdTiCtrl::N2, // Number of data points in the coasting phase. + FxdTiCtrl::N3; // Number of data points in the deceleration phase. + +uint32_t FxdTiCtrl::max_intervals; // Total number of data points that will be generated from block. + +// Make vector variables. +uint32_t FxdTiCtrl::makeVector_idx = 0, // Index of fixed time trajectory generation of the overall block. + FxdTiCtrl::makeVector_idx_z1 = 0, // Storage for the previously calculated index above. + FxdTiCtrl::makeVector_batchIdx = FTM_BATCH_SIZE; // Index of fixed time trajectory generation within the batch. + +// Interpolation variables. +#if HAS_X_AXIS + int32_t FxdTiCtrl::x_steps = 0; // Step count accumulator. + stepDirState_t FxdTiCtrl::x_dirState = stepDirState_NOT_SET; // Memory of the currently set step direction of the axis. +#endif +#if HAS_Y_AXIS + int32_t FxdTiCtrl::y_steps = 0; + stepDirState_t FxdTiCtrl::y_dirState = stepDirState_NOT_SET; +#endif +#if HAS_Z_AXIS + int32_t FxdTiCtrl::z_steps = 0; + stepDirState_t FxdTiCtrl::z_dirState = stepDirState_NOT_SET; +#endif +#if HAS_EXTRUDERS + int32_t FxdTiCtrl::e_steps = 0; + stepDirState_t FxdTiCtrl::e_dirState = stepDirState_NOT_SET; +#endif + +uint32_t FxdTiCtrl::interpIdx = 0, // Index of current data point being interpolated. + FxdTiCtrl::interpIdx_z1 = 0; // Storage for the previously calculated index above. +hal_timer_t FxdTiCtrl::nextStepTicks = FTM_MIN_TICKS; // Accumulator for the next step time (in ticks). + +// Shaping variables. +#if HAS_X_AXIS + uint32_t FxdTiCtrl::xy_zi_idx = 0, // Index of storage in the data point delay vectors. + FxdTiCtrl::xy_max_i = 0; // Vector length for the selected shaper. + float FxdTiCtrl::xd_zi[FTM_ZMAX] = { 0.0f }; // Data point delay vector. + float FxdTiCtrl::x_Ai[5]; // Shaping gain vector. + uint32_t FxdTiCtrl::x_Ni[5]; // Shaping time index vector. +#endif +#if HAS_Y_AXIS + float FxdTiCtrl::yd_zi[FTM_ZMAX] = { 0.0f }; + float FxdTiCtrl::y_Ai[5]; + uint32_t FxdTiCtrl::y_Ni[5]; +#endif + +#if HAS_EXTRUDERS + // Linear advance variables. + float FxdTiCtrl::e_raw_z1 = 0.0f; // (ms) Unit delay of raw extruder position. + float FxdTiCtrl::e_advanced_z1 = 0.0f; // (ms) Unit delay of advanced extruder position. +#endif + +//-----------------------------------------------------------------// +// Function definitions. +//-----------------------------------------------------------------// + +// Public functions. + +// Sets controller states to begin processing a block. +void FxdTiCtrl::startBlockProc(block_t * const current_block) { + current_block_cpy = current_block; + blockProcRdy = true; + blockProcDn = false; + runoutEna = true; +} + +// Moves any free data points to the stepper buffer even if a full batch isn't ready. +void FxdTiCtrl::runoutBlock() { + + if (runoutEna && !batchRdy) { // If the window is full already (block intervals was a multiple of + // the batch size), or runout is not enabled, no runout is needed. + // Fill out the trajectory window with the last position calculated. + if (makeVector_batchIdx > FTM_BATCH_SIZE) { + for (uint32_t i = makeVector_batchIdx; i < 2 * (FTM_BATCH_SIZE); i++) { + xd[i] = xd[makeVector_batchIdx - 1]; + TERN_(HAS_Y_AXIS, yd[i] = yd[makeVector_batchIdx - 1]); + TERN_(HAS_Y_AXIS, zd[i] = zd[makeVector_batchIdx - 1]); + TERN_(HAS_EXTRUDERS, ed[i] = ed[makeVector_batchIdx - 1]); + } + } + makeVector_batchIdx = FTM_BATCH_SIZE; + batchRdy = true; + } + runoutEna = false; +} + +// Controller main, to be invoked from non-isr task. +void FxdTiCtrl::loop() { + + if (!cfg_mode) return; + + static bool initd = false; + if (!initd) { init(); initd = true; } + + // Handle block abort with the following sequence: + // 1. Zero out commands in stepper ISR. + // 2. Drain the motion buffer, stop processing until they are emptied. + // 3. Reset all the states / memory. + // 4. Signal ready for new block. + if (stepper.abort_current_block) { + if (sts_stepperBusy) return; // Wait until motion buffers are emptied + reset(); + blockProcDn = true; // Set queueing to look for next block. + runoutEna = false; // Disabling running out this block, since we want to halt the motion. + stepper.abort_current_block = false; // Abort finished. + } + + // Planner processing and block conversion. + if (!blockProcRdy) stepper.fxdTiCtrl_BlockQueueUpdate(); + + if (blockProcRdy) { + if (!blockProcRdy_z1) loadBlockData(current_block_cpy); // One-shot. + while (!blockProcDn && !batchRdy && (makeVector_idx - makeVector_idx_z1 < (FTM_POINTS_PER_LOOP))) + makeVector(); + } + + // FBS / post processing. + if (batchRdy && !batchRdyForInterp) { + + // Call Ulendo FBS here. + + memcpy(xm, &xd[FTM_BATCH_SIZE], sizeof(xm)); + TERN_(HAS_Y_AXIS, memcpy(ym, &yd[FTM_BATCH_SIZE], sizeof(ym))); + + // Done compensating ... + + // Copy the uncompensated vectors. + TERN_(HAS_Z_AXIS, memcpy(zm, &zd[FTM_BATCH_SIZE], sizeof(zm))); + TERN_(HAS_EXTRUDERS, memcpy(em, &ed[FTM_BATCH_SIZE], sizeof(em))); + + // Shift the time series back in the window. + memcpy(xd, &xd[FTM_BATCH_SIZE], sizeof(xd) / 2); + TERN_(HAS_Y_AXIS, memcpy(yd, &yd[FTM_BATCH_SIZE], sizeof(yd) / 2)); + // Disabled by comment as these are uncompensated, the lower half is not used. + //TERN_(HAS_Z_AXIS, memcpy(zd, &zd[FTM_BATCH_SIZE], (sizeof(zd) / 2))); + //TERN_(HAS_EXTRUDERS, memcpy(ed, &ed[FTM_BATCH_SIZE], (sizeof(ed) / 2))); + + // ... data is ready in xm, ym, zm, em. + batchRdyForInterp = true; + + batchRdy = false; // Clear so that makeVector() may resume generating points. + + } // if (batchRdy && !batchRdyForInterp) + + // Interpolation. + while ( batchRdyForInterp + && ( stepperCmdBuffItems() < ((FTM_STEPPERCMD_BUFF_SIZE) - (FTM_STEPS_PER_UNIT_TIME)) ) + && ( (interpIdx - interpIdx_z1) < (FTM_STEPS_PER_LOOP) ) + ) { + convertToSteps(interpIdx); + + if (++interpIdx == FTM_BATCH_SIZE) { + batchRdyForInterp = false; + interpIdx = 0; + } + } + + // Report busy status to planner. + planner.fxdTiCtrl_busy = (sts_stepperBusy || ((!blockProcDn && blockProcRdy) || batchRdy || batchRdyForInterp || runoutEna)); + + blockProcRdy_z1 = blockProcRdy; + makeVector_idx_z1 = makeVector_idx; + interpIdx_z1 = interpIdx; +} + +#if HAS_X_AXIS + + // Refresh the gains used by shaping functions. + // To be called on init or mode or zeta change. + void FxdTiCtrl::updateShapingA(const_float_t zeta/*=FTM_SHAPING_ZETA*/, const_float_t vtol/*=FTM_SHAPING_V_TOL*/) { + + const float K = exp( -zeta * PI / sqrt(1.0f - sq(zeta)) ), + K2 = sq(K); + + switch (cfg_mode) { + + case ftMotionMode_ZV: + xy_max_i = 1U; + x_Ai[0] = 1.0f / (1.0f + K); + x_Ai[1] = x_Ai[0] * K; + break; + + case ftMotionMode_ZVD: + xy_max_i = 2U; + x_Ai[0] = 1.0f / ( 1.0f + 2.0f * K + K2 ); + x_Ai[1] = x_Ai[0] * 2.0f * K; + x_Ai[2] = x_Ai[0] * K2; + break; + + case ftMotionMode_EI: { + xy_max_i = 2U; + x_Ai[0] = 0.25f * (1.0f + vtol); + x_Ai[1] = 0.50f * (1.0f - vtol) * K; + x_Ai[2] = x_Ai[0] * K2; + const float A_adj = 1.0f / (x_Ai[0] + x_Ai[1] + x_Ai[2]); + for (uint32_t i = 0U; i < 3U; i++) { x_Ai[i] *= A_adj; } + } break; + + case ftMotionMode_2HEI: { + xy_max_i = 3U; + const float vtol2 = sq(vtol); + const float X = pow(vtol2 * (sqrt(1.0f - vtol2) + 1.0f), 1.0f / 3.0f); + x_Ai[0] = ( 3.0f * sq(X) + 2.0f * X + 3.0f * vtol2 ) / (16.0f * X); + x_Ai[1] = ( 0.5f - x_Ai[0] ) * K; + x_Ai[2] = x_Ai[1] * K; + x_Ai[3] = x_Ai[0] * cu(K); + const float A_adj = 1.0f / (x_Ai[0] + x_Ai[1] + x_Ai[2] + x_Ai[3]); + for (uint32_t i = 0U; i < 4U; i++) { x_Ai[i] *= A_adj; } + } break; + + case ftMotionMode_3HEI: { + xy_max_i = 4U; + x_Ai[0] = 0.0625f * ( 1.0f + 3.0f * vtol + 2.0f * sqrt( 2.0f * ( vtol + 1.0f ) * vtol ) ); + x_Ai[1] = 0.25f * ( 1.0f - vtol ) * K; + x_Ai[2] = ( 0.5f * ( 1.0f + vtol ) - 2.0f * x_Ai[0] ) * K2; + x_Ai[3] = x_Ai[1] * K2; + x_Ai[4] = x_Ai[0] * sq(K2); + const float A_adj = 1.0f / (x_Ai[0] + x_Ai[1] + x_Ai[2] + x_Ai[3] + x_Ai[4]); + for (uint32_t i = 0U; i < 5U; i++) { x_Ai[i] *= A_adj; } + } break; + + case ftMotionMode_MZV: { + xy_max_i = 2U; + const float B = 1.4142135623730950488016887242097f * K; + x_Ai[0] = 1.0f / (1.0f + B + K2); + x_Ai[1] = x_Ai[0] * B; + x_Ai[2] = x_Ai[0] * K2; + } break; + + default: + for (uint32_t i = 0U; i < 5U; i++) x_Ai[i] = 0.0f; + xy_max_i = 0; + } + #if HAS_Y_AXIS + memcpy(y_Ai, x_Ai, sizeof(x_Ai)); // For now, zeta and vtol are shared across x and y. + #endif + } + + // Refresh the indices used by shaping functions. + // To be called when frequencies change. + void FxdTiCtrl::updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), const_float_t zeta/*=FTM_SHAPING_ZETA*/) { + + // Protections omitted for DBZ and for index exceeding array length. + + const float df = sqrt(1.0f - sq(zeta)); + + switch (cfg_mode) { + case ftMotionMode_ZV: + x_Ni[1] = round((0.5f / xf / df) * (FTM_FS)); + #if HAS_Y_AXIS + y_Ni[1] = round((0.5f / yf / df) * (FTM_FS)); + #endif + break; + case ftMotionMode_ZVD: + case ftMotionMode_EI: + x_Ni[1] = round((0.5f / xf / df) * (FTM_FS)); + x_Ni[2] = 2 * x_Ni[1]; + #if HAS_Y_AXIS + y_Ni[1] = round((0.5f / yf / df) * (FTM_FS)); + y_Ni[2] = 2 * y_Ni[1]; + #endif + break; + case ftMotionMode_2HEI: + x_Ni[1] = round((0.5f / xf / df) * (FTM_FS)); + x_Ni[2] = 2 * x_Ni[1]; + x_Ni[3] = 3 * x_Ni[1]; + #if HAS_Y_AXIS + y_Ni[1] = round((0.5f / yf / df) * (FTM_FS)); + y_Ni[2] = 2 * y_Ni[1]; + y_Ni[3] = 3 * y_Ni[1]; + #endif + break; + case ftMotionMode_3HEI: + x_Ni[1] = round((0.5f / xf / df) * (FTM_FS)); + x_Ni[2] = 2 * x_Ni[1]; + x_Ni[3] = 3 * x_Ni[1]; + x_Ni[4] = 4 * x_Ni[1]; + #if HAS_Y_AXIS + y_Ni[1] = round((0.5f / yf / df) * (FTM_FS)); + y_Ni[2] = 2 * y_Ni[1]; + y_Ni[3] = 3 * y_Ni[1]; + y_Ni[4] = 4 * y_Ni[1]; + #endif + break; + case ftMotionMode_MZV: + x_Ni[1] = round((0.375f / xf / df) * (FTM_FS)); + x_Ni[2] = 2 * x_Ni[1]; + #if HAS_Y_AXIS + y_Ni[1] = round((0.375f / yf / df) * (FTM_FS)); + y_Ni[2] = 2 * y_Ni[1]; + #endif + break; + default: + for (uint32_t i = 0U; i < 5U; i++) { x_Ni[i] = 0; TERN_(HAS_Y_AXIS, y_Ni[i] = 0); } + } + } + +#endif // HAS_X_AXIS + +// Reset all trajectory processing variables. +void FxdTiCtrl::reset() { + + stepperCmdBuff_produceIdx = stepperCmdBuff_consumeIdx = 0; + + for (uint32_t i = 0U; i < (FTM_BATCH_SIZE); i++) { // Reset trajectory history + TERN_(HAS_X_AXIS, xd[i] = 0.0f); + TERN_(HAS_Y_AXIS, yd[i] = 0.0f); + TERN_(HAS_Z_AXIS, zd[i] = 0.0f); + TERN_(HAS_EXTRUDERS, ed[i] = 0.0f); + } + + blockProcRdy = blockProcRdy_z1 = blockProcDn = false; + batchRdy = batchRdyForInterp = false; + runoutEna = false; + + TERN_(HAS_X_AXIS, x_endPosn_prevBlock = 0.0f); + TERN_(HAS_Y_AXIS, y_endPosn_prevBlock = 0.0f); + TERN_(HAS_Z_AXIS, z_endPosn_prevBlock = 0.0f); + TERN_(HAS_EXTRUDERS, e_endPosn_prevBlock = 0.0f); + + makeVector_idx = makeVector_idx_z1 = 0; + makeVector_batchIdx = FTM_BATCH_SIZE; + + TERN_(HAS_X_AXIS, x_steps = 0); + TERN_(HAS_Y_AXIS, y_steps = 0); + TERN_(HAS_Z_AXIS, z_steps = 0); + TERN_(HAS_EXTRUDERS, e_steps = 0); + interpIdx = interpIdx_z1 = 0; + TERN_(HAS_X_AXIS, x_dirState = stepDirState_NOT_SET); + TERN_(HAS_Y_AXIS, y_dirState = stepDirState_NOT_SET); + TERN_(HAS_Z_AXIS, z_dirState = stepDirState_NOT_SET); + TERN_(HAS_EXTRUDERS, e_dirState = stepDirState_NOT_SET); + nextStepTicks = FTM_MIN_TICKS; + + #if HAS_X_AXIS + for (uint32_t i = 0U; i < (FTM_ZMAX); i++) { xd_zi[i] = 0.0f; TERN_(HAS_Y_AXIS, yd_zi[i] = 0.0f); } + xy_zi_idx = 0; + #endif + + TERN_(HAS_EXTRUDERS, e_raw_z1 = e_advanced_z1 = 0.0f); +} + +// Private functions. +// Auxiliary function to get number of step commands in the buffer. +uint32_t FxdTiCtrl::stepperCmdBuffItems() { + const uint32_t udiff = stepperCmdBuff_produceIdx - stepperCmdBuff_consumeIdx; + return stepperCmdBuff_produceIdx < stepperCmdBuff_consumeIdx ? (FTM_STEPPERCMD_BUFF_SIZE) + udiff : udiff; +} + +// Initializes storage variables before startup. +void FxdTiCtrl::init() { + #if HAS_X_AXIS + updateShapingN(cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, cfg_baseFreq[1])); + updateShapingA(FTM_SHAPING_ZETA, FTM_SHAPING_V_TOL); + #endif + reset(); // Precautionary. +} + +// Loads / converts block data from planner to fixed-time control variables. +void FxdTiCtrl::loadBlockData(block_t * const current_block) { + + const float totalLength = current_block->millimeters, + oneOverLength = 1.0f / totalLength; + + const axis_bits_t direction = current_block->direction_bits; + + #if HAS_X_AXIS + x_startPosn = x_endPosn_prevBlock; + float x_moveDist = current_block->steps.a / planner.settings.axis_steps_per_mm[X_AXIS]; + if (TEST(direction, X_AXIS)) x_moveDist *= -1.0f; + x_Ratio = x_moveDist * oneOverLength; + #endif + + #if HAS_Y_AXIS + y_startPosn = y_endPosn_prevBlock; + float y_moveDist = current_block->steps.b / planner.settings.axis_steps_per_mm[Y_AXIS]; + if (TEST(direction, Y_AXIS)) y_moveDist *= -1.0f; + y_Ratio = y_moveDist * oneOverLength; + #endif + + #if HAS_Z_AXIS + z_startPosn = z_endPosn_prevBlock; + float z_moveDist = current_block->steps.c / planner.settings.axis_steps_per_mm[Z_AXIS]; + if (TEST(direction, Z_AXIS)) z_moveDist *= -1.0f; + z_Ratio = z_moveDist * oneOverLength; + #endif + + #if HAS_EXTRUDERS + e_startPosn = e_endPosn_prevBlock; + float extrusion = current_block->steps.e / planner.settings.axis_steps_per_mm[E_AXIS_N(current_block->extruder)]; + if (TEST(direction, E_AXIS_N(current_block->extruder))) extrusion *= -1.0f; + e_Ratio = extrusion * oneOverLength; + #endif + + const float spm = totalLength / current_block->step_event_count; // (steps/mm) Distance for each step + f_s = spm * current_block->initial_rate; // (steps/s) Start feedrate + const float f_e = spm * current_block->final_rate; // (steps/s) End feedrate + + const float a = current_block->acceleration, // (mm/s^2) Same magnitude for acceleration or deceleration + oneby2a = 1.0f / (2.0f * a), // (s/mm) Time to accelerate or decelerate one mm (i.e., oneby2a * 2 + oneby2d = -oneby2a; // (s/mm) Time to accelerate or decelerate one mm (i.e., oneby2a * 2 + const float fsSqByTwoA = sq(f_s) * oneby2a, // (mm) Distance to accelerate from start speed to nominal speed + feSqByTwoD = sq(f_e) * oneby2d; // (mm) Distance to decelerate from nominal speed to end speed + + float F_n = current_block->nominal_speed; // (mm/s) Speed we hope to achieve, if possible + const float fdiff = feSqByTwoD - fsSqByTwoA, // (mm) Coasting distance if nominal speed is reached + odiff = oneby2a - oneby2d, // (i.e., oneby2a * 2) (mm/s) Change in speed for one second of acceleration + ldiff = totalLength - fdiff; // (mm) Distance to travel if nominal speed is reached + float T2 = (1.0f / F_n) * (ldiff - odiff * sq(F_n)); // (s) Coasting duration after nominal speed reached + if (T2 < 0.0f) { + T2 = 0.0f; + F_n = SQRT(ldiff / odiff); // Clip by intersection if nominal speed can't be reached. + } + + const float T1 = (F_n - f_s) / a, // (s) Accel Time = difference in feedrate over acceleration + T3 = (F_n - f_e) / a; // (s) Decel Time = difference in feedrate over acceleration + + N1 = ceil(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency + N2 = ceil(T2 * (FTM_FS)); // Coast + N3 = ceil(T3 * (FTM_FS)); // Decel + + const float T1_P = N1 * (FTM_TS), // (s) Accel datapoints x timestep resolution + T2_P = N2 * (FTM_TS), // (s) Coast + T3_P = N3 * (FTM_TS); // (s) Decel + + // Calculate the reachable feedrate at the end of the accel phase + // totalLength is the total distance to travel in mm + // f_s is the starting feedrate in mm/s + // f_e is the ending feedrate in mm/s + // T1_P is the time spent accelerating in seconds + // T2_P is the time spent coasting in seconds + // T3_P is the time spent decelerating in seconds + // f_s * T1_P is the distance traveled during the accel phase + // f_e * T3_P is the distance traveled during the decel phase + // + F_P = (2.0f * totalLength - f_s * T1_P - f_e * T3_P) / (T1_P + 2.0f * T2_P + T3_P); // (mm/s) Feedrate at the end of the accel phase + + // Calculate the acceleration and deceleration rates + accel_P = N1 ? ((F_P - f_s) / T1_P) : 0.0f; + + decel_P = (f_e - F_P) / T3_P; + + // Calculate the distance traveled during the accel phase + s_1e = f_s * T1_P + 0.5f * accel_P * sq(T1_P); + + // Calculate the distance traveled during the decel phase + s_2e = s_1e + F_P * T2_P; + + // One less than (Accel + Coasting + Decel) datapoints + max_intervals = N1 + N2 + N3 - 1U; + + TERN_(HAS_X_AXIS, x_endPosn_prevBlock += x_moveDist); + TERN_(HAS_Y_AXIS, y_endPosn_prevBlock += y_moveDist); + TERN_(HAS_Z_AXIS, z_endPosn_prevBlock += z_moveDist); + TERN_(HAS_EXTRUDERS, e_endPosn_prevBlock += extrusion); +} + +// Generate data points of the trajectory. +void FxdTiCtrl::makeVector() { + float accel_k = 0.0f; // (mm/s^2) Acceleration K factor + float tau = (makeVector_idx + 1) * (FTM_TS); // (s) Time since start of block + float dist = 0.0f; // (mm) Distance traveled + + if (makeVector_idx < N1) { + // Acceleration phase + dist = (f_s * tau) + (0.5f * accel_P * sq(tau)); // (mm) Distance traveled for acceleration phase + accel_k = accel_P; // (mm/s^2) Acceleration K factor from Accel phase + } + else if (makeVector_idx >= N1 && makeVector_idx < (N1 + N2)) { + // Coasting phase + dist = s_1e + F_P * (tau - N1 * (FTM_TS)); // (mm) Distance traveled for coasting phase + //accel_k = 0.0f; + } + else { + // Deceleration phase + const float tau_ = tau - (N1 + N2) * (FTM_TS); // (s) Time since start of decel phase + dist = s_2e + F_P * tau_ + 0.5f * decel_P * sq(tau_); // (mm) Distance traveled for deceleration phase + accel_k = decel_P; // (mm/s^2) Acceleration K factor from Decel phase + } + + TERN_(HAS_X_AXIS, xd[makeVector_batchIdx] = x_startPosn + x_Ratio * dist); // (mm) X position for this datapoint + TERN_(HAS_Y_AXIS, yd[makeVector_batchIdx] = y_startPosn + y_Ratio * dist); // (mm) Y + TERN_(HAS_Z_AXIS, zd[makeVector_batchIdx] = z_startPosn + z_Ratio * dist); // (mm) Z + + #if HAS_EXTRUDERS + const float new_raw_z1 = e_startPosn + e_Ratio * dist; + if (cfg_linearAdvEna) { + float dedt_adj = (new_raw_z1 - e_raw_z1) * (FTM_FS); + if (e_Ratio > 0.0f) dedt_adj += accel_k * cfg_linearAdvK; + + e_advanced_z1 += dedt_adj * (FTM_TS); + ed[makeVector_batchIdx] = e_advanced_z1; + + e_raw_z1 = new_raw_z1; + } + else { + ed[makeVector_batchIdx] = new_raw_z1; + // Alternatively: coordArray_e[makeVector_batchIdx] = e_startDist + extrusion / (N1 + N2 + N3); + } + #endif + + // Update shaping parameters if needed. + #if HAS_Z_AXIS + static float zd_z1 = 0.0f; + #endif + switch (cfg_dynFreqMode) { + + #if HAS_Z_AXIS + case dynFreqMode_Z_BASED: + if (zd[makeVector_batchIdx] != zd_z1) { // Only update if Z changed. + const float xf = cfg_baseFreq[0] + cfg_dynFreqK[0] * zd[makeVector_batchIdx], + yf = cfg_baseFreq[1] + cfg_dynFreqK[1] * zd[makeVector_batchIdx]; + updateShapingN(_MAX(xf, FTM_MIN_SHAPE_FREQ), _MAX(yf, FTM_MIN_SHAPE_FREQ)); + zd_z1 = zd[makeVector_batchIdx]; + } + break; + #endif + + #if HAS_X_AXIS && HAS_EXTRUDERS + case dynFreqMode_MASS_BASED: + // Update constantly. The optimization done for Z value makes + // less sense for E, as E is expected to constantly change. + updateShapingN( cfg_baseFreq[0] + cfg_dynFreqK[0] * ed[makeVector_batchIdx] + OPTARG(HAS_Y_AXIS, cfg_baseFreq[1] + cfg_dynFreqK[1] * ed[makeVector_batchIdx]) ); + break; + #endif + + default: break; + } + + // Apply shaping if in mode. + #if HAS_X_AXIS + if (WITHIN(cfg_mode, 10U, 19U)) { + xd_zi[xy_zi_idx] = xd[makeVector_batchIdx]; + xd[makeVector_batchIdx] *= x_Ai[0]; + #if HAS_Y_AXIS + yd_zi[xy_zi_idx] = yd[makeVector_batchIdx]; + yd[makeVector_batchIdx] *= y_Ai[0]; + #endif + for (uint32_t i = 1U; i <= xy_max_i; i++) { + const uint32_t udiffx = xy_zi_idx - x_Ni[i]; + xd[makeVector_batchIdx] += x_Ai[i] * xd_zi[x_Ni[i] > xy_zi_idx ? (FTM_ZMAX) + udiffx : udiffx]; + #if HAS_Y_AXIS + const uint32_t udiffy = xy_zi_idx - y_Ni[i]; + yd[makeVector_batchIdx] += y_Ai[i] * yd_zi[y_Ni[i] > xy_zi_idx ? (FTM_ZMAX) + udiffy : udiffy]; + #endif + } + if (++xy_zi_idx == (FTM_ZMAX)) xy_zi_idx = 0; + } + #endif + + // Filled up the queue with regular and shaped steps + if (++makeVector_batchIdx == 2 * (FTM_BATCH_SIZE)) { + makeVector_batchIdx = FTM_BATCH_SIZE; + batchRdy = true; + } + + if (makeVector_idx == max_intervals) { + blockProcDn = true; + blockProcRdy = false; + makeVector_idx = 0; + } + else + makeVector_idx++; +} + +// Interpolates single data point to stepper commands. +void FxdTiCtrl::convertToSteps(const uint32_t idx) { + #if HAS_X_AXIS + int32_t x_err_P = 0; + #endif + #if HAS_Y_AXIS + int32_t y_err_P = 0; + #endif + #if HAS_Z_AXIS + int32_t z_err_P = 0; + #endif + #if HAS_EXTRUDERS + int32_t e_err_P = 0; + #endif + + //#define STEPS_ROUNDING + #if ENABLED(STEPS_ROUNDING) + #if HAS_X_AXIS + const float x_steps_tar = xm[idx] * planner.settings.axis_steps_per_mm[X_AXIS] + (xm[idx] < 0.0f ? -0.5f : 0.5f); // May be eliminated if guaranteed positive. + const int32_t x_delta = int32_t(x_steps_tar) - x_steps; + #endif + #if HAS_Y_AXIS + const float y_steps_tar = ym[idx] * planner.settings.axis_steps_per_mm[Y_AXIS] + (ym[idx] < 0.0f ? -0.5f : 0.5f); + const int32_t y_delta = int32_t(y_steps_tar) - y_steps; + #endif + #if HAS_Z_AXIS + const float z_steps_tar = zm[idx] * planner.settings.axis_steps_per_mm[Z_AXIS] + (zm[idx] < 0.0f ? -0.5f : 0.5f); + const int32_t z_delta = int32_t(z_steps_tar) - z_steps; + #endif + #if HAS_EXTRUDERS + const float e_steps_tar = em[idx] * planner.settings.axis_steps_per_mm[E_AXIS] + (em[idx] < 0.0f ? -0.5f : 0.5f); + const int32_t e_delta = int32_t(e_steps_tar) - e_steps; + #endif + #else + #if HAS_X_AXIS + const int32_t x_delta = int32_t(xm[idx] * planner.settings.axis_steps_per_mm[X_AXIS]) - x_steps; + #endif + #if HAS_Y_AXIS + const int32_t y_delta = int32_t(ym[idx] * planner.settings.axis_steps_per_mm[Y_AXIS]) - y_steps; + #endif + #if HAS_Z_AXIS + const int32_t z_delta = int32_t(zm[idx] * planner.settings.axis_steps_per_mm[Z_AXIS]) - z_steps; + #endif + #if HAS_EXTRUDERS + const int32_t e_delta = int32_t(em[idx] * planner.settings.axis_steps_per_mm[E_AXIS]) - e_steps; + #endif + #endif + + bool any_dirChange = (false + || TERN0(HAS_X_AXIS, (x_delta > 0 && x_dirState != stepDirState_POS) || (x_delta < 0 && x_dirState != stepDirState_NEG)) + || TERN0(HAS_Y_AXIS, (y_delta > 0 && y_dirState != stepDirState_POS) || (y_delta < 0 && y_dirState != stepDirState_NEG)) + || TERN0(HAS_Z_AXIS, (z_delta > 0 && z_dirState != stepDirState_POS) || (z_delta < 0 && z_dirState != stepDirState_NEG)) + || TERN0(HAS_EXTRUDERS, (e_delta > 0 && e_dirState != stepDirState_POS) || (e_delta < 0 && e_dirState != stepDirState_NEG)) + ); + + for (uint32_t i = 0U; i < (FTM_STEPS_PER_UNIT_TIME); i++) { + + // TODO: (?) Since the *delta variables will not change, + // the comparison may be done once before iterating at + // expense of storage and lines of code. + + bool anyStep = false; + + stepperCmdBuff[stepperCmdBuff_produceIdx] = 0; + + // Commands are written in the format: + // |X_step|X_direction|Y_step|Y_direction|Z_step|Z_direction|E_step|E_direction| + #if HAS_X_AXIS + if (x_delta >= 0) { + if ((x_err_P + x_delta) < (FTM_CTS_COMPARE_VAL)) { + x_err_P += x_delta; + } + else { + x_steps++; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_X) | _BV(FT_BIT_STEP_X); + x_err_P += x_delta - (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + else { + if ((x_err_P + x_delta) > -(FTM_CTS_COMPARE_VAL)) { + x_err_P += x_delta; + } + else { + x_steps--; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_STEP_X); + x_err_P += x_delta + (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + #endif // HAS_X_AXIS + + #if HAS_Y_AXIS + if (y_delta >= 0) { + if ((y_err_P + y_delta) < (FTM_CTS_COMPARE_VAL)) { + y_err_P += y_delta; + } + else { + y_steps++; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_Y) | _BV(FT_BIT_STEP_Y); + y_err_P += y_delta - (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + else { + if ((y_err_P + y_delta) > -(FTM_CTS_COMPARE_VAL)) { + y_err_P += y_delta; + } + else { + y_steps--; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_STEP_Y); + y_err_P += y_delta + (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + #endif // HAS_Y_AXIS + + #if HAS_Z_AXIS + if (z_delta >= 0) { + if ((z_err_P + z_delta) < (FTM_CTS_COMPARE_VAL)) { + z_err_P += z_delta; + } + else { + z_steps++; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_Z) | _BV(FT_BIT_STEP_Z); + z_err_P += z_delta - (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + else { + if ((z_err_P + z_delta) > -(FTM_CTS_COMPARE_VAL)) { + z_err_P += z_delta; + } + else { + z_steps--; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_STEP_Z); + z_err_P += z_delta + (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + #endif // HAS_Z_AXIS + + #if HAS_EXTRUDERS + if (e_delta >= 0) { + if ((e_err_P + e_delta) < (FTM_CTS_COMPARE_VAL)) { + e_err_P += e_delta; + } + else { + e_steps++; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_E) | _BV(FT_BIT_STEP_E); + e_err_P += e_delta - (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + else { + if ((e_err_P + e_delta) > -(FTM_CTS_COMPARE_VAL)) { + e_err_P += e_delta; + } + else { + e_steps--; + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_STEP_E); + e_err_P += e_delta + (FTM_STEPS_PER_UNIT_TIME); + anyStep = true; + } + } + #endif // HAS_EXTRUDERS + + if (!anyStep) { + nextStepTicks += (FTM_MIN_TICKS); + } + else { + stepperCmdBuff_StepRelativeTi[stepperCmdBuff_produceIdx] = nextStepTicks; + + const uint8_t dir_index = stepperCmdBuff_produceIdx >> 3, + dir_bit = stepperCmdBuff_produceIdx & 0x7; + if (any_dirChange) { + SBI(stepperCmdBuff_ApplyDir[dir_index], dir_bit); + #if HAS_X_AXIS + if (x_delta > 0) { + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_X); + x_dirState = stepDirState_POS; + } + else { + x_dirState = stepDirState_NEG; + } + #endif + + #if HAS_Y_AXIS + if (y_delta > 0) { + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_Y); + y_dirState = stepDirState_POS; + } + else { + y_dirState = stepDirState_NEG; + } + #endif + + #if HAS_Z_AXIS + if (z_delta > 0) { + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_Z); + z_dirState = stepDirState_POS; + } + else { + z_dirState = stepDirState_NEG; + } + #endif + + #if HAS_EXTRUDERS + if (e_delta > 0) { + stepperCmdBuff[stepperCmdBuff_produceIdx] |= _BV(FT_BIT_DIR_E); + e_dirState = stepDirState_POS; + } + else { + e_dirState = stepDirState_NEG; + } + #endif + + any_dirChange = false; + } + else { // ...no direction change. + CBI(stepperCmdBuff_ApplyDir[dir_index], dir_bit); + } + + if (stepperCmdBuff_produceIdx == (FTM_STEPPERCMD_BUFF_SIZE) - 1) { + stepperCmdBuff_produceIdx = 0; + } + else { + stepperCmdBuff_produceIdx++; + } + + nextStepTicks = FTM_MIN_TICKS; + } + } // FTM_STEPS_PER_UNIT_TIME loop +} + +#endif // FT_MOTION diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h new file mode 100644 index 000000000000..6c5b6bf03bf6 --- /dev/null +++ b/Marlin/src/module/ft_motion.h @@ -0,0 +1,170 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "../inc/MarlinConfigPre.h" // Access the top level configurations. +#include "../module/planner.h" // Access block type from planner. + +#include "ft_types.h" + +#define FTM_STEPPERCMD_DIR_SIZE ((FTM_STEPPERCMD_BUFF_SIZE + 7) / 8) + +class FxdTiCtrl { + + public: + + // Public variables + static ftMotionMode_t cfg_mode; // Mode / active compensation mode configuration. + static bool cfg_linearAdvEna; // Linear advance enable configuration. + static float cfg_linearAdvK; // Linear advance gain. + static dynFreqMode_t cfg_dynFreqMode; // Dynamic frequency mode configuration. + + #if HAS_X_AXIS + static float cfg_baseFreq[1 + ENABLED(HAS_Y_AXIS)]; // Base frequency. [Hz] + static float cfg_dynFreqK[1 + ENABLED(HAS_Y_AXIS)]; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] + #endif + + static ft_command_t stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of stepper commands. + static hal_timer_t stepperCmdBuff_StepRelativeTi[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of the stepper command timing. + static uint8_t stepperCmdBuff_ApplyDir[FTM_STEPPERCMD_DIR_SIZE]; // Buffer of whether DIR needs to be updated. + static uint32_t stepperCmdBuff_produceIdx, // Index of next stepper command write to the buffer. + stepperCmdBuff_consumeIdx; // Index of next stepper command read from the buffer. + + static bool sts_stepperBusy; // The stepper buffer has items and is in use. + + + // Public methods + static void startBlockProc(block_t * const current_block); // Set controller states to begin processing a block. + static bool getBlockProcDn() { return blockProcDn; } // Return true if the controller no longer needs the current block. + static void runoutBlock(); // Move any free data points to the stepper buffer even if a full batch isn't ready. + static void loop(); // Controller main, to be invoked from non-isr task. + + + #if HAS_X_AXIS + // Refresh the gains used by shaping functions. + // To be called on init or mode or zeta change. + static void updateShapingA(const_float_t zeta=FTM_SHAPING_ZETA, const_float_t vtol=FTM_SHAPING_V_TOL); + + // Refresh the indices used by shaping functions. + // To be called when frequencies change. + static void updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), const_float_t zeta=FTM_SHAPING_ZETA); + #endif + + static void reset(); // Resets all states of the fixed time conversion to defaults. + + private: + + #if HAS_X_AXIS + static float xd[2 * (FTM_BATCH_SIZE)], xm[FTM_BATCH_SIZE]; + #endif + #if HAS_Y_AXIS + static float yd[2 * (FTM_BATCH_SIZE)], ym[FTM_BATCH_SIZE]; + #endif + #if HAS_Z_AXIS + static float zd[2 * (FTM_BATCH_SIZE)], zm[FTM_BATCH_SIZE]; + #endif + #if HAS_EXTRUDERS + static float ed[2 * (FTM_BATCH_SIZE)], em[FTM_BATCH_SIZE]; + #endif + + static block_t *current_block_cpy; + static bool blockProcRdy, blockProcRdy_z1, blockProcDn; + static bool batchRdy, batchRdyForInterp; + static bool runoutEna; + + // Trapezoid data variables. + #if HAS_X_AXIS + static float x_startPosn, x_endPosn_prevBlock, x_Ratio; + #endif + #if HAS_Y_AXIS + static float y_startPosn, y_endPosn_prevBlock, y_Ratio; + #endif + #if HAS_Z_AXIS + static float z_startPosn, z_endPosn_prevBlock, z_Ratio; + #endif + #if HAS_EXTRUDERS + static float e_startPosn, e_endPosn_prevBlock, e_Ratio; + #endif + static float accel_P, decel_P, + F_P, + f_s, + s_1e, + s_2e; + + static uint32_t N1, N2, N3; + static uint32_t max_intervals; + + // Make vector variables. + static uint32_t makeVector_idx, + makeVector_idx_z1, + makeVector_batchIdx; + + // Interpolation variables. + static uint32_t interpIdx, + interpIdx_z1; + #if HAS_X_AXIS + static int32_t x_steps; + static stepDirState_t x_dirState; + #endif + #if HAS_Y_AXIS + static int32_t y_steps; + static stepDirState_t y_dirState; + #endif + #if HAS_Z_AXIS + static int32_t z_steps; + static stepDirState_t z_dirState; + #endif + #if HAS_EXTRUDERS + static int32_t e_steps; + static stepDirState_t e_dirState; + #endif + + static hal_timer_t nextStepTicks; + + // Shaping variables. + #if HAS_X_AXIS + static uint32_t xy_zi_idx, xy_max_i; + static float xd_zi[FTM_ZMAX]; + static float x_Ai[5]; + static uint32_t x_Ni[5]; + #endif + #if HAS_Y_AXIS + static float yd_zi[FTM_ZMAX]; + static float y_Ai[5]; + static uint32_t y_Ni[5]; + #endif + + // Linear advance variables. + #if HAS_EXTRUDERS + static float e_raw_z1, e_advanced_z1; + #endif + + // Private methods + static uint32_t stepperCmdBuffItems(); + static void init(); + static void loadBlockData(block_t * const current_block); + static void makeVector(); + static void convertToSteps(const uint32_t idx); + +}; // class fxdTiCtrl + +extern FxdTiCtrl fxdTiCtrl; diff --git a/Marlin/src/module/ft_types.h b/Marlin/src/module/ft_types.h new file mode 100644 index 000000000000..613e177a3915 --- /dev/null +++ b/Marlin/src/module/ft_types.h @@ -0,0 +1,59 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "../core/types.h" + +typedef enum FXDTICtrlMode : uint8_t { + ftMotionMode_DISABLED = 0U, + ftMotionMode_ENABLED = 1U, + ftMotionMode_ULENDO_FBS = 2U, + ftMotionMode_ZV = 10U, + ftMotionMode_ZVD = 11U, + ftMotionMode_EI = 12U, + ftMotionMode_2HEI = 13U, + ftMotionMode_3HEI = 14U, + ftMotionMode_MZV = 15U, + ftMotionMode_DISCTF = 20U +} ftMotionMode_t; + +enum dynFreqMode_t : uint8_t { + dynFreqMode_DISABLED = 0U, + dynFreqMode_Z_BASED = 1U, + dynFreqMode_MASS_BASED = 2U +}; + +enum stepDirState_t { + stepDirState_NOT_SET = 0U, + stepDirState_POS = 1U, + stepDirState_NEG = 2U +}; + +enum { + FT_BIT_DIR_E, FT_BIT_STEP_E, + FT_BIT_DIR_Z, FT_BIT_STEP_Z, + FT_BIT_DIR_Y, FT_BIT_STEP_Y, + FT_BIT_DIR_X, FT_BIT_STEP_X, + FT_BIT_COUNT +}; + +typedef bits_t(FT_BIT_COUNT) ft_command_t; diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 9d43db48c74a..61cbef068e2d 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -672,6 +672,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f* do_blocking_move_to(NUM_AXIS_ELEM(raw), fr_mm_s); } void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_x(", rx, ", ", fr_mm_s, ")"); do_blocking_move_to( NUM_AXIS_LIST(rx, current_position.y, current_position.z, current_position.i, current_position.j, current_position.k, current_position.u, current_position.v, current_position.w), @@ -681,6 +682,7 @@ void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) { #if HAS_Y_AXIS void do_blocking_move_to_y(const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_y(", ry, ", ", fr_mm_s, ")"); do_blocking_move_to( NUM_AXIS_LIST(current_position.x, ry, current_position.z, current_position.i, current_position.j, current_position.k, current_position.u, current_position.v, current_position.w), @@ -691,6 +693,7 @@ void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) { #if HAS_Z_AXIS void do_blocking_move_to_z(const_float_t rz, const_feedRate_t fr_mm_s/*=0.0*/) { + 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); } #endif @@ -769,6 +772,7 @@ void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) { #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), @@ -789,9 +793,10 @@ void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) { ); } void do_z_clearance(const_float_t zclear, const bool lower_allowed/*=false*/) { - float zdest = zclear; - if (!lower_allowed) NOLESS(zdest, current_position.z); - do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, ", ", lower_allowed, ")"); + const float zdest = _MIN(zclear, Z_MAX_POS); + if (zdest == current_position.z || (!lower_allowed && zdest < current_position.z)) return; + do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); } #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 2acc54ebc270..611d3a17bdca 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -411,10 +411,10 @@ void restore_feedrate_and_scaling(); /** * Homing and Trusted Axes */ -typedef IF<(NUM_AXES > 8), uint16_t, uint8_t>::type main_axes_bits_t; +typedef bits_t(NUM_AXES) main_axes_bits_t; constexpr main_axes_bits_t main_axes_mask = _BV(NUM_AXES) - 1; -typedef IF<(NUM_AXES + EXTRUDERS > 8), uint16_t, uint8_t>::type e_axis_bits_t; +typedef bits_t(NUM_AXES + EXTRUDERS) e_axis_bits_t; constexpr e_axis_bits_t e_axis_mask = (_BV(EXTRUDERS) - 1) << NUM_AXES; void set_axis_is_at_home(const AxisEnum axis); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 583e3686a094..dadb22fbde9c 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -69,6 +69,9 @@ #include "stepper.h" #include "motion.h" #include "temperature.h" +#if ENABLED(FT_MOTION) + #include "ft_motion.h" +#endif #include "../lcd/marlinui.h" #include "../gcode/parser.h" @@ -112,7 +115,8 @@ // Delay for delivery of first block to the stepper ISR, if the queue contains 2 or // fewer movements. The delay is measured in milliseconds, and must be less than 250ms -#define BLOCK_DELAY_FOR_1ST_MOVE 100 +#define BLOCK_DELAY_NONE 0U +#define BLOCK_DELAY_FOR_1ST_MOVE 100U Planner planner; @@ -127,7 +131,7 @@ volatile uint8_t Planner::block_buffer_head, // Index of the next block to be Planner::block_buffer_planned, // Index of the optimally planned block Planner::block_buffer_tail; // Index of the busy block, if any uint16_t Planner::cleaning_buffer_counter; // A counter to disable queuing of blocks -uint8_t Planner::delay_before_delivering; // This counter delays delivery of blocks when queue becomes empty to allow the opportunity of merging blocks +uint8_t Planner::delay_before_delivering; // Delay block delivery so initial blocks in an empty queue may merge planner_settings_t Planner::settings; // Initialized by settings.load() @@ -215,8 +219,8 @@ uint32_t Planner::acceleration_long_cutoff; xyze_float_t Planner::previous_speed; float Planner::previous_nominal_speed; -#if ENABLED(DISABLE_INACTIVE_EXTRUDER) - last_move_t Planner::g_uc_extruder_last_move[E_STEPPERS] = { 0 }; +#if ENABLED(DISABLE_OTHER_EXTRUDERS) + last_move_t Planner::extruder_last_move[E_STEPPERS] = { 0 }; #endif #ifdef XY_FREQUENCY_LIMIT @@ -225,6 +229,10 @@ float Planner::previous_nominal_speed; int32_t Planner::xy_freq_min_interval_us = LROUND(1000000.0f / (XY_FREQUENCY_LIMIT)); #endif +#if ENABLED(FT_MOTION) + bool Planner::fxdTiCtrl_busy = false; +#endif + #if ENABLED(LIN_ADVANCE) float Planner::extruder_advance_K[DISTINCT_E]; // Initialized by settings.load() #endif @@ -1320,7 +1328,7 @@ void Planner::recalculate(TERN_(HINTS_SAFE_EXIT_SPEED, const_float_t safe_exit_s */ void Planner::check_axes_activity() { - #if HAS_DISABLE_AXIS + #if HAS_DISABLE_AXES xyze_bool_t axis_active = { false }; #endif @@ -1360,7 +1368,7 @@ void Planner::check_axes_activity() { TERN_(HAS_HEATER_2, tail_e_to_p_pressure = block->e_to_p_pressure); #endif - #if HAS_DISABLE_AXIS + #if HAS_DISABLE_AXES for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) { block_t * const bnext = &block_buffer[b]; LOGICAL_AXIS_CODE( @@ -1401,18 +1409,20 @@ void Planner::check_axes_activity() { // // Disable inactive axes // - LOGICAL_AXIS_CODE( - if (TERN0(DISABLE_E, !axis_active.e)) stepper.disable_e_steppers(), - if (TERN0(DISABLE_X, !axis_active.x)) stepper.disable_axis(X_AXIS), - if (TERN0(DISABLE_Y, !axis_active.y)) stepper.disable_axis(Y_AXIS), - if (TERN0(DISABLE_Z, !axis_active.z)) stepper.disable_axis(Z_AXIS), - if (TERN0(DISABLE_I, !axis_active.i)) stepper.disable_axis(I_AXIS), - if (TERN0(DISABLE_J, !axis_active.j)) stepper.disable_axis(J_AXIS), - if (TERN0(DISABLE_K, !axis_active.k)) stepper.disable_axis(K_AXIS), - if (TERN0(DISABLE_U, !axis_active.u)) stepper.disable_axis(U_AXIS), - if (TERN0(DISABLE_V, !axis_active.v)) stepper.disable_axis(V_AXIS), - if (TERN0(DISABLE_W, !axis_active.w)) stepper.disable_axis(W_AXIS) - ); + #if HAS_DISABLE_AXES + LOGICAL_AXIS_CODE( + if (TERN0(DISABLE_E, !axis_active.e)) stepper.disable_e_steppers(), + if (TERN0(DISABLE_X, !axis_active.x)) stepper.disable_axis(X_AXIS), + if (TERN0(DISABLE_Y, !axis_active.y)) stepper.disable_axis(Y_AXIS), + if (TERN0(DISABLE_Z, !axis_active.z)) stepper.disable_axis(Z_AXIS), + if (TERN0(DISABLE_I, !axis_active.i)) stepper.disable_axis(I_AXIS), + if (TERN0(DISABLE_J, !axis_active.j)) stepper.disable_axis(J_AXIS), + if (TERN0(DISABLE_K, !axis_active.k)) stepper.disable_axis(K_AXIS), + if (TERN0(DISABLE_U, !axis_active.u)) stepper.disable_axis(U_AXIS), + if (TERN0(DISABLE_V, !axis_active.v)) stepper.disable_axis(V_AXIS), + if (TERN0(DISABLE_W, !axis_active.w)) stepper.disable_axis(W_AXIS) + ); + #endif // // Update Fan speeds @@ -1681,7 +1691,8 @@ void Planner::quick_stop() { // Restart the block delay for the first movement - As the queue was // forced to empty, there's no risk the ISR will touch this. - delay_before_delivering = BLOCK_DELAY_FOR_1ST_MOVE; + + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; TERN_(HAS_WIRED_LCD, clear_block_buffer_runtime()); // Clear the accumulated runtime @@ -1726,7 +1737,8 @@ float Planner::triggered_position_mm(const AxisEnum axis) { bool Planner::busy() { return (has_blocks_queued() || cleaning_buffer_counter || TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING()) - || TERN0(HAS_SHAPING, stepper.input_shaping_busy()) + || TERN0(HAS_ZV_SHAPING, stepper.input_shaping_busy()) + || TERN0(FT_MOTION, fxdTiCtrl_busy) ); } @@ -1839,7 +1851,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target // As there are no queued movements, the Stepper ISR will not touch this // variable, so there is no risk setting this here (but it MUST be done // before the following line!!) - delay_before_delivering = BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; } // Move buffer head @@ -2276,25 +2288,25 @@ bool Planner::_populate_block( if (esteps) { TERN_(AUTO_POWER_CONTROL, powerManager.power_on()); - #if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder + #if ENABLED(DISABLE_OTHER_EXTRUDERS) // Enable only the selected extruder // Count down all steppers that were recently moved LOOP_L_N(i, E_STEPPERS) - if (g_uc_extruder_last_move[i]) g_uc_extruder_last_move[i]--; + if (extruder_last_move[i]) extruder_last_move[i]--; // Switching Extruder uses one E stepper motor per two nozzles - #define E_STEPPER_INDEX(E) TERN(SWITCHING_EXTRUDER, (E) / 2, E) + #define E_STEPPER_INDEX(E) TERN(HAS_SWITCHING_EXTRUDER, (E) / 2, E) // Enable all (i.e., both) E steppers for IDEX-style duplication, but only active E steppers for multi-nozzle (i.e., single wide X carriage) duplication #define _IS_DUPE(N) TERN0(HAS_DUPLICATION_MODE, (extruder_duplication_enabled && TERN1(MULTI_NOZZLE_DUPLICATION, TEST(duplication_e_mask, N)))) #define ENABLE_ONE_E(N) do{ \ - if (N == E_STEPPER_INDEX(extruder) || _IS_DUPE(N)) { /* N is 'extruder', or N is duplicating */ \ - stepper.ENABLE_EXTRUDER(N); /* Enable the relevant E stepper... */ \ - g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; /* ...and reset its counter */ \ + if (N == E_STEPPER_INDEX(extruder) || _IS_DUPE(N)) { /* N is 'extruder', or N is duplicating */ \ + stepper.ENABLE_EXTRUDER(N); /* Enable the relevant E stepper... */ \ + extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; /* ...and reset its counter */ \ } \ - else if (!g_uc_extruder_last_move[N]) /* Counter expired since last E stepper enable */ \ - stepper.DISABLE_EXTRUDER(N); /* Disable the E stepper */ \ + else if (!extruder_last_move[N]) /* Counter expired since last E stepper enable */ \ + stepper.DISABLE_EXTRUDER(N); /* Disable the E stepper */ \ }while(0); #else @@ -2943,7 +2955,7 @@ void Planner::buffer_sync_block(const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_PO // As there are no queued movements, the Stepper ISR will not touch this // variable, so there is no risk setting this here (but it MUST be done // before the following line!!) - delay_before_delivering = BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; } block_buffer_head = next_buffer_head; @@ -3241,7 +3253,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s // As there are no queued movements, the Stepper ISR will not touch this // variable, so there is no risk setting this here (but it MUST be done // before the following line!!) - delay_before_delivering = BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; } // Move buffer head diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index b63fabb84d02..e2d1d6739cda 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -352,8 +352,8 @@ typedef struct { } skew_factor_t; #endif -#if ENABLED(DISABLE_INACTIVE_EXTRUDER) - typedef IF<(BLOCK_BUFFER_SIZE > 64), uint16_t, uint8_t>::type last_move_t; +#if ENABLED(DISABLE_OTHER_EXTRUDERS) + typedef uvalue_t(BLOCK_BUFFER_SIZE * 2) last_move_t; #endif #if ENABLED(ARC_SUPPORT) @@ -512,6 +512,10 @@ class Planner { } #endif + #if ENABLED(FT_MOTION) + static bool fxdTiCtrl_busy; + #endif + private: /** @@ -533,9 +537,9 @@ class Planner { static float last_fade_z; #endif - #if ENABLED(DISABLE_INACTIVE_EXTRUDER) + #if ENABLED(DISABLE_OTHER_EXTRUDERS) // Counters to manage disabling inactive extruder steppers - static last_move_t g_uc_extruder_last_move[E_STEPPERS]; + static last_move_t extruder_last_move[E_STEPPERS]; #endif #if HAS_WIRED_LCD diff --git a/Marlin/src/module/polargraph.cpp b/Marlin/src/module/polargraph.cpp index d55d36a6d654..ef6a4c0db463 100644 --- a/Marlin/src/module/polargraph.cpp +++ b/Marlin/src/module/polargraph.cpp @@ -43,7 +43,7 @@ xy_pos_t draw_area_min, draw_area_max; void inverse_kinematics(const xyz_pos_t &raw) { const float x1 = raw.x - draw_area_min.x, x2 = draw_area_max.x - raw.x, y = raw.y - draw_area_max.y; - delta.set(HYPOT(x1, y), HYPOT(x2, y), raw.z); + delta.set(HYPOT(x1, y), HYPOT(x2, y) OPTARG(HAS_Z_AXIS, raw.z)); } #endif // POLARGRAPH diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 3b6239c667ee..f3d9ec8a9d85 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -41,7 +41,7 @@ Stopwatch print_job_timer; // Global Print Job Timer instance #include "../libs/buzzer.h" #endif -#if PRINTCOUNTER_SYNC +#if ENABLED(PRINTCOUNTER_SYNC) #include "../module/planner.h" #endif diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index f0a3c8584b24..230fc30db195 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -147,7 +147,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() WRITE(MAGLEV_TRIGGER_PIN, LOW); } - inline void maglev_idle() { do_blocking_move_to_z(10); } + inline void maglev_idle() { do_z_clearance(10); } #elif ENABLED(TOUCH_MI_PROBE) @@ -196,35 +196,35 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() inline void run_deploy_moves() { #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_1 #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE - #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE 0.0f #endif constexpr xyz_pos_t deploy_1 = Z_PROBE_ALLEN_KEY_DEPLOY_1; do_blocking_move_to(deploy_1, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_2 #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE - #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE 0.0f #endif constexpr xyz_pos_t deploy_2 = Z_PROBE_ALLEN_KEY_DEPLOY_2; do_blocking_move_to(deploy_2, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3 #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE - #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE 0.0f #endif constexpr xyz_pos_t deploy_3 = Z_PROBE_ALLEN_KEY_DEPLOY_3; do_blocking_move_to(deploy_3, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_4 #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE - #define Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE 0.0f #endif constexpr xyz_pos_t deploy_4 = Z_PROBE_ALLEN_KEY_DEPLOY_4; do_blocking_move_to(deploy_4, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_5 #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE - #define Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE 0.0f #endif constexpr xyz_pos_t deploy_5 = Z_PROBE_ALLEN_KEY_DEPLOY_5; do_blocking_move_to(deploy_5, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE)); @@ -234,35 +234,35 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() inline void run_stow_moves() { #ifdef Z_PROBE_ALLEN_KEY_STOW_1 #ifndef Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE - #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE 0.0f #endif constexpr xyz_pos_t stow_1 = Z_PROBE_ALLEN_KEY_STOW_1; do_blocking_move_to(stow_1, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_STOW_2 #ifndef Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE - #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE 0.0f #endif constexpr xyz_pos_t stow_2 = Z_PROBE_ALLEN_KEY_STOW_2; do_blocking_move_to(stow_2, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_STOW_3 #ifndef Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE - #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE 0.0f #endif constexpr xyz_pos_t stow_3 = Z_PROBE_ALLEN_KEY_STOW_3; do_blocking_move_to(stow_3, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_STOW_4 #ifndef Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE - #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE 0.0f #endif constexpr xyz_pos_t stow_4 = Z_PROBE_ALLEN_KEY_STOW_4; do_blocking_move_to(stow_4, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE)); #endif #ifdef Z_PROBE_ALLEN_KEY_STOW_5 #ifndef Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE - #define Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE 0.0f #endif constexpr xyz_pos_t stow_5 = Z_PROBE_ALLEN_KEY_STOW_5; do_blocking_move_to(stow_5, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE)); @@ -355,11 +355,13 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() void Probe::do_z_raise(const float z_raise) { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Probe::do_z_raise(", z_raise, ")"); float z_dest = z_raise; - if (offset.z < 0) z_dest -= offset.z; + const float zoffs = DIFF_TERN(HAS_HOTEND_OFFSET, offset.z, hotend_offset[active_extruder].z); + if (zoffs < 0) z_dest -= zoffs; do_z_clearance(z_dest); } FORCE_INLINE void probe_specific_action(const bool deploy) { + DEBUG_SECTION(log_psa, "Probe::probe_specific_action", DEBUGGING(LEVELING)); #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) do { #if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED) @@ -403,8 +405,16 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #elif HAS_Z_SERVO_PROBE + // i.e., deploy ? DEPLOY_Z_SERVO() : STOW_Z_SERVO(); servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); + #ifdef Z_SERVO_MEASURE_ANGLE + // After deploy move back to the measure angle... + if (deploy) servo[Z_PROBE_SERVO_NR].move(Z_SERVO_MEASURE_ANGLE); + #endif + + if (TERN0(Z_SERVO_DEACTIVATE_AFTER_STOW, !deploy)) servo[Z_PROBE_SERVO_NR].detach(); + #elif ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE) deploy ? run_deploy_moves() : run_stow_moves(); @@ -495,11 +505,10 @@ void Probe::probe_error_stop() { * * Return TRUE if the probe could not be deployed/stowed */ -bool Probe::set_deployed(const bool deploy) { - +bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) { if (DEBUGGING(LEVELING)) { DEBUG_POS("Probe::set_deployed", current_position); - DEBUG_ECHOLNPGM("deploy: ", deploy); + DEBUG_ECHOLNPGM("deploy=", deploy, " no_return=", no_return); } if (endstops.z_probe_enabled == deploy) return false; @@ -523,7 +532,7 @@ bool Probe::set_deployed(const bool deploy) { } #endif - const xy_pos_t old_xy = current_position; + const xy_pos_t old_xy = current_position; // Remember location before probe deployment #if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST) @@ -552,7 +561,8 @@ bool Probe::set_deployed(const bool deploy) { // If preheating is required before any probing... TERN_(PREHEAT_BEFORE_PROBING, if (deploy) preheat_for_probing(PROBING_NOZZLE_TEMP, PROBING_BED_TEMP)); - do_blocking_move_to(old_xy); + if (!no_return) do_blocking_move_to(old_xy); // Return to the original location unless handled externally + endstops.enable_z_probe(deploy); return false; } @@ -582,11 +592,16 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { #if BOTH(HAS_TEMP_HOTEND, WAIT_FOR_HOTEND) thermalManager.wait_for_hotend_heating(active_extruder); #endif + #if ENABLED(BLTOUCH) if (!bltouch.high_speed_mode && bltouch.deploy()) return true; // Deploy in LOW SPEED MODE on every probe action #endif + #if HAS_Z_SERVO_PROBE && (ENABLED(Z_SERVO_INTERMEDIATE_STOW) || defined(Z_SERVO_MEASURE_ANGLE)) + probe_specific_action(true); // Always re-deploy in this case + #endif + // Disable stealthChop if used. Enable diag1 pin on driver. #if ENABLED(SENSORLESS_PROBING) sensorless_t stealth_states { false }; @@ -615,7 +630,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { // Offset sensorless probing #if HAS_DELTA_SENSORLESS_PROBING - if (probe_triggered) probe.refresh_largest_sensorless_adj(); + if (probe_triggered) refresh_largest_sensorless_adj(); #endif TERN_(HAS_QUIET_PROBING, set_probing_paused(false)); @@ -636,6 +651,10 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { return true; // Stow in LOW SPEED MODE on every trigger #endif + #if BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) + probe_specific_action(false); // Always stow + #endif + // Clear endstop flags endstops.hit_on_purpose(); @@ -669,12 +688,12 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { bool Probe::tare() { #if BOTH(PROBE_ACTIVATION_SWITCH, PROBE_TARE_ONLY_WHILE_INACTIVE) if (endstops.probe_switch_activated()) { - SERIAL_ECHOLNPGM("Cannot tare an active probe"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Cannot tare an active probe"); return true; } #endif - SERIAL_ECHOLNPGM("Taring probe"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Taring probe"); WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE); delay(PROBE_TARE_TIME); WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE); @@ -696,13 +715,17 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { float Probe::run_z_probe(const bool sanity_check/*=true*/) { DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING)); + const float zoffs = SUM_TERN(HAS_HOTEND_OFFSET, -offset.z, hotend_offset[active_extruder].z); + auto try_to_probe = [&](PGM_P const plbl, const_float_t z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) -> bool { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("try_to_probe(..., ", z_probe_low_point, ", ", fr_mm_s, ", ", scheck, ", ", clearance); + // Tare the probe, if supported if (TERN0(PROBE_TARE, tare())) return true; // Do a first probe at the fast speed - const bool probe_fail = probe_down_to_z(z_probe_low_point, fr_mm_s), // No probe trigger? - early_fail = (scheck && current_position.z > -offset.z + clearance); // Probe triggered too high? + const bool probe_fail = probe_down_to_z(z_probe_low_point, fr_mm_s), // No probe trigger? + early_fail = (scheck && current_position.z > zoffs + clearance); // Probe triggered too high? #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING) && (probe_fail || early_fail)) { DEBUG_ECHOPGM_P(plbl); @@ -719,7 +742,9 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { // Stop the probe before it goes too low to prevent damage. // If Z isn't known then probe to -10mm. - const float z_probe_low_point = axis_is_trusted(Z_AXIS) ? -offset.z + Z_PROBE_LOW_POINT : -10.0; + const float z_probe_low_point = axis_is_trusted(Z_AXIS) ? zoffs + Z_PROBE_LOW_POINT : -10.0f; + + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Probe Low Point: ", z_probe_low_point); // Double-probing does a fast probe followed by a slow probe #if TOTAL_PROBING == 2 @@ -728,6 +753,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { if (TERN0(PROBE_TARE, tare())) return NAN; // Do a first probe at the fast speed + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Fast Probe:"); if (try_to_probe(PSTR("FAST"), z_probe_low_point, z_probe_fast_mm_s, sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN; @@ -735,17 +761,17 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("1st Probe Z:", first_probe_z); // Raise to give the probe clearance - do_blocking_move_to_z(current_position.z + Z_CLEARANCE_MULTI_PROBE, z_probe_fast_mm_s); + do_z_clearance(Z_CLEARANCE_MULTI_PROBE); #elif Z_PROBE_FEEDRATE_FAST != Z_PROBE_FEEDRATE_SLOW // If the nozzle is well over the travel height then // move down quickly before doing the slow probe - const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0); + const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0f + _MAX(zoffs, 0.0f); if (current_position.z > z) { // Probe down fast. If the probe never triggered, raise for probe clearance if (!probe_down_to_z(z, z_probe_fast_mm_s)) - do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, z_probe_fast_mm_s); + do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES); } #endif @@ -768,6 +794,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { if (TERN0(PROBE_TARE, tare())) return true; // Probe downward slowly to find the bed + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Slow Probe:"); if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW), sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN; @@ -777,7 +804,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { #if EXTRA_PROBING > 0 // Insert Z measurement into probes[]. Keep it sorted ascending. - LOOP_LE_N(i, p) { // Iterate the saved Zs to insert the new Z + LOOP_LE_N(i, p) { // Iterate the saved Zs to insert the new Z if (i == p || probes[i] > z) { // Last index or new Z is smaller than this Z for (int8_t m = p; --m >= i;) probes[m + 1] = probes[m]; // Shift items down after the insertion point probes[i] = z; // Insert the new Z measurement @@ -796,7 +823,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { #if EXTRA_PROBING > 0 < TOTAL_PROBING - 1 #endif - ) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, z_probe_fast_mm_s); + ) do_z_clearance(Z_CLEARANCE_MULTI_PROBE); #endif } @@ -829,7 +856,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("2nd Probe Z:", z2, " Discrepancy:", first_probe_z - z2); // Return a weighted average of the fast and slow probes - const float measured_z = (z2 * 3.0 + first_probe_z * 2.0) * 0.2; + const float measured_z = (z2 * 3.0f + first_probe_z * 2.0f) * 0.2f; #else @@ -838,10 +865,33 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { #endif - return measured_z; + return DIFF_TERN(HAS_HOTEND_OFFSET, measured_z, hotend_offset[active_extruder].z); } +#if DO_TOOLCHANGE_FOR_PROBING + + #include "tool_change.h" + + /** + * Switches to the appropriate tool (PROBING_TOOL) for probing (probing = true), and switches + * back to the old tool when probing = false. Uses statics to avoid unnecessary checks and to + * cache the previous tool, so always call with false after calling with true. + */ + void Probe::use_probing_tool(const bool probing/*=true*/) { + static uint8_t old_tool; + static bool old_state = false; + if (probing == old_state) return; + old_state = probing; + if (probing) old_tool = active_extruder; + const uint8_t tool = probing ? PROBING_TOOL : old_tool; + if (tool != active_extruder) + tool_change(tool, ENABLED(PROBE_TOOLCHANGE_NO_MOVE)); + } + +#endif + /** + * - Switch to PROBING_TOOL if necessary * - Move to the given XY * - Deploy the probe, if not already deployed * - Probe the bed, get the Z position @@ -849,6 +899,12 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { * - Stow the probe, or * - Raise to the BETWEEN height * - Return the probed Z position + * - Revert to previous tool + * + * A batch of multiple probing operations should always be preceded by use_probing_tool() invocation + * and succeeded by use_probing_tool(false), in order to avoid multiple tool changes and to end up + * with the previously active tool. + * */ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/, const bool sanity_check/*=true*/) { DEBUG_SECTION(log_probe, "Probe::probe_at_point", DEBUGGING(LEVELING)); @@ -864,21 +920,30 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai } #if ENABLED(BLTOUCH) - if (bltouch.high_speed_mode && bltouch.triggered()) - bltouch._reset(); + // Reset a BLTouch in HS mode if already triggered + if (bltouch.high_speed_mode && bltouch.triggered()) bltouch._reset(); #endif + // Use a safe Z height for the XY move + const float safe_z = _MAX(current_position.z, Z_PROBE_SAFE_CLEARANCE); + // On delta keep Z below clip height or do_blocking_move_to will abort xyz_pos_t npos = NUM_AXIS_ARRAY( - rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, current_position.z), current_position.z), + rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, safe_z), safe_z), current_position.i, current_position.j, current_position.k, current_position.u, current_position.v, current_position.w ); if (!can_reach(npos, probe_relative)) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Not Reachable"); return NAN; } - if (probe_relative) npos -= offset_xy; // Get the nozzle position + + if (DEBUGGING(LEVELING)) DEBUG_ECHOPGM("Move to probe"); + if (probe_relative) { // Get the nozzle position, adjust for active hotend if not 0 + if (DEBUGGING(LEVELING)) DEBUG_ECHOPGM("-relative"); + npos -= DIFF_TERN(HAS_HOTEND_OFFSET, offset_xy, xy_pos_t(hotend_offset[active_extruder])); + } + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" point"); // Move the probe to the starting XYZ do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S)); @@ -893,17 +958,26 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai TERN_(HAS_PTC, ptc.apply_compensation(measured_z)); TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy)); } + + // Deploy succeeded and a successful measurement was done. + // Raise and/or stow the probe depending on 'raise_after' and settings. if (!isnan(measured_z)) { - const bool big_raise = raise_after == PROBE_PT_BIG_RAISE; - if (big_raise || raise_after == PROBE_PT_RAISE) - do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s); - else if (raise_after == PROBE_PT_STOW || raise_after == PROBE_PT_LAST_STOW) - if (stow()) measured_z = NAN; // Error on stow? + const ProbePtRaise raise_type = (TERN0(BLTOUCH, !bltouch.high_speed_mode) && raise_after == PROBE_PT_RAISE) ? PROBE_PT_STOW : raise_after; + switch (raise_type) { + default: break; + case PROBE_PT_RAISE: + do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES); + break; + case PROBE_PT_STOW: case PROBE_PT_LAST_STOW: + if (stow()) measured_z = NAN; // Error on stow? + break; + } if (verbose_level > 2) SERIAL_ECHOLNPGM("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z); } + // If any error occurred stow the probe and set an alert if (isnan(measured_z)) { stow(); LCD_MESSAGE(MSG_LCD_PROBING_FAILED); @@ -912,6 +986,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai #endif } DEBUG_ECHOLNPGM("measured_z: ", measured_z); + return measured_z; } @@ -927,6 +1002,8 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai * homing has been done - no homing with z-probe without init! */ STOW_Z_SERVO(); + + TERN_(Z_SERVO_DEACTIVATE_AFTER_STOW, servo[Z_PROBE_SERVO_NR].detach()); } #endif // HAS_Z_SERVO_PROBE diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index a179eb21d802..069e505ea000 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -38,15 +38,14 @@ PROBE_PT_NONE, // No raise or stow after run_z_probe PROBE_PT_STOW, // Do a complete stow after run_z_probe PROBE_PT_LAST_STOW, // Stow for sure, even in BLTouch HS mode - PROBE_PT_RAISE, // Raise to "between" clearance after run_z_probe - PROBE_PT_BIG_RAISE // Raise to big clearance after run_z_probe + PROBE_PT_RAISE // Raise to "between" clearance after run_z_probe }; #endif #if USES_Z_MIN_PROBE_PIN - #define PROBE_TRIGGERED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING) + #define PROBE_TRIGGERED() (READ(Z_MIN_PROBE_PIN) == Z_MIN_PROBE_ENDSTOP_HIT_STATE) #else - #define PROBE_TRIGGERED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING) + #define PROBE_TRIGGERED() (READ(Z_MIN_PIN) == Z_MIN_ENDSTOP_HIT_STATE) #endif #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) @@ -59,6 +58,9 @@ #define Z_POST_CLEARANCE 10 #endif +// In BLTOUCH HS mode, the probe travels in a deployed state. +#define Z_PROBE_SAFE_CLEARANCE SUM_TERN(BLTOUCH, Z_CLEARANCE_BETWEEN_PROBES, bltouch.z_extra_clearance()) + #if ENABLED(PREHEAT_BEFORE_LEVELING) #ifndef LEVELING_NOZZLE_TEMP #define LEVELING_NOZZLE_TEMP 0 @@ -90,7 +92,7 @@ class Probe { static void probe_error_stop(); - static bool set_deployed(const bool deploy); + static bool set_deployed(const bool deploy, const bool no_return=false); #if IS_KINEMATIC @@ -114,7 +116,7 @@ class Probe { } #endif - #else + #else // !IS_KINEMATIC static bool obstacle_check(const_float_t rx, const_float_t ry) { #if ENABLED(AVOID_OBSTACLES) @@ -166,7 +168,7 @@ class Probe { } } - #endif + #endif // !IS_KINEMATIC static void move_z_after_probing() { #ifdef Z_AFTER_PROBING @@ -178,15 +180,17 @@ class Probe { return probe_at_point(pos.x, pos.y, raise_after, verbose_level, probe_relative, sanity_check); } - #else + #else // !HAS_BED_PROBE static constexpr xyz_pos_t offset = xyz_pos_t(NUM_AXIS_ARRAY_1(0)); // See #16767 - static bool set_deployed(const bool) { return false; } + static bool set_deployed(const bool, const bool=false) { return false; } static bool can_reach(const_float_t rx, const_float_t ry, const bool=true) { return position_is_reachable(rx, ry); } - #endif + #endif // !HAS_BED_PROBE + + static void use_probing_tool(const bool=true) IF_DISABLED(DO_TOOLCHANGE_FOR_PROBING, {}); static void move_z_after_homing() { #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) || defined(Z_AFTER_HOMING) @@ -216,8 +220,8 @@ class Probe { static constexpr xy_pos_t offset_xy = xy_pos_t({ 0, 0 }); // See #16767 #endif - static bool deploy() { return set_deployed(true); } - static bool stow() { return set_deployed(false); } + static bool deploy(const bool no_return=false) { return set_deployed(true, no_return); } + static bool stow(const bool no_return=false) { return set_deployed(false, no_return); } #if HAS_BED_PROBE || HAS_LEVELING #if IS_KINEMATIC @@ -294,12 +298,12 @@ class Probe { template static void get_three_points(T points[3]) { #if HAS_FIXED_3POINT - #define VALIDATE_PROBE_PT(N) static_assert(Probe::build_time::can_reach(xy_pos_t{PROBE_PT_##N##_X, PROBE_PT_##N##_Y}), \ - "PROBE_PT_" STRINGIFY(N) "_(X|Y) is unreachable using default NOZZLE_TO_PROBE_OFFSET and PROBING_MARGIN"); + #define VALIDATE_PROBE_PT(N) static_assert(Probe::build_time::can_reach(xy_pos_t(PROBE_PT_##N)), \ + "PROBE_PT_" STRINGIFY(N) " is unreachable using default NOZZLE_TO_PROBE_OFFSET and PROBING_MARGIN."); VALIDATE_PROBE_PT(1); VALIDATE_PROBE_PT(2); VALIDATE_PROBE_PT(3); - points[0] = xy_float_t({ PROBE_PT_1_X, PROBE_PT_1_Y }); - points[1] = xy_float_t({ PROBE_PT_2_X, PROBE_PT_2_Y }); - points[2] = xy_float_t({ PROBE_PT_3_X, PROBE_PT_3_Y }); + points[0] = xy_float_t(PROBE_PT_1); + points[1] = xy_float_t(PROBE_PT_2); + points[2] = xy_float_t(PROBE_PT_3); #else #if IS_KINEMATIC constexpr float SIN0 = 0.0, SIN120 = 0.866025, SIN240 = -0.866025, @@ -307,6 +311,10 @@ class Probe { points[0] = xy_float_t({ (X_CENTER) + probe_radius() * COS0, (Y_CENTER) + probe_radius() * SIN0 }); points[1] = xy_float_t({ (X_CENTER) + probe_radius() * COS120, (Y_CENTER) + probe_radius() * SIN120 }); points[2] = xy_float_t({ (X_CENTER) + probe_radius() * COS240, (Y_CENTER) + probe_radius() * SIN240 }); + #elif ENABLED(AUTO_BED_LEVELING_UBL) + points[0] = xy_float_t({ _MAX(float(MESH_MIN_X), min_x()), _MAX(float(MESH_MIN_Y), min_y()) }); + points[1] = xy_float_t({ _MIN(float(MESH_MAX_X), max_x()), _MAX(float(MESH_MIN_Y), min_y()) }); + points[2] = xy_float_t({ (_MAX(float(MESH_MIN_X), min_x()) + _MIN(float(MESH_MAX_X), max_x())) / 2, _MIN(float(MESH_MAX_Y), max_y()) }); #else points[0] = xy_float_t({ min_x(), min_y() }); points[1] = xy_float_t({ max_x(), min_y() }); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 8b615f2faf14..0be7f965a484 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1638,7 +1638,7 @@ void MarlinSettings::postprocess() { // // Input Shaping /// - #if HAS_SHAPING + #if HAS_ZV_SHAPING #if ENABLED(INPUT_SHAPING_X) EEPROM_WRITE(stepper.get_shaping_frequency(X_AXIS)); EEPROM_WRITE(stepper.get_shaping_damping_ratio(X_AXIS)); @@ -3429,7 +3429,7 @@ void MarlinSettings::reset() { // // Input Shaping // - #if HAS_SHAPING + #if HAS_ZV_SHAPING #if ENABLED(INPUT_SHAPING_X) stepper.set_shaping_frequency(X_AXIS, SHAPING_FREQ_X); stepper.set_shaping_damping_ratio(X_AXIS, SHAPING_ZETA_X); @@ -3690,7 +3690,7 @@ void MarlinSettings::reset() { // // Input Shaping // - TERN_(HAS_SHAPING, gcode.M593_report(forReplay)); + TERN_(HAS_ZV_SHAPING, gcode.M593_report(forReplay)); // // Linear Advance diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 0750fd82aa74..f40afc6191a7 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -91,6 +91,10 @@ Stepper stepper; // Singleton #include "planner.h" #include "motion.h" +#if ENABLED(FT_MOTION) + #include "ft_motion.h" +#endif + #include "../lcd/marlinui.h" #include "../gcode/queue.h" #include "../sd/cardreader.h" @@ -189,7 +193,14 @@ bool Stepper::abort_current_block; #endif uint32_t Stepper::acceleration_time, Stepper::deceleration_time; -uint8_t Stepper::steps_per_isr; + +#if MULTISTEPPING_LIMIT > 1 + uint8_t Stepper::steps_per_isr = 1; // Count of steps to perform per Stepper ISR call +#endif + +#if DISABLED(OLD_ADAPTIVE_MULTISTEPPING) + hal_timer_t Stepper::time_spent_in_isr = 0, Stepper::time_spent_out_isr = 0; +#endif #if ENABLED(FREEZE_FEATURE) bool Stepper::frozen; // = false @@ -225,14 +236,15 @@ uint32_t Stepper::advance_divisor = 0, #endif #if ENABLED(LIN_ADVANCE) - uint32_t Stepper::nextAdvanceISR = LA_ADV_NEVER, - Stepper::la_interval = LA_ADV_NEVER; - int32_t Stepper::la_delta_error = 0, - Stepper::la_dividend = 0, - Stepper::la_advance_steps = 0; + hal_timer_t Stepper::nextAdvanceISR = LA_ADV_NEVER, + Stepper::la_interval = LA_ADV_NEVER; + int32_t Stepper::la_delta_error = 0, + Stepper::la_dividend = 0, + Stepper::la_advance_steps = 0; + bool Stepper::la_active = false; #endif -#if HAS_SHAPING +#if HAS_ZV_SHAPING shaping_time_t ShapingQueue::now = 0; shaping_time_t ShapingQueue::times[shaping_echoes]; shaping_echo_axis_t ShapingQueue::echo_axes[shaping_echoes]; @@ -255,14 +267,14 @@ uint32_t Stepper::advance_divisor = 0, #endif #if ENABLED(INTEGRATED_BABYSTEPPING) - uint32_t Stepper::nextBabystepISR = BABYSTEP_NEVER; + hal_timer_t Stepper::nextBabystepISR = BABYSTEP_NEVER; #endif #if ENABLED(DIRECT_STEPPING) page_step_state_t Stepper::page_step_state; #endif -int32_t Stepper::ticks_nominal = -1; +hal_timer_t Stepper::ticks_nominal = 0; #if DISABLED(S_CURVE_ACCELERATION) uint32_t Stepper::acc_step_rate; // needed for deceleration start point #endif @@ -610,27 +622,26 @@ void Stepper::set_directions() { TERN_(HAS_V_DIR, SET_STEP_DIR(V)); TERN_(HAS_W_DIR, SET_STEP_DIR(W)); - #if ENABLED(MIXING_EXTRUDER) + #if HAS_EXTRUDERS // Because this is valid for the whole block we don't know // what E steppers will step. Likely all. Set all. if (motor_direction(E_AXIS)) { - MIXER_STEPPER_LOOP(j) REV_E_DIR(j); - count_direction.e = -1; - } - else { - MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); - count_direction.e = 1; - } - #elif HAS_EXTRUDERS - if (motor_direction(E_AXIS)) { - REV_E_DIR(stepper_extruder); + #if ENABLED(MIXING_EXTRUDER) + MIXER_STEPPER_LOOP(j) REV_E_DIR(j); + #else + REV_E_DIR(stepper_extruder); + #endif count_direction.e = -1; } else { - NORM_E_DIR(stepper_extruder); + #if ENABLED(MIXING_EXTRUDER) + MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); + #else + NORM_E_DIR(stepper_extruder); + #endif count_direction.e = 1; } - #endif + #endif // HAS_EXTRUDERS DIR_WAIT_AFTER(); } @@ -1462,7 +1473,7 @@ HAL_STEP_TIMER_ISR() { void Stepper::isr() { - static uint32_t nextMainISR = 0; // Interval until the next main Stepper Pulse phase (0 = Now) + static hal_timer_t nextMainISR = 0; // Interval until the next main Stepper Pulse phase (0 = Now) #ifndef __AVR__ // Disable interrupts, to avoid ISR preemption while we reprogram the period @@ -1481,63 +1492,133 @@ void Stepper::isr() { // Limit the amount of iterations uint8_t max_loops = 10; + #if ENABLED(FT_MOTION) + static bool fxdTiCtrl_stepCmdRdy = false; // Indicates a step command was loaded from the + // buffers and is ready to be output. + static bool fxdTiCtrl_applyDir = false; // Indicates the DIR output should be set. + static ft_command_t fxdTiCtrl_stepCmd = 0U; // Storage for the step command to be output. + static uint32_t fxdTiCtrl_nextAuxISR = 0U; // Storage for the next ISR of the auxilliary tasks. + #endif + // We need this variable here to be able to use it in the following loop hal_timer_t min_ticks; do { // Enable ISRs to reduce USART processing latency hal.isr_on(); - TERN_(HAS_SHAPING, shaping_isr()); // Do Shaper stepping, if needed + hal_timer_t interval; + + #if ENABLED(FT_MOTION) - if (!nextMainISR) pulse_phase_isr(); // 0 = Do coordinated axes Stepper pulses + // NOTE STEPPER_TIMER_RATE is equal to 2000000, not what VSCode shows + const bool using_fxtictrl = fxdTiCtrl.cfg_mode; + if (using_fxtictrl) { + if (!nextMainISR) { + if (abort_current_block) { + fxdTiCtrl_stepCmdRdy = false; // If a command was ready, cancel it. + fxdTiCtrl.sts_stepperBusy = false; // Set busy false to allow a reset. + nextMainISR = 0.01f * (STEPPER_TIMER_RATE); // Come back in 10 msec. + } + else { // !(abort_current_block) + if (fxdTiCtrl_stepCmdRdy) { + fxdTiCtrl_stepper(fxdTiCtrl_applyDir, fxdTiCtrl_stepCmd); + fxdTiCtrl_stepCmdRdy = false; + } + // Check if there is data in the buffers. + if (fxdTiCtrl.stepperCmdBuff_produceIdx != fxdTiCtrl.stepperCmdBuff_consumeIdx) { - #if ENABLED(LIN_ADVANCE) - if (!nextAdvanceISR) { // 0 = Do Linear Advance E Stepper pulses - advance_isr(); - nextAdvanceISR = la_interval; + fxdTiCtrl.sts_stepperBusy = true; + + // "Pop" one command from the command buffer. + fxdTiCtrl_stepCmd = fxdTiCtrl.stepperCmdBuff[fxdTiCtrl.stepperCmdBuff_consumeIdx]; + const uint8_t dir_index = fxdTiCtrl.stepperCmdBuff_consumeIdx >> 3, + dir_bit = fxdTiCtrl.stepperCmdBuff_consumeIdx & 0x7; + fxdTiCtrl_applyDir = TEST(fxdTiCtrl.stepperCmdBuff_ApplyDir[dir_index], dir_bit); + nextMainISR = fxdTiCtrl.stepperCmdBuff_StepRelativeTi[fxdTiCtrl.stepperCmdBuff_consumeIdx]; + fxdTiCtrl_stepCmdRdy = true; + + if (++fxdTiCtrl.stepperCmdBuff_consumeIdx == (FTM_STEPPERCMD_BUFF_SIZE)) + fxdTiCtrl.stepperCmdBuff_consumeIdx = 0; + + } + else { // Buffer empty. + fxdTiCtrl.sts_stepperBusy = false; + nextMainISR = 0.01f * (STEPPER_TIMER_RATE); // Come back in 10 msec. + } + } // !(abort_current_block) + } // if (!nextMainISR) + + // Define 2.5 msec task for auxilliary functions. + if (!fxdTiCtrl_nextAuxISR) { + endstops.update(); + TERN_(INTEGRATED_BABYSTEPPING, if (babystep.has_steps()) babystepping_isr()); + fxdTiCtrl_refreshAxisDidMove(); + fxdTiCtrl_nextAuxISR = 0.0025f * (STEPPER_TIMER_RATE); + } + + interval = _MIN(nextMainISR, fxdTiCtrl_nextAuxISR); + nextMainISR -= interval; + fxdTiCtrl_nextAuxISR -= interval; } - else if (nextAdvanceISR == LA_ADV_NEVER) // Start LA steps if necessary - nextAdvanceISR = la_interval; - #endif - #if ENABLED(INTEGRATED_BABYSTEPPING) - const bool is_babystep = (nextBabystepISR == 0); // 0 = Do Babystepping (XY)Z pulses - if (is_babystep) nextBabystepISR = babystepping_isr(); + #else + + constexpr bool using_fxtictrl = false; + #endif - // ^== Time critical. NOTHING besides pulse generation should be above here!!! + if (!using_fxtictrl) { - if (!nextMainISR) nextMainISR = block_phase_isr(); // Manage acc/deceleration, get next block + TERN_(HAS_ZV_SHAPING, shaping_isr()); // Do Shaper stepping, if needed - #if ENABLED(INTEGRATED_BABYSTEPPING) - if (is_babystep) // Avoid ANY stepping too soon after baby-stepping - NOLESS(nextMainISR, (BABYSTEP_TICKS) / 8); // FULL STOP for 125µs after a baby-step + if (!nextMainISR) pulse_phase_isr(); // 0 = Do coordinated axes Stepper pulses - if (nextBabystepISR != BABYSTEP_NEVER) // Avoid baby-stepping too close to axis Stepping - NOLESS(nextBabystepISR, nextMainISR / 2); // TODO: Only look at axes enabled for baby-stepping - #endif + #if ENABLED(LIN_ADVANCE) + if (!nextAdvanceISR) { // 0 = Do Linear Advance E Stepper pulses + advance_isr(); + nextAdvanceISR = la_interval; + } + else if (nextAdvanceISR == LA_ADV_NEVER) // Start LA steps if necessary + nextAdvanceISR = la_interval; + #endif - // Get the interval to the next ISR call - const uint32_t interval = _MIN( - uint32_t(HAL_TIMER_TYPE_MAX), // Come back in a very long time - nextMainISR // Time until the next Pulse / Block phase - OPTARG(INPUT_SHAPING_X, ShapingQueue::peek_x()) // Time until next input shaping echo for X - OPTARG(INPUT_SHAPING_Y, ShapingQueue::peek_y()) // Time until next input shaping echo for Y - OPTARG(LIN_ADVANCE, nextAdvanceISR) // Come back early for Linear Advance? - OPTARG(INTEGRATED_BABYSTEPPING, nextBabystepISR) // Come back early for Babystepping? - ); + #if ENABLED(INTEGRATED_BABYSTEPPING) + const bool is_babystep = (nextBabystepISR == 0); // 0 = Do Babystepping (XY)Z pulses + if (is_babystep) nextBabystepISR = babystepping_isr(); + #endif + + // ^== Time critical. NOTHING besides pulse generation should be above here!!! + + if (!nextMainISR) nextMainISR = block_phase_isr(); // Manage acc/deceleration, get next block - // - // Compute remaining time for each ISR phase - // NEVER : The phase is idle - // Zero : The phase will occur on the next ISR call - // Non-zero : The phase will occur on a future ISR call - // + #if ENABLED(INTEGRATED_BABYSTEPPING) + if (is_babystep) // Avoid ANY stepping too soon after baby-stepping + NOLESS(nextMainISR, (BABYSTEP_TICKS) / 8); // FULL STOP for 125µs after a baby-step + + if (nextBabystepISR != BABYSTEP_NEVER) // Avoid baby-stepping too close to axis Stepping + NOLESS(nextBabystepISR, nextMainISR / 2); // TODO: Only look at axes enabled for baby-stepping + #endif - nextMainISR -= interval; - TERN_(HAS_SHAPING, ShapingQueue::decrement_delays(interval)); - TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval); - TERN_(INTEGRATED_BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval); + // Get the interval to the next ISR call + interval = _MIN(nextMainISR, uint32_t(HAL_TIMER_TYPE_MAX)); // Time until the next Pulse / Block phase + TERN_(INPUT_SHAPING_X, NOMORE(interval, ShapingQueue::peek_x())); // Time until next input shaping echo for X + TERN_(INPUT_SHAPING_Y, NOMORE(interval, ShapingQueue::peek_y())); // Time until next input shaping echo for Y + TERN_(LIN_ADVANCE, NOMORE(interval, nextAdvanceISR)); // Come back early for Linear Advance? + TERN_(INTEGRATED_BABYSTEPPING, NOMORE(interval, nextBabystepISR)); // Come back early for Babystepping? + + // + // Compute remaining time for each ISR phase + // NEVER : The phase is idle + // Zero : The phase will occur on the next ISR call + // Non-zero : The phase will occur on a future ISR call + // + + nextMainISR -= interval; + TERN_(HAS_ZV_SHAPING, ShapingQueue::decrement_delays(interval)); + TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval); + TERN_(INTEGRATED_BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval); + + } // standard motion control /** * This needs to avoid a race-condition caused by interleaving @@ -1583,25 +1664,56 @@ void Stepper::isr() { */ min_ticks = HAL_timer_get_count(MF_TIMER_STEP) + hal_timer_t(TERN(__AVR__, 8, 1) * (STEPPER_TIMER_TICKS_PER_US)); - /** - * NB: If for some reason the stepper monopolizes the MPU, eventually the - * timer will wrap around (and so will 'next_isr_ticks'). So, limit the - * loop to 10 iterations. Beyond that, there's no way to ensure correct pulse - * timing, since the MCU isn't fast enough. - */ - if (!--max_loops) next_isr_ticks = min_ticks; + #if ENABLED(OLD_ADAPTIVE_MULTISTEPPING) + /** + * NB: If for some reason the stepper monopolizes the MPU, eventually the + * timer will wrap around (and so will 'next_isr_ticks'). So, limit the + * loop to 10 iterations. Beyond that, there's no way to ensure correct pulse + * timing, since the MCU isn't fast enough. + */ + if (!--max_loops) next_isr_ticks = min_ticks; + #endif // Advance pulses if not enough time to wait for the next ISR - } while (next_isr_ticks < min_ticks); + } while (TERN(OLD_ADAPTIVE_MULTISTEPPING, true, --max_loops) && next_isr_ticks < min_ticks); + + #if DISABLED(OLD_ADAPTIVE_MULTISTEPPING) + + // Track the time spent in the ISR + const hal_timer_t time_spent = HAL_timer_get_count(MF_TIMER_STEP); + time_spent_in_isr += time_spent; + + if (next_isr_ticks < min_ticks) { + next_isr_ticks = min_ticks; + + // When forced out of the ISR, increase multi-stepping + #if MULTISTEPPING_LIMIT > 1 + if (steps_per_isr < MULTISTEPPING_LIMIT) { + steps_per_isr <<= 1; + // ticks_nominal will need to be recalculated if we are in cruise phase + ticks_nominal = 0; + } + #endif + } + else { + // Track the time spent voluntarily outside the ISR + time_spent_out_isr += next_isr_ticks; + time_spent_out_isr -= time_spent; + } + + #endif // !OLD_ADAPTIVE_MULTISTEPPING // Now 'next_isr_ticks' contains the period to the next Stepper ISR - And we are // sure that the time has not arrived yet - Warrantied by the scheduler // Set the next ISR to fire at the proper time - HAL_timer_set_compare(MF_TIMER_STEP, hal_timer_t(next_isr_ticks)); + HAL_timer_set_compare(MF_TIMER_STEP, next_isr_ticks); - // Don't forget to finally reenable interrupts - hal.isr_on(); + // Don't forget to finally reenable interrupts on non-AVR. + // AVR automatically calls sei() for us on Return-from-Interrupt. + #ifndef __AVR__ + hal.isr_on(); + #endif } #if MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE @@ -1625,7 +1737,7 @@ void Stepper::pulse_phase_isr() { abort_current_block = false; if (current_block) { discard_current_block(); - #if HAS_SHAPING + #if HAS_ZV_SHAPING ShapingQueue::purge(); #if ENABLED(INPUT_SHAPING_X) shaping_x.delta_error = 0; @@ -1657,21 +1769,24 @@ void Stepper::pulse_phase_isr() { bool firstStep = true; USING_TIMED_PULSE(); #endif - xyze_bool_t step_needed{0}; // Direct Stepping page? const bool is_page = current_block->is_page(); do { + AxisFlags step_needed{0}; + #define _APPLY_STEP(AXIS, INV, ALWAYS) AXIS ##_APPLY_STEP(INV, ALWAYS) #define _STEP_STATE(AXIS) STEP_STATE_## AXIS // Determine if a pulse is needed using Bresenham #define PULSE_PREP(AXIS) do{ \ - delta_error[_AXIS(AXIS)] += advance_dividend[_AXIS(AXIS)]; \ - step_needed[_AXIS(AXIS)] = (delta_error[_AXIS(AXIS)] >= 0); \ - if (step_needed[_AXIS(AXIS)]) \ - delta_error[_AXIS(AXIS)] -= advance_divisor; \ + int32_t de = delta_error[_AXIS(AXIS)] + advance_dividend[_AXIS(AXIS)]; \ + if (de >= 0) { \ + step_needed.set(_AXIS(AXIS)); \ + de -= advance_divisor_cached; \ + } \ + delta_error[_AXIS(AXIS)] = de; \ }while(0) // With input shaping, direction changes can happen with almost only @@ -1695,24 +1810,27 @@ void Stepper::pulse_phase_isr() { #define HYSTERESIS(AXIS) _HYSTERESIS(AXIS) #define PULSE_PREP_SHAPING(AXIS, DELTA_ERROR, DIVIDEND) do{ \ - if (step_needed[_AXIS(AXIS)]) { \ - DELTA_ERROR += (DIVIDEND); \ - if ((MAXDIR(AXIS) && DELTA_ERROR <= -(64 + HYSTERESIS(AXIS))) || (MINDIR(AXIS) && DELTA_ERROR >= (64 + HYSTERESIS(AXIS)))) { \ + int16_t de = DELTA_ERROR + (DIVIDEND); \ + const bool step_fwd = de >= (64 + HYSTERESIS(AXIS)), \ + step_bak = de <= -(64 + HYSTERESIS(AXIS)); \ + if (step_fwd || step_bak) { \ + de += step_fwd ? -128 : 128; \ + if ((MAXDIR(AXIS) && step_bak) || (MINDIR(AXIS) && step_fwd)) { \ { USING_TIMED_PULSE(); START_TIMED_PULSE(); AWAIT_LOW_PULSE(); } \ TBI(last_direction_bits, _AXIS(AXIS)); \ DIR_WAIT_BEFORE(); \ SET_STEP_DIR(AXIS); \ DIR_WAIT_AFTER(); \ } \ - step_needed[_AXIS(AXIS)] = DELTA_ERROR <= -(64 + HYSTERESIS(AXIS)) || DELTA_ERROR >= (64 + HYSTERESIS(AXIS)); \ - if (step_needed[_AXIS(AXIS)]) \ - DELTA_ERROR += MAXDIR(AXIS) ? -128 : 128; \ } \ + else \ + step_needed.clear(_AXIS(AXIS)); \ + DELTA_ERROR = de; \ }while(0) // Start an active pulse if needed #define PULSE_START(AXIS) do{ \ - if (step_needed[_AXIS(AXIS)]) { \ + if (step_needed.test(_AXIS(AXIS))) { \ count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ _APPLY_STEP(AXIS, _STEP_STATE(AXIS), 0); \ } \ @@ -1720,7 +1838,7 @@ void Stepper::pulse_phase_isr() { // Stop an active pulse if needed #define PULSE_STOP(AXIS) do { \ - if (step_needed[_AXIS(AXIS)]) { \ + if (step_needed.test(_AXIS(AXIS))) { \ _APPLY_STEP(AXIS, !_STEP_STATE(AXIS), 0); \ } \ }while(0) @@ -1739,8 +1857,8 @@ void Stepper::pulse_phase_isr() { }while(0) #define PAGE_PULSE_PREP(AXIS) do{ \ - step_needed[_AXIS(AXIS)] = \ - pgm_read_byte(&segment_table[page_step_state.sd[_AXIS(AXIS)]][page_step_state.segment_steps & 0x7]); \ + step_needed.set(_AXIS(AXIS), \ + pgm_read_byte(&segment_table[page_step_state.sd[_AXIS(AXIS)]][page_step_state.segment_steps & 0x7])); \ }while(0) switch (page_step_state.segment_steps) { @@ -1780,8 +1898,8 @@ void Stepper::pulse_phase_isr() { page_step_state.bd[_AXIS(AXIS)] += VALUE; #define PAGE_PULSE_PREP(AXIS) do{ \ - step_needed[_AXIS(AXIS)] = \ - pgm_read_byte(&segment_table[page_step_state.sd[_AXIS(AXIS)]][page_step_state.segment_steps & 0x3]); \ + step_needed.set(_AXIS(AXIS), \ + pgm_read_byte(&segment_table[page_step_state.sd[_AXIS(AXIS)]][page_step_state.segment_steps & 0x3])); \ }while(0) switch (page_step_state.segment_steps) { @@ -1808,10 +1926,10 @@ void Stepper::pulse_phase_isr() { #elif STEPPER_PAGE_FORMAT == SP_4x1_512 - #define PAGE_PULSE_PREP(AXIS, BITS) do{ \ - step_needed[_AXIS(AXIS)] = (steps >> BITS) & 0x1; \ - if (step_needed[_AXIS(AXIS)]) \ - page_step_state.bd[_AXIS(AXIS)]++; \ + #define PAGE_PULSE_PREP(AXIS, NBIT) do{ \ + step_needed.set(_AXIS(AXIS), TEST(steps, NBIT)); \ + if (step_needed.test(_AXIS(AXIS))) \ + page_step_state.bd[_AXIS(AXIS)]++; \ }while(0) uint8_t steps = page_step_state.page[page_step_state.segment_idx >> 1]; @@ -1832,6 +1950,9 @@ void Stepper::pulse_phase_isr() { #endif // DIRECT_STEPPING if (!is_page) { + // Give the compiler a clue to store advance_divisor in registers for what follows + const uint32_t advance_divisor_cached = advance_divisor; + // Determine if pulses are needed #if HAS_X_STEP PULSE_PREP(X); @@ -1865,31 +1986,30 @@ void Stepper::pulse_phase_isr() { PULSE_PREP(E); #if ENABLED(LIN_ADVANCE) - if (step_needed.e && current_block->la_advance_rate) { + if (la_active && step_needed.e) { // don't actually step here, but do subtract movements steps // from the linear advance step count step_needed.e = false; - count_position.e -= count_direction.e; la_advance_steps--; } #endif #endif - #if HAS_SHAPING + #if HAS_ZV_SHAPING // record an echo if a step is needed in the primary bresenham - const bool x_step = TERN0(INPUT_SHAPING_X, shaping_x.enabled && step_needed[X_AXIS]), - y_step = TERN0(INPUT_SHAPING_Y, shaping_y.enabled && step_needed[Y_AXIS]); + const bool x_step = TERN0(INPUT_SHAPING_X, step_needed.x && shaping_x.enabled), + y_step = TERN0(INPUT_SHAPING_Y, step_needed.y && shaping_y.enabled); if (x_step || y_step) ShapingQueue::enqueue(x_step, TERN0(INPUT_SHAPING_X, shaping_x.forward), y_step, TERN0(INPUT_SHAPING_Y, shaping_y.forward)); // do the first part of the secondary bresenham #if ENABLED(INPUT_SHAPING_X) - if (shaping_x.enabled) - PULSE_PREP_SHAPING(X, shaping_x.delta_error, shaping_x.factor1 * (shaping_x.forward ? 1 : -1)); + if (x_step) + PULSE_PREP_SHAPING(X, shaping_x.delta_error, shaping_x.forward ? shaping_x.factor1 : -shaping_x.factor1); #endif #if ENABLED(INPUT_SHAPING_Y) - if (shaping_y.enabled) - PULSE_PREP_SHAPING(Y, shaping_y.delta_error, shaping_y.factor1 * (shaping_y.forward ? 1 : -1)); + if (y_step) + PULSE_PREP_SHAPING(Y, shaping_y.delta_error, shaping_y.forward ? shaping_y.factor1 : -shaping_y.factor1); #endif #endif } @@ -1932,7 +2052,7 @@ void Stepper::pulse_phase_isr() { #if ENABLED(MIXING_EXTRUDER) if (step_needed.e) { - count_position[E_AXIS] += count_direction[E_AXIS]; + count_position.e += count_direction.e; E_STEP_WRITE(mixer.get_next_stepper(), STEP_STATE_E); } #elif HAS_E0_STEP @@ -1989,28 +2109,28 @@ void Stepper::pulse_phase_isr() { } while (--events_to_do); } -#if HAS_SHAPING +#if HAS_ZV_SHAPING void Stepper::shaping_isr() { - xy_bool_t step_needed{0}; + AxisFlags step_needed{0}; - // Clear the echoes that are ready to process. If the buffers are too full and risk overflo, also apply echoes early. - TERN_(INPUT_SHAPING_X, step_needed[X_AXIS] = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); - TERN_(INPUT_SHAPING_Y, step_needed[Y_AXIS] = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); + // Clear the echoes that are ready to process. If the buffers are too full and risk overflow, also apply echoes early. + TERN_(INPUT_SHAPING_X, step_needed.x = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); + TERN_(INPUT_SHAPING_Y, step_needed.y = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); if (bool(step_needed)) while (true) { #if ENABLED(INPUT_SHAPING_X) - if (step_needed[X_AXIS]) { + if (step_needed.x) { const bool forward = ShapingQueue::dequeue_x(); - PULSE_PREP_SHAPING(X, shaping_x.delta_error, shaping_x.factor2 * (forward ? 1 : -1)); + PULSE_PREP_SHAPING(X, shaping_x.delta_error, (forward ? shaping_x.factor2 : -shaping_x.factor2)); PULSE_START(X); } #endif #if ENABLED(INPUT_SHAPING_Y) - if (step_needed[Y_AXIS]) { + if (step_needed.y) { const bool forward = ShapingQueue::dequeue_y(); - PULSE_PREP_SHAPING(Y, shaping_y.delta_error, shaping_y.factor2 * (forward ? 1 : -1)); + PULSE_PREP_SHAPING(Y, shaping_y.delta_error, (forward ? shaping_y.factor2 : -shaping_y.factor2)); PULSE_START(Y); } #endif @@ -2031,8 +2151,8 @@ void Stepper::pulse_phase_isr() { #endif } - TERN_(INPUT_SHAPING_X, step_needed[X_AXIS] = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); - TERN_(INPUT_SHAPING_Y, step_needed[Y_AXIS] = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); + TERN_(INPUT_SHAPING_X, step_needed.x = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); + TERN_(INPUT_SHAPING_Y, step_needed.y = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); if (!bool(step_needed)) break; @@ -2041,79 +2161,124 @@ void Stepper::pulse_phase_isr() { } } -#endif // HAS_SHAPING +#endif // HAS_ZV_SHAPING // Calculate timer interval, with all limits applied. -uint32_t Stepper::calc_timer_interval(uint32_t step_rate) { +hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate) { + #ifdef CPU_32_BIT - // In case of high-performance processor, it is able to calculate in real-time - return uint32_t(STEPPER_TIMER_RATE) / step_rate; + + // A fast processor can just do integer division + return step_rate ? uint32_t(STEPPER_TIMER_RATE) / step_rate : HAL_TIMER_TYPE_MAX; + #else - // AVR is able to keep up at 30khz Stepping ISR rate. - constexpr uint32_t min_step_rate = (F_CPU) / 500000U; - if (step_rate <= min_step_rate) { - step_rate = 0; - uintptr_t table_address = (uintptr_t)&speed_lookuptable_slow[0][0]; - return uint16_t(pgm_read_word(table_address)); + + constexpr uint32_t min_step_rate = (F_CPU) / 500000U; // i.e., 32 or 40 + if (step_rate >= 0x0800) { // higher step rate + // AVR is able to keep up at around 65kHz Stepping ISR rate at most. + // So values for step_rate > 65535 might as well be truncated. + // Handle it as quickly as possible. i.e., assume highest byte is zero + // because non-zero would represent a step rate far beyond AVR capabilities. + if (uint8_t(step_rate >> 16)) + return uint32_t(STEPPER_TIMER_RATE) / 0x10000; + + const uintptr_t table_address = uintptr_t(&speed_lookuptable_fast[uint8_t(step_rate >> 8)]); + const uint16_t base = uint16_t(pgm_read_word(table_address)); + const uint8_t gain = uint8_t(pgm_read_byte(table_address + 2)); + return base - MultiU8X8toH8(uint8_t(step_rate & 0x00FF), gain); } - else { + else if (step_rate > min_step_rate) { // lower step rates step_rate -= min_step_rate; // Correct for minimal speed - if (step_rate >= 0x0800) { // higher step rate - const uint8_t rate_mod_256 = (step_rate & 0x00FF); - const uintptr_t table_address = uintptr_t(&speed_lookuptable_fast[uint8_t(step_rate >> 8)][0]), - gain = uint16_t(pgm_read_word(table_address + 2)); - return uint16_t(pgm_read_word(table_address)) - MultiU8X16toH16(rate_mod_256, gain); - } - else { // lower step rates - uintptr_t table_address = uintptr_t(&speed_lookuptable_slow[0][0]); - table_address += (step_rate >> 1) & 0xFFFC; - return uint16_t(pgm_read_word(table_address)) - - ((uint16_t(pgm_read_word(table_address + 2)) * uint8_t(step_rate & 0x0007)) >> 3); - } + const uintptr_t table_address = uintptr_t(&speed_lookuptable_slow[uint8_t(step_rate >> 3)]); + return uint16_t(pgm_read_word(table_address)) + - ((uint16_t(pgm_read_word(table_address + 2)) * uint8_t(step_rate & 0x0007)) >> 3); } - #endif + + return uint16_t(pgm_read_word(uintptr_t(speed_lookuptable_slow))); + + #endif // !CPU_32_BIT } // Get the timer interval and the number of loops to perform per tick -uint32_t Stepper::calc_timer_interval(uint32_t step_rate, uint8_t &loops) { - uint8_t multistep = 1; - #if DISABLED(DISABLE_MULTI_STEPPING) - - // The stepping frequency limits for each multistepping rate - static const uint32_t limit[] PROGMEM = { - ( MAX_STEP_ISR_FREQUENCY_1X ), - ( MAX_STEP_ISR_FREQUENCY_2X >> 1), - ( MAX_STEP_ISR_FREQUENCY_4X >> 2), - ( MAX_STEP_ISR_FREQUENCY_8X >> 3), - ( MAX_STEP_ISR_FREQUENCY_16X >> 4), - ( MAX_STEP_ISR_FREQUENCY_32X >> 5), - ( MAX_STEP_ISR_FREQUENCY_64X >> 6), - (MAX_STEP_ISR_FREQUENCY_128X >> 7) - }; - - // Select the proper multistepping - uint8_t idx = 0; - while (idx < 7 && step_rate > (uint32_t)pgm_read_dword(&limit[idx])) { - step_rate >>= 1; - multistep <<= 1; - ++idx; - }; - #else - NOMORE(step_rate, uint32_t(MAX_STEP_ISR_FREQUENCY_1X)); +hal_timer_t Stepper::calc_multistep_timer_interval(uint32_t step_rate) { + + #if ENABLED(OLD_ADAPTIVE_MULTISTEPPING) + + #if MULTISTEPPING_LIMIT == 1 + + // Just make sure the step rate is doable + NOMORE(step_rate, uint32_t(MAX_STEP_ISR_FREQUENCY_1X)); + + #else + + // The stepping frequency limits for each multistepping rate + static const uint32_t limit[] PROGMEM = { + ( MAX_STEP_ISR_FREQUENCY_1X ) + , (((F_CPU) / ISR_EXECUTION_CYCLES(1)) >> 1) + #if MULTISTEPPING_LIMIT >= 4 + , (((F_CPU) / ISR_EXECUTION_CYCLES(2)) >> 2) + #endif + #if MULTISTEPPING_LIMIT >= 8 + , (((F_CPU) / ISR_EXECUTION_CYCLES(3)) >> 3) + #endif + #if MULTISTEPPING_LIMIT >= 16 + , (((F_CPU) / ISR_EXECUTION_CYCLES(4)) >> 4) + #endif + #if MULTISTEPPING_LIMIT >= 32 + , (((F_CPU) / ISR_EXECUTION_CYCLES(5)) >> 5) + #endif + #if MULTISTEPPING_LIMIT >= 64 + , (((F_CPU) / ISR_EXECUTION_CYCLES(6)) >> 6) + #endif + #if MULTISTEPPING_LIMIT >= 128 + , (((F_CPU) / ISR_EXECUTION_CYCLES(7)) >> 7) + #endif + }; + + // Find a doable step rate using multistepping + uint8_t multistep = 1; + for (uint8_t i = 0; i < COUNT(limit) && step_rate > uint32_t(pgm_read_dword(&limit[i])); ++i) { + step_rate >>= 1; + multistep <<= 1; + } + steps_per_isr = multistep; + + #endif + + #elif MULTISTEPPING_LIMIT > 1 + + uint8_t loops = steps_per_isr; + if (MULTISTEPPING_LIMIT >= 16 && loops >= 16) { step_rate >>= 4; loops >>= 4; } + if (MULTISTEPPING_LIMIT >= 4 && loops >= 4) { step_rate >>= 2; loops >>= 2; } + if (MULTISTEPPING_LIMIT >= 2 && loops >= 2) { step_rate >>= 1; } + #endif - loops = multistep; return calc_timer_interval(step_rate); } -// This is the last half of the stepper interrupt: This one processes and -// properly schedules blocks from the planner. This is executed after creating -// the step pulses, so it is not time critical, as pulses are already done. - -uint32_t Stepper::block_phase_isr() { +/** + * This last phase of the stepper interrupt processes and properly + * schedules planner blocks. This is executed after the step pulses + * have been done, so it is less time critical. + */ +hal_timer_t Stepper::block_phase_isr() { + #if DISABLED(OLD_ADAPTIVE_MULTISTEPPING) + // If the ISR uses < 50% of MPU time, halve multi-stepping + const hal_timer_t time_spent = HAL_timer_get_count(MF_TIMER_STEP); + #if MULTISTEPPING_LIMIT > 1 + if (steps_per_isr > 1 && time_spent_out_isr >= time_spent_in_isr + time_spent) { + steps_per_isr >>= 1; + // ticks_nominal will need to be recalculated if we are in cruise phase + ticks_nominal = 0; + } + #endif + time_spent_in_isr = -time_spent; // unsigned but guaranteed to be +ve when needed + time_spent_out_isr = 0; + #endif // If no queued movements, just wait 1ms for the next block - uint32_t interval = (STEPPER_TIMER_RATE) / 1000UL; + hal_timer_t interval = (STEPPER_TIMER_RATE) / 1000UL; // If there is a current block if (current_block) { @@ -2158,13 +2323,13 @@ uint32_t Stepper::block_phase_isr() { // acc_step_rate is in steps/second // step_rate to timer interval and steps per stepper isr - interval = calc_timer_interval(acc_step_rate << oversampling_factor, steps_per_isr); + interval = calc_multistep_timer_interval(acc_step_rate << oversampling_factor); acceleration_time += interval; #if ENABLED(LIN_ADVANCE) - if (current_block->la_advance_rate) { + if (la_active) { const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0; - la_interval = calc_timer_interval(acc_step_rate + la_step_rate) << current_block->la_scaling; + la_interval = calc_timer_interval((acc_step_rate + la_step_rate) >> current_block->la_scaling); } #endif @@ -2228,15 +2393,15 @@ uint32_t Stepper::block_phase_isr() { #endif // step_rate to timer interval and steps per stepper isr - interval = calc_timer_interval(step_rate << oversampling_factor, steps_per_isr); + interval = calc_multistep_timer_interval(step_rate << oversampling_factor); deceleration_time += interval; #if ENABLED(LIN_ADVANCE) - if (current_block->la_advance_rate) { + if (la_active) { const uint32_t la_step_rate = la_advance_steps > current_block->final_adv_steps ? current_block->la_advance_rate : 0; if (la_step_rate != step_rate) { bool reverse_e = la_step_rate > step_rate; - la_interval = calc_timer_interval(reverse_e ? la_step_rate - step_rate : step_rate - la_step_rate) << current_block->la_scaling; + la_interval = calc_timer_interval((reverse_e ? la_step_rate - step_rate : step_rate - la_step_rate) >> current_block->la_scaling); if (reverse_e != motor_direction(E_AXIS)) { TBI(last_direction_bits, E_AXIS); @@ -2262,6 +2427,8 @@ uint32_t Stepper::block_phase_isr() { DIR_WAIT_AFTER(); } } + else + la_interval = LA_ADV_NEVER; } #endif // LIN_ADVANCE @@ -2286,13 +2453,13 @@ uint32_t Stepper::block_phase_isr() { else { // Must be in cruise phase otherwise // Calculate the ticks_nominal for this nominal speed, if not done yet - if (ticks_nominal < 0) { + if (ticks_nominal == 0) { // step_rate to timer interval and loops for the nominal speed - ticks_nominal = calc_timer_interval(current_block->nominal_rate << oversampling_factor, steps_per_isr); + ticks_nominal = calc_multistep_timer_interval(current_block->nominal_rate << oversampling_factor); #if ENABLED(LIN_ADVANCE) - if (current_block->la_advance_rate) - la_interval = calc_timer_interval(current_block->nominal_rate) << current_block->la_scaling; + if (la_active) + la_interval = calc_timer_interval(current_block->nominal_rate >> current_block->la_scaling); #endif } @@ -2546,12 +2713,13 @@ uint32_t Stepper::block_phase_isr() { // Initialize the trapezoid generator from the current block. #if ENABLED(LIN_ADVANCE) + la_active = (current_block->la_advance_rate != 0); #if DISABLED(MIXING_EXTRUDER) && E_STEPPERS > 1 // If the now active extruder wasn't in use during the last move, its pressure is most likely gone. if (stepper_extruder != last_moved_extruder) la_advance_steps = 0; #endif - if (current_block->la_advance_rate) { - // apply LA scaling and discount the effect of frequency scaling + if (la_active) { + // Apply LA scaling and discount the effect of frequency scaling la_dividend = (advance_dividend.e << current_block->la_scaling) << oversampling_factor; } #endif @@ -2593,8 +2761,8 @@ uint32_t Stepper::block_phase_isr() { if (current_block->steps.z) enable_axis(Z_AXIS); #endif - // Mark the time_nominal as not calculated yet - ticks_nominal = -1; + // Mark ticks_nominal as not-yet-calculated + ticks_nominal = 0; #if ENABLED(S_CURVE_ACCELERATION) // Initialize the Bézier speed curve @@ -2607,13 +2775,13 @@ uint32_t Stepper::block_phase_isr() { #endif // Calculate the initial timer interval - interval = calc_timer_interval(current_block->initial_rate << oversampling_factor, steps_per_isr); + interval = calc_multistep_timer_interval(current_block->initial_rate << oversampling_factor); acceleration_time += interval; #if ENABLED(LIN_ADVANCE) - if (current_block->la_advance_rate) { + if (la_active) { const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0; - la_interval = calc_timer_interval(current_block->initial_rate + la_step_rate) << current_block->la_scaling; + la_interval = calc_timer_interval((current_block->initial_rate + la_step_rate) >> current_block->la_scaling); } #endif } @@ -2631,8 +2799,8 @@ uint32_t Stepper::block_phase_isr() { // the acceleration and speed values calculated in block_phase_isr(). // This helps keep LA in sync with, for example, S_CURVE_ACCELERATION. la_delta_error += la_dividend; - const bool step_needed = la_delta_error >= 0; - if (step_needed) { + const bool e_step_needed = la_delta_error >= 0; + if (e_step_needed) { count_position.e += count_direction.e; la_advance_steps += count_direction.e; la_delta_error -= advance_divisor; @@ -2643,7 +2811,7 @@ uint32_t Stepper::block_phase_isr() { TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); - if (step_needed) { + if (e_step_needed) { // Enforce a minimum duration for STEP pulse ON #if ISR_PULSE_CONTROL USING_TIMED_PULSE(); @@ -2661,7 +2829,7 @@ uint32_t Stepper::block_phase_isr() { #if ENABLED(INTEGRATED_BABYSTEPPING) // Timer interrupt for baby-stepping - uint32_t Stepper::babystepping_isr() { + hal_timer_t Stepper::babystepping_isr() { babystep.task(); return babystep.has_steps() ? BABYSTEP_TICKS : BABYSTEP_NEVER; } @@ -3014,7 +3182,7 @@ void Stepper::init() { #endif } -#if HAS_SHAPING +#if HAS_ZV_SHAPING /** * Calculate a fixed point factor to apply to the signal and its echo @@ -3085,7 +3253,7 @@ void Stepper::init() { return -1; } -#endif // HAS_SHAPING +#endif // HAS_ZV_SHAPING /** * Set the stepper positions directly in steps @@ -3287,6 +3455,127 @@ void Stepper::report_positions() { report_a_position(pos); } +#if ENABLED(FT_MOTION) + + // Set stepper I/O for fixed time controller. + void Stepper::fxdTiCtrl_stepper(const bool applyDir, const ft_command_t command) { + + USING_TIMED_PULSE(); + + #if HAS_Z_AXIS + // Z is handled differently to update the stepper + // counts (needed by Marlin for bed level probing). + const bool z_dir = !TEST(command, FT_BIT_DIR_Z), + z_step = TEST(command, FT_BIT_STEP_Z); + #endif + + if (applyDir) { + X_DIR_WRITE(TEST(command, FT_BIT_DIR_X)); + TERN_(HAS_Y_AXIS, Y_DIR_WRITE(TEST(command, FT_BIT_DIR_Y))); + TERN_(HAS_Z_AXIS, Z_DIR_WRITE(z_dir)); + TERN_(HAS_EXTRUDERS, E0_DIR_WRITE(TEST(command, FT_BIT_DIR_E))); + DIR_WAIT_AFTER(); + } + + X_STEP_WRITE(TEST(command, FT_BIT_STEP_X)); + TERN_(HAS_Y_AXIS, Y_STEP_WRITE(TEST(command, FT_BIT_STEP_Y))); + TERN_(HAS_Z_AXIS, Z_STEP_WRITE(z_step)); + TERN_(HAS_EXTRUDERS, E0_STEP_WRITE(TEST(command, FT_BIT_STEP_E))); + + START_TIMED_PULSE(); + + #if HAS_Z_AXIS + // Update step counts + if (z_step) count_position.z += z_dir ? -1 : 1; + #endif + + AWAIT_HIGH_PULSE(); + + X_STEP_WRITE(0); + TERN_(HAS_Y_AXIS, Y_STEP_WRITE(0)); + TERN_(HAS_Z_AXIS, Z_STEP_WRITE(0)); + TERN_(HAS_EXTRUDERS, E0_STEP_WRITE(0)); + + } // Stepper::fxdTiCtrl_stepper + + void Stepper::fxdTiCtrl_BlockQueueUpdate() { + + if (current_block) { + // If the current block is not done processing, return right away + if (!fxdTiCtrl.getBlockProcDn()) return; + + axis_did_move = 0; + current_block = nullptr; + discard_current_block(); + } + + if (!current_block) { // No current block + + // Check the buffer for a new block + current_block = planner.get_current_block(); + + if (current_block) { + // Sync block? Sync the stepper counts and return + while (current_block->is_sync()) { + if (!(current_block->is_fan_sync() || current_block->is_pwr_sync())) _set_position(current_block->position); + discard_current_block(); + + // Try to get a new block + if (!(current_block = planner.get_current_block())) + return; // No more queued movements!image.png + } + + // this is needed by motor_direction() and subsequently bed leveling (somehow) + // update it here, even though it will may be out of sync with step commands + last_direction_bits = current_block->direction_bits; + + fxdTiCtrl.startBlockProc(current_block); + + } + else { + fxdTiCtrl.runoutBlock(); + return; // No queued blocks + } + + } // if (!current_block) + + } // Stepper::fxdTiCtrl_BlockQueueUpdate() + + // Debounces the axis move indication to account for potential + // delay between the block information and the stepper commands + void Stepper::fxdTiCtrl_refreshAxisDidMove() { + + // Set the debounce time in seconds. + #define AXIS_DID_MOVE_DEB 5 // TODO: The debounce time should be calculated if possible, + // or the set conditions should be changed from the block to + // the motion trajectory or motor commands. + + uint8_t axis_bits = 0U; + + static uint32_t a_debounce = 0U; + if (!!current_block->steps.a) a_debounce = (AXIS_DID_MOVE_DEB) * 400; // divide by 0.0025f + if (a_debounce) { SBI(axis_bits, A_AXIS); a_debounce--; } + #if HAS_Y_AXIS + static uint32_t b_debounce = 0U; + if (!!current_block->steps.b) b_debounce = (AXIS_DID_MOVE_DEB) * 400; + if (b_debounce) { SBI(axis_bits, B_AXIS); b_debounce--; } + #endif + #if HAS_Z_AXIS + static uint32_t c_debounce = 0U; + if (!!current_block->steps.c) c_debounce = (AXIS_DID_MOVE_DEB) * 400; + if (c_debounce) { SBI(axis_bits, C_AXIS); c_debounce--; } + #endif + #if HAS_EXTRUDERS + static uint32_t e_debounce = 0U; + if (!!current_block->steps.e) e_debounce = (AXIS_DID_MOVE_DEB) * 400; + if (e_debounce) { SBI(axis_bits, E_AXIS); e_debounce--; } + #endif + + axis_did_move = axis_bits; + } + +#endif // FT_MOTION + #if ENABLED(BABYSTEPPING) #define _ENABLE_AXIS(A) enable_axis(_AXIS(A)) @@ -3443,24 +3732,6 @@ void Stepper::report_positions() { #ifdef Z_DIR_WRITE Z_DIR_WRITE(ENABLED(INVERT_Z_DIR) ^ z_direction); #endif - #ifdef I_DIR_WRITE - I_DIR_WRITE(ENABLED(INVERT_I_DIR) ^ z_direction); - #endif - #ifdef J_DIR_WRITE - J_DIR_WRITE(ENABLED(INVERT_J_DIR) ^ z_direction); - #endif - #ifdef K_DIR_WRITE - K_DIR_WRITE(ENABLED(INVERT_K_DIR) ^ z_direction); - #endif - #ifdef U_DIR_WRITE - U_DIR_WRITE(ENABLED(INVERT_U_DIR) ^ z_direction); - #endif - #ifdef V_DIR_WRITE - V_DIR_WRITE(ENABLED(INVERT_V_DIR) ^ z_direction); - #endif - #ifdef W_DIR_WRITE - W_DIR_WRITE(ENABLED(INVERT_W_DIR) ^ z_direction); - #endif DIR_WAIT_AFTER(); @@ -3473,24 +3744,6 @@ void Stepper::report_positions() { #ifdef Z_STEP_WRITE Z_STEP_WRITE(STEP_STATE_Z); #endif - #ifdef I_STEP_WRITE - I_STEP_WRITE(STEP_STATE_I); - #endif - #ifdef J_STEP_WRITE - J_STEP_WRITE(STEP_STATE_J); - #endif - #ifdef K_STEP_WRITE - K_STEP_WRITE(STEP_STATE_K); - #endif - #ifdef U_STEP_WRITE - U_STEP_WRITE(STEP_STATE_U); - #endif - #ifdef V_STEP_WRITE - V_STEP_WRITE(STEP_STATE_V); - #endif - #ifdef W_STEP_WRITE - W_STEP_WRITE(STEP_STATE_W); - #endif _PULSE_WAIT(); @@ -3501,24 +3754,6 @@ void Stepper::report_positions() { #ifdef Z_STEP_WRITE Z_STEP_WRITE(!STEP_STATE_Z); #endif - #ifdef I_STEP_WRITE - I_STEP_WRITE(!STEP_STATE_I); - #endif - #ifdef J_STEP_WRITE - J_STEP_WRITE(!STEP_STATE_J); - #endif - #ifdef K_STEP_WRITE - K_STEP_WRITE(!STEP_STATE_K); - #endif - #ifdef U_STEP_WRITE - U_STEP_WRITE(!STEP_STATE_U); - #endif - #ifdef V_STEP_WRITE - V_STEP_WRITE(!STEP_STATE_V); - #endif - #ifdef W_STEP_WRITE - W_STEP_WRITE(!STEP_STATE_W); - #endif // Restore direction bits EXTRA_DIR_WAIT_BEFORE(); @@ -3530,24 +3765,6 @@ void Stepper::report_positions() { #ifdef Z_DIR_WRITE Z_DIR_WRITE(old_dir.z); #endif - #ifdef I_DIR_WRITE - I_DIR_WRITE(old_dir.i); - #endif - #ifdef J_DIR_WRITE - J_DIR_WRITE(old_dir.j); - #endif - #ifdef K_DIR_WRITE - K_DIR_WRITE(old_dir.k); - #endif - #ifdef U_DIR_WRITE - U_DIR_WRITE(old_dir.u); - #endif - #ifdef V_DIR_WRITE - V_DIR_WRITE(old_dir.v); - #endif - #ifdef W_DIR_WRITE - W_DIR_WRITE(old_dir.w); - #endif EXTRA_DIR_WAIT_AFTER(); diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 0706451e906e..4c54a5dbf955 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -49,8 +49,9 @@ #include "stepper/speed_lookuptable.h" #endif -// Disable multiple steps per ISR -//#define DISABLE_MULTI_STEPPING +#if ENABLED(FT_MOTION) + #include "ft_types.h" +#endif // // Estimate the amount of time the Stepper ISR will take to execute @@ -97,7 +98,7 @@ #endif // Input shaping base time - #if HAS_SHAPING + #if HAS_ZV_SHAPING #define ISR_SHAPING_BASE_CYCLES 180UL #else #define ISR_SHAPING_BASE_CYCLES 0UL @@ -114,7 +115,7 @@ #define TIMER_READ_ADD_AND_STORE_CYCLES 13UL // The base ISR - #define ISR_BASE_CYCLES 996UL + #define ISR_BASE_CYCLES 882UL // Linear advance base time is 32 cycles #if ENABLED(LIN_ADVANCE) @@ -131,7 +132,7 @@ #endif // Input shaping base time - #if HAS_SHAPING + #if HAS_ZV_SHAPING #define ISR_SHAPING_BASE_CYCLES 290UL #else #define ISR_SHAPING_BASE_CYCLES 0UL @@ -141,7 +142,7 @@ #define ISR_LOOP_BASE_CYCLES 32UL // And each stepper (start + stop pulse) takes in worst case - #define ISR_STEPPER_CYCLES 88UL + #define ISR_STEPPER_CYCLES 60UL #endif @@ -215,12 +216,12 @@ #error "Expected at least one of MINIMUM_STEPPER_PULSE or MAXIMUM_STEPPER_RATE to be defined" #endif -// The loop takes the base time plus the time for all the bresenham logic for R pulses plus the time -// between pulses for (R-1) pulses. But the user could be enforcing a minimum time so the loop time is: -#define ISR_LOOP_CYCLES(R) ((ISR_LOOP_BASE_CYCLES + MIN_ISR_LOOP_CYCLES + MIN_STEPPER_PULSE_CYCLES) * (R - 1) + _MAX(MIN_ISR_LOOP_CYCLES, MIN_STEPPER_PULSE_CYCLES)) +// The loop takes the base time plus the time for all the bresenham logic for 1 << R pulses plus the time +// between pulses for ((1 << R) - 1) pulses. But the user could be enforcing a minimum time so the loop time is: +#define ISR_LOOP_CYCLES(R) ((ISR_LOOP_BASE_CYCLES + MIN_ISR_LOOP_CYCLES + MIN_STEPPER_PULSE_CYCLES) * ((1UL << R) - 1) + _MAX(MIN_ISR_LOOP_CYCLES, MIN_STEPPER_PULSE_CYCLES)) // Model input shaping as an extra loop call -#define ISR_SHAPING_LOOP_CYCLES(R) ((TERN0(HAS_SHAPING, ISR_LOOP_BASE_CYCLES) + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES)) * (R) + (MIN_ISR_LOOP_CYCLES) * (R - 1)) +#define ISR_SHAPING_LOOP_CYCLES(R) (TERN0(HAS_ZV_SHAPING, (ISR_LOOP_BASE_CYCLES + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES)) << R)) // If linear advance is enabled, then it is handled separately #if ENABLED(LIN_ADVANCE) @@ -244,30 +245,19 @@ #define ISR_LA_LOOP_CYCLES 0UL #endif -// Now estimate the total ISR execution time in cycles given a step per ISR multiplier -#define ISR_EXECUTION_CYCLES(R) (((ISR_BASE_CYCLES + ISR_S_CURVE_CYCLES + ISR_SHAPING_BASE_CYCLES + ISR_LOOP_CYCLES(R) + ISR_SHAPING_LOOP_CYCLES(R) + ISR_LA_BASE_CYCLES + ISR_LA_LOOP_CYCLES)) / (R)) +// Estimate the total ISR execution time in cycles given a step-per-ISR shift multiplier +#define ISR_EXECUTION_CYCLES(R) ((ISR_BASE_CYCLES + ISR_S_CURVE_CYCLES + ISR_SHAPING_BASE_CYCLES + ISR_LOOP_CYCLES(R) + ISR_SHAPING_LOOP_CYCLES(R) + ISR_LA_BASE_CYCLES + ISR_LA_LOOP_CYCLES) >> R) -// The maximum allowable stepping frequency when doing x128-x1 stepping (in Hz) -#define MAX_STEP_ISR_FREQUENCY_128X ((F_CPU) / ISR_EXECUTION_CYCLES(128)) -#define MAX_STEP_ISR_FREQUENCY_64X ((F_CPU) / ISR_EXECUTION_CYCLES(64)) -#define MAX_STEP_ISR_FREQUENCY_32X ((F_CPU) / ISR_EXECUTION_CYCLES(32)) -#define MAX_STEP_ISR_FREQUENCY_16X ((F_CPU) / ISR_EXECUTION_CYCLES(16)) -#define MAX_STEP_ISR_FREQUENCY_8X ((F_CPU) / ISR_EXECUTION_CYCLES(8)) -#define MAX_STEP_ISR_FREQUENCY_4X ((F_CPU) / ISR_EXECUTION_CYCLES(4)) -#define MAX_STEP_ISR_FREQUENCY_2X ((F_CPU) / ISR_EXECUTION_CYCLES(2)) -#define MAX_STEP_ISR_FREQUENCY_1X ((F_CPU) / ISR_EXECUTION_CYCLES(1)) +// The maximum allowable stepping frequency when doing 1x stepping (in Hz) +#define MAX_STEP_ISR_FREQUENCY_1X ((F_CPU) / ISR_EXECUTION_CYCLES(0)) // The minimum step ISR rate used by ADAPTIVE_STEP_SMOOTHING to target 50% CPU usage // This does not account for the possibility of multi-stepping. -// Perhaps DISABLE_MULTI_STEPPING should be required with ADAPTIVE_STEP_SMOOTHING. -#define MIN_STEP_ISR_FREQUENCY (MAX_STEP_ISR_FREQUENCY_1X / 2) +#define MIN_STEP_ISR_FREQUENCY (MAX_STEP_ISR_FREQUENCY_1X >> 1) +// Number of axes that could be enabled/disabled. Dual/multiple steppers are combined. #define ENABLE_COUNT (NUM_AXES + E_STEPPERS) -#if ENABLE_COUNT > 16 - typedef uint32_t ena_mask_t; -#else - typedef IF<(ENABLE_COUNT > 8), uint16_t, uint8_t>::type ena_mask_t; -#endif +typedef bits_t(ENABLE_COUNT) ena_mask_t; // Axis flags type, for enabled state or other simple state typedef struct { @@ -329,7 +319,7 @@ constexpr ena_mask_t enable_overlap[] = { //static_assert(!any_enable_overlap(), "There is some overlap."); -#if HAS_SHAPING +#if HAS_ZV_SHAPING #ifdef SHAPING_MAX_STEPRATE constexpr float max_step_rate = SHAPING_MAX_STEPRATE; @@ -358,7 +348,7 @@ constexpr ena_mask_t enable_overlap[] = { constexpr uint16_t shaping_min_freq = SHAPING_MIN_FREQ, shaping_echoes = max_step_rate / shaping_min_freq / 2 + 3; - typedef IF::type shaping_time_t; + typedef hal_timer_t shaping_time_t; enum shaping_echo_t { ECHO_NONE = 0, ECHO_FWD = 1, ECHO_BWD = 2 }; struct shaping_echo_axis_t { TERN_(INPUT_SHAPING_X, shaping_echo_t x:2); @@ -396,16 +386,36 @@ constexpr ena_mask_t enable_overlap[] = { TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) delay_y = delay); } static void enqueue(const bool x_step, const bool x_forward, const bool y_step, const bool y_forward) { - TERN_(INPUT_SHAPING_X, if (head_x == tail && x_step) peek_x_val = delay_x); - TERN_(INPUT_SHAPING_Y, if (head_y == tail && y_step) peek_y_val = delay_y); + #if ENABLED(INPUT_SHAPING_X) + if (x_step) { + if (head_x == tail) peek_x_val = delay_x; + echo_axes[tail].x = x_forward ? ECHO_FWD : ECHO_BWD; + _free_count_x--; + } + else { + echo_axes[tail].x = ECHO_NONE; + if (head_x != tail) + _free_count_x--; + else if (++head_x == shaping_echoes) + head_x = 0; + } + #endif + #if ENABLED(INPUT_SHAPING_Y) + if (y_step) { + if (head_y == tail) peek_y_val = delay_y; + echo_axes[tail].y = y_forward ? ECHO_FWD : ECHO_BWD; + _free_count_y--; + } + else { + echo_axes[tail].y = ECHO_NONE; + if (head_y != tail) + _free_count_y--; + else if (++head_y == shaping_echoes) + head_y = 0; + } + #endif times[tail] = now; - TERN_(INPUT_SHAPING_X, echo_axes[tail].x = x_step ? (x_forward ? ECHO_FWD : ECHO_BWD) : ECHO_NONE); - TERN_(INPUT_SHAPING_Y, echo_axes[tail].y = y_step ? (y_forward ? ECHO_FWD : ECHO_BWD) : ECHO_NONE); if (++tail == shaping_echoes) tail = 0; - TERN_(INPUT_SHAPING_X, _free_count_x--); - TERN_(INPUT_SHAPING_Y, _free_count_y--); - TERN_(INPUT_SHAPING_X, if (echo_axes[head_x].x == ECHO_NONE) dequeue_x()); - TERN_(INPUT_SHAPING_Y, if (echo_axes[head_y].y == ECHO_NONE) dequeue_y()); } #if ENABLED(INPUT_SHAPING_X) static shaping_time_t peek_x() { return peek_x_val; } @@ -449,22 +459,22 @@ constexpr ena_mask_t enable_overlap[] = { struct ShapeParams { float frequency; float zeta; - bool enabled; + bool enabled : 1; + bool forward : 1; int16_t delta_error = 0; // delta_error for seconday bresenham mod 128 uint8_t factor1; uint8_t factor2; - bool forward; int32_t last_block_end_pos = 0; }; -#endif // HAS_SHAPING +#endif // HAS_ZV_SHAPING // // Stepper class definition // class Stepper { - friend class KinematicSystem; - friend class DeltaKinematicSystem; + friend class Max7219; + friend class FxdTiCtrl; friend void stepperTask(void *); public: @@ -528,7 +538,16 @@ class Stepper { #endif static uint32_t acceleration_time, deceleration_time; // time measured in Stepper Timer ticks - static uint8_t steps_per_isr; // Count of steps to perform per Stepper ISR call + + #if MULTISTEPPING_LIMIT == 1 + static constexpr uint8_t steps_per_isr = 1; // Count of steps to perform per Stepper ISR call + #else + static uint8_t steps_per_isr; + #endif + + #if DISABLED(OLD_ADAPTIVE_MULTISTEPPING) + static hal_timer_t time_spent_in_isr, time_spent_out_isr; + #endif #if ENABLED(ADAPTIVE_STEP_SMOOTHING) static uint8_t oversampling_factor; // Oversampling factor (log2(multiplier)) to increase temporal resolution of axis @@ -563,7 +582,7 @@ class Stepper { static bool bezier_2nd_half; // If Bézier curve has been initialized or not #endif - #if HAS_SHAPING + #if HAS_ZV_SHAPING #if ENABLED(INPUT_SHAPING_X) static ShapeParams shaping_x; #endif @@ -573,24 +592,25 @@ class Stepper { #endif #if ENABLED(LIN_ADVANCE) - static constexpr uint32_t LA_ADV_NEVER = 0xFFFFFFFF; - static uint32_t nextAdvanceISR, - la_interval; // Interval between ISR calls for LA - static int32_t la_delta_error, // Analogue of delta_error.e for E steps in LA ISR - la_dividend, // Analogue of advance_dividend.e for E steps in LA ISR - la_advance_steps; // Count of steps added to increase nozzle pressure + static constexpr hal_timer_t LA_ADV_NEVER = HAL_TIMER_TYPE_MAX; + static hal_timer_t nextAdvanceISR, + la_interval; // Interval between ISR calls for LA + static int32_t la_delta_error, // Analogue of delta_error.e for E steps in LA ISR + la_dividend, // Analogue of advance_dividend.e for E steps in LA ISR + la_advance_steps; // Count of steps added to increase nozzle pressure + static bool la_active; // Whether linear advance is used on the present segment. #endif #if ENABLED(INTEGRATED_BABYSTEPPING) - static constexpr uint32_t BABYSTEP_NEVER = 0xFFFFFFFF; - static uint32_t nextBabystepISR; + static constexpr hal_timer_t BABYSTEP_NEVER = HAL_TIMER_TYPE_MAX; + static hal_timer_t nextBabystepISR; #endif #if ENABLED(DIRECT_STEPPING) static page_step_state_t page_step_state; #endif - static int32_t ticks_nominal; + static hal_timer_t ticks_nominal; #if DISABLED(S_CURVE_ACCELERATION) static uint32_t acc_step_rate; // needed for deceleration start point #endif @@ -629,9 +649,9 @@ class Stepper { static void pulse_phase_isr(); // The stepper block processing ISR phase - static uint32_t block_phase_isr(); + static hal_timer_t block_phase_isr(); - #if HAS_SHAPING + #if HAS_ZV_SHAPING static void shaping_isr(); #endif @@ -642,7 +662,7 @@ class Stepper { #if ENABLED(INTEGRATED_BABYSTEPPING) // The Babystepping ISR phase - static uint32_t babystepping_isr(); + static hal_timer_t babystepping_isr(); FORCE_INLINE static void initiateBabystepping() { if (nextBabystepISR == BABYSTEP_NEVER) { nextBabystepISR = 0; @@ -654,7 +674,7 @@ class Stepper { // Check if the given block is busy or not - Must not be called from ISR contexts static bool is_block_busy(const block_t * const block); - #if HAS_SHAPING + #if HAS_ZV_SHAPING // Check whether the stepper is processing any input shaping echoes static bool input_shaping_busy() { const bool was_on = hal.isr_state(); @@ -802,7 +822,12 @@ class Stepper { set_directions(); } - #if HAS_SHAPING + #if ENABLED(FT_MOTION) + // Manage the planner + static void fxdTiCtrl_BlockQueueUpdate(); + #endif + + #if HAS_ZV_SHAPING static void set_shaping_damping_ratio(const AxisEnum axis, const_float_t zeta); static float get_shaping_damping_ratio(const AxisEnum axis); static void set_shaping_frequency(const AxisEnum axis, const_float_t freq); @@ -814,9 +839,11 @@ class Stepper { // Set the current position in steps static void _set_position(const abce_long_t &spos); - // Calculate timing interval for the given step rate - static uint32_t calc_timer_interval(uint32_t step_rate); - static uint32_t calc_timer_interval(uint32_t step_rate, uint8_t &loops); + // Calculate the timing interval for the given step rate + static hal_timer_t calc_timer_interval(uint32_t step_rate); + + // Calculate timing interval and steps-per-ISR for the given step rate + static hal_timer_t calc_multistep_timer_interval(uint32_t step_rate); #if ENABLED(S_CURVE_ACCELERATION) static void _calc_bezier_curve_coeffs(const int32_t v0, const int32_t v1, const uint32_t av); @@ -831,6 +858,11 @@ class Stepper { static void microstep_init(); #endif + #if ENABLED(FT_MOTION) + static void fxdTiCtrl_stepper(const bool applyDir, const ft_command_t command); + static void fxdTiCtrl_refreshAxisDidMove(); + #endif + }; extern Stepper stepper; diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index e9a9aa7de90c..81a1377cef41 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -454,7 +454,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset /** * Extruder indirection for the single E axis */ -#if ENABLED(SWITCHING_EXTRUDER) // One stepper driver per two extruders, reversed on odd index +#if HAS_SWITCHING_EXTRUDER // One stepper driver per two extruders, reversed on odd index #if EXTRUDERS > 7 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ diff --git a/Marlin/src/module/stepper/speed_lookuptable.h b/Marlin/src/module/stepper/speed_lookuptable.h index b173ebec0847..ae30bdbf3b7d 100644 --- a/Marlin/src/module/stepper/speed_lookuptable.h +++ b/Marlin/src/module/stepper/speed_lookuptable.h @@ -23,146 +23,146 @@ #if F_CPU == 16000000 - const uint16_t speed_lookuptable_fast[256][2] PROGMEM = { - { 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, - { 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, - { 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, - { 323, 13}, { 310, 11}, { 299, 11}, { 288, 11}, { 277, 9}, { 268, 9}, { 259, 8}, { 251, 8}, - { 243, 8}, { 235, 7}, { 228, 6}, { 222, 6}, { 216, 6}, { 210, 6}, { 204, 5}, { 199, 5}, - { 194, 5}, { 189, 4}, { 185, 4}, { 181, 4}, { 177, 4}, { 173, 4}, { 169, 4}, { 165, 3}, - { 162, 3}, { 159, 4}, { 155, 3}, { 152, 3}, { 149, 2}, { 147, 3}, { 144, 3}, { 141, 2}, - { 139, 3}, { 136, 2}, { 134, 2}, { 132, 3}, { 129, 2}, { 127, 2}, { 125, 2}, { 123, 2}, - { 121, 2}, { 119, 1}, { 118, 2}, { 116, 2}, { 114, 1}, { 113, 2}, { 111, 2}, { 109, 1}, - { 108, 2}, { 106, 1}, { 105, 2}, { 103, 1}, { 102, 1}, { 101, 1}, { 100, 2}, { 98, 1}, - { 97, 1}, { 96, 1}, { 95, 2}, { 93, 1}, { 92, 1}, { 91, 1}, { 90, 1}, { 89, 1}, - { 88, 1}, { 87, 1}, { 86, 1}, { 85, 1}, { 84, 1}, { 83, 0}, { 83, 1}, { 82, 1}, - { 81, 1}, { 80, 1}, { 79, 1}, { 78, 0}, { 78, 1}, { 77, 1}, { 76, 1}, { 75, 0}, - { 75, 1}, { 74, 1}, { 73, 1}, { 72, 0}, { 72, 1}, { 71, 1}, { 70, 0}, { 70, 1}, - { 69, 0}, { 69, 1}, { 68, 1}, { 67, 0}, { 67, 1}, { 66, 0}, { 66, 1}, { 65, 0}, - { 65, 1}, { 64, 1}, { 63, 0}, { 63, 1}, { 62, 0}, { 62, 1}, { 61, 0}, { 61, 1}, - { 60, 0}, { 60, 0}, { 60, 1}, { 59, 0}, { 59, 1}, { 58, 0}, { 58, 1}, { 57, 0}, - { 57, 1}, { 56, 0}, { 56, 0}, { 56, 1}, { 55, 0}, { 55, 1}, { 54, 0}, { 54, 0}, - { 54, 1}, { 53, 0}, { 53, 0}, { 53, 1}, { 52, 0}, { 52, 0}, { 52, 1}, { 51, 0}, - { 51, 0}, { 51, 1}, { 50, 0}, { 50, 0}, { 50, 1}, { 49, 0}, { 49, 0}, { 49, 1}, - { 48, 0}, { 48, 0}, { 48, 1}, { 47, 0}, { 47, 0}, { 47, 0}, { 47, 1}, { 46, 0}, - { 46, 0}, { 46, 1}, { 45, 0}, { 45, 0}, { 45, 0}, { 45, 1}, { 44, 0}, { 44, 0}, - { 44, 0}, { 44, 1}, { 43, 0}, { 43, 0}, { 43, 0}, { 43, 1}, { 42, 0}, { 42, 0}, - { 42, 0}, { 42, 1}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 1}, { 40, 0}, - { 40, 0}, { 40, 0}, { 40, 0}, { 40, 1}, { 39, 0}, { 39, 0}, { 39, 0}, { 39, 0}, - { 39, 1}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 1}, { 37, 0}, { 37, 0}, - { 37, 0}, { 37, 0}, { 37, 0}, { 37, 1}, { 36, 0}, { 36, 0}, { 36, 0}, { 36, 0}, - { 36, 1}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 1}, - { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 1}, { 33, 0}, { 33, 0}, - { 33, 0}, { 33, 0}, { 33, 0}, { 33, 0}, { 33, 1}, { 32, 0}, { 32, 0}, { 32, 0}, - { 32, 0}, { 32, 0}, { 32, 0}, { 32, 0}, { 32, 1}, { 31, 0}, { 31, 0}, { 31, 0}, - { 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0} + const struct { uint16_t base; uint8_t gain; } speed_lookuptable_fast[256] PROGMEM = { + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, // dummy first row + { 977, 109 }, { 868, 87 }, { 781, 71 }, { 710, 59 }, { 651, 50 }, { 601, 43 }, { 558, 37 }, { 521, 33 }, + { 488, 28 }, { 460, 26 }, { 434, 23 }, { 411, 20 }, { 391, 19 }, { 372, 17 }, { 355, 15 }, { 340, 14 }, + { 326, 13 }, { 313, 13 }, { 300, 11 }, { 289, 10 }, { 279, 10 }, { 269, 9 }, { 260, 8 }, { 252, 8 }, + { 244, 7 }, { 237, 7 }, { 230, 7 }, { 223, 6 }, { 217, 6 }, { 211, 5 }, { 206, 6 }, { 200, 5 }, + { 195, 4 }, { 191, 5 }, { 186, 4 }, { 182, 4 }, { 178, 4 }, { 174, 4 }, { 170, 4 }, { 166, 3 }, + { 163, 4 }, { 159, 3 }, { 156, 3 }, { 153, 3 }, { 150, 3 }, { 147, 2 }, { 145, 3 }, { 142, 2 }, + { 140, 3 }, { 137, 2 }, { 135, 3 }, { 132, 2 }, { 130, 2 }, { 128, 2 }, { 126, 2 }, { 124, 2 }, + { 122, 2 }, { 120, 2 }, { 118, 1 }, { 117, 2 }, { 115, 2 }, { 113, 1 }, { 112, 2 }, { 110, 1 }, + { 109, 2 }, { 107, 1 }, { 106, 2 }, { 104, 1 }, { 103, 2 }, { 101, 1 }, { 100, 1 }, { 99, 1 }, + { 98, 2 }, { 96, 1 }, { 95, 1 }, { 94, 1 }, { 93, 1 }, { 92, 1 }, { 91, 1 }, { 90, 1 }, + { 89, 1 }, { 88, 1 }, { 87, 1 }, { 86, 1 }, { 85, 1 }, { 84, 1 }, { 83, 1 }, { 82, 1 }, + { 81, 0 }, { 81, 1 }, { 80, 1 }, { 79, 1 }, { 78, 1 }, { 77, 0 }, { 77, 1 }, { 76, 1 }, + { 75, 1 }, { 74, 0 }, { 74, 1 }, { 73, 1 }, { 72, 0 }, { 72, 1 }, { 71, 1 }, { 70, 0 }, + { 70, 1 }, { 69, 0 }, { 69, 1 }, { 68, 1 }, { 67, 0 }, { 67, 1 }, { 66, 0 }, { 66, 1 }, + { 65, 0 }, { 65, 1 }, { 64, 0 }, { 64, 1 }, { 63, 0 }, { 63, 1 }, { 62, 0 }, { 62, 1 }, + { 61, 0 }, { 61, 1 }, { 60, 0 }, { 60, 1 }, { 59, 0 }, { 59, 1 }, { 58, 0 }, { 58, 1 }, + { 57, 0 }, { 57, 0 }, { 57, 1 }, { 56, 0 }, { 56, 1 }, { 55, 0 }, { 55, 0 }, { 55, 1 }, + { 54, 0 }, { 54, 0 }, { 54, 1 }, { 53, 0 }, { 53, 1 }, { 52, 0 }, { 52, 0 }, { 52, 1 }, + { 51, 0 }, { 51, 0 }, { 51, 1 }, { 50, 0 }, { 50, 0 }, { 50, 1 }, { 49, 0 }, { 49, 0 }, + { 49, 0 }, { 49, 1 }, { 48, 0 }, { 48, 0 }, { 48, 1 }, { 47, 0 }, { 47, 0 }, { 47, 0 }, + { 47, 1 }, { 46, 0 }, { 46, 0 }, { 46, 1 }, { 45, 0 }, { 45, 0 }, { 45, 0 }, { 45, 1 }, + { 44, 0 }, { 44, 0 }, { 44, 0 }, { 44, 1 }, { 43, 0 }, { 43, 0 }, { 43, 0 }, { 43, 1 }, + { 42, 0 }, { 42, 0 }, { 42, 0 }, { 42, 0 }, { 42, 1 }, { 41, 0 }, { 41, 0 }, { 41, 0 }, + { 41, 1 }, { 40, 0 }, { 40, 0 }, { 40, 0 }, { 40, 0 }, { 40, 1 }, { 39, 0 }, { 39, 0 }, + { 39, 0 }, { 39, 0 }, { 39, 1 }, { 38, 0 }, { 38, 0 }, { 38, 0 }, { 38, 0 }, { 38, 0 }, + { 38, 1 }, { 37, 0 }, { 37, 0 }, { 37, 0 }, { 37, 0 }, { 37, 0 }, { 37, 1 }, { 36, 0 }, + { 36, 0 }, { 36, 0 }, { 36, 0 }, { 36, 0 }, { 36, 1 }, { 35, 0 }, { 35, 0 }, { 35, 0 }, + { 35, 0 }, { 35, 0 }, { 35, 1 }, { 34, 0 }, { 34, 0 }, { 34, 0 }, { 34, 0 }, { 34, 0 }, + { 34, 0 }, { 34, 1 }, { 33, 0 }, { 33, 0 }, { 33, 0 }, { 33, 0 }, { 33, 0 }, { 33, 0 }, + { 33, 1 }, { 32, 0 }, { 32, 0 }, { 32, 0 }, { 32, 0 }, { 32, 0 }, { 32, 0 }, { 32, 0 }, + { 32, 1 }, { 31, 0 }, { 31, 0 }, { 31, 0 }, { 31, 0 }, { 31, 0 }, { 31, 0 }, { 31, 0 }, }; const uint16_t speed_lookuptable_slow[256][2] PROGMEM = { - { 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, - { 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, - { 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, - { 8928, 308}, { 8620, 287}, { 8333, 269}, { 8064, 252}, { 7812, 237}, { 7575, 223}, { 7352, 210}, { 7142, 198}, - { 6944, 188}, { 6756, 178}, { 6578, 168}, { 6410, 160}, { 6250, 153}, { 6097, 145}, { 5952, 139}, { 5813, 132}, - { 5681, 126}, { 5555, 121}, { 5434, 115}, { 5319, 111}, { 5208, 106}, { 5102, 102}, { 5000, 99}, { 4901, 94}, - { 4807, 91}, { 4716, 87}, { 4629, 84}, { 4545, 81}, { 4464, 79}, { 4385, 75}, { 4310, 73}, { 4237, 71}, - { 4166, 68}, { 4098, 66}, { 4032, 64}, { 3968, 62}, { 3906, 60}, { 3846, 59}, { 3787, 56}, { 3731, 55}, - { 3676, 53}, { 3623, 52}, { 3571, 50}, { 3521, 49}, { 3472, 48}, { 3424, 46}, { 3378, 45}, { 3333, 44}, - { 3289, 43}, { 3246, 41}, { 3205, 41}, { 3164, 39}, { 3125, 39}, { 3086, 38}, { 3048, 36}, { 3012, 36}, - { 2976, 35}, { 2941, 35}, { 2906, 33}, { 2873, 33}, { 2840, 32}, { 2808, 31}, { 2777, 30}, { 2747, 30}, - { 2717, 29}, { 2688, 29}, { 2659, 28}, { 2631, 27}, { 2604, 27}, { 2577, 26}, { 2551, 26}, { 2525, 25}, - { 2500, 25}, { 2475, 25}, { 2450, 23}, { 2427, 24}, { 2403, 23}, { 2380, 22}, { 2358, 22}, { 2336, 22}, - { 2314, 21}, { 2293, 21}, { 2272, 20}, { 2252, 20}, { 2232, 20}, { 2212, 20}, { 2192, 19}, { 2173, 18}, - { 2155, 19}, { 2136, 18}, { 2118, 18}, { 2100, 17}, { 2083, 17}, { 2066, 17}, { 2049, 17}, { 2032, 16}, - { 2016, 16}, { 2000, 16}, { 1984, 16}, { 1968, 15}, { 1953, 16}, { 1937, 14}, { 1923, 15}, { 1908, 15}, - { 1893, 14}, { 1879, 14}, { 1865, 14}, { 1851, 13}, { 1838, 14}, { 1824, 13}, { 1811, 13}, { 1798, 13}, - { 1785, 12}, { 1773, 13}, { 1760, 12}, { 1748, 12}, { 1736, 12}, { 1724, 12}, { 1712, 12}, { 1700, 11}, - { 1689, 12}, { 1677, 11}, { 1666, 11}, { 1655, 11}, { 1644, 11}, { 1633, 10}, { 1623, 11}, { 1612, 10}, - { 1602, 10}, { 1592, 10}, { 1582, 10}, { 1572, 10}, { 1562, 10}, { 1552, 9}, { 1543, 10}, { 1533, 9}, - { 1524, 9}, { 1515, 9}, { 1506, 9}, { 1497, 9}, { 1488, 9}, { 1479, 9}, { 1470, 9}, { 1461, 8}, - { 1453, 8}, { 1445, 9}, { 1436, 8}, { 1428, 8}, { 1420, 8}, { 1412, 8}, { 1404, 8}, { 1396, 8}, - { 1388, 7}, { 1381, 8}, { 1373, 7}, { 1366, 8}, { 1358, 7}, { 1351, 7}, { 1344, 8}, { 1336, 7}, - { 1329, 7}, { 1322, 7}, { 1315, 7}, { 1308, 6}, { 1302, 7}, { 1295, 7}, { 1288, 6}, { 1282, 7}, - { 1275, 6}, { 1269, 7}, { 1262, 6}, { 1256, 6}, { 1250, 7}, { 1243, 6}, { 1237, 6}, { 1231, 6}, - { 1225, 6}, { 1219, 6}, { 1213, 6}, { 1207, 6}, { 1201, 5}, { 1196, 6}, { 1190, 6}, { 1184, 5}, - { 1179, 6}, { 1173, 5}, { 1168, 6}, { 1162, 5}, { 1157, 5}, { 1152, 6}, { 1146, 5}, { 1141, 5}, - { 1136, 5}, { 1131, 5}, { 1126, 5}, { 1121, 5}, { 1116, 5}, { 1111, 5}, { 1106, 5}, { 1101, 5}, - { 1096, 5}, { 1091, 5}, { 1086, 4}, { 1082, 5}, { 1077, 5}, { 1072, 4}, { 1068, 5}, { 1063, 4}, - { 1059, 5}, { 1054, 4}, { 1050, 4}, { 1046, 5}, { 1041, 4}, { 1037, 4}, { 1033, 5}, { 1028, 4}, - { 1024, 4}, { 1020, 4}, { 1016, 4}, { 1012, 4}, { 1008, 4}, { 1004, 4}, { 1000, 4}, { 996, 4}, - { 992, 4}, { 988, 4}, { 984, 4}, { 980, 4}, { 976, 4}, { 972, 4}, { 968, 3}, { 965, 3} + { 62500, 12500 }, { 50000, 8333 }, { 41667, 5953 }, { 35714, 4464 }, { 31250, 3472 }, { 27778, 2778 }, { 25000, 2273 }, { 22727, 1894 }, + { 20833, 1602 }, { 19231, 1374 }, { 17857, 1190 }, { 16667, 1042 }, { 15625, 919 }, { 14706, 817 }, { 13889, 731 }, { 13158, 658 }, + { 12500, 595 }, { 11905, 541 }, { 11364, 494 }, { 10870, 453 }, { 10417, 417 }, { 10000, 385 }, { 9615, 356 }, { 9259, 330 }, + { 8929, 308 }, { 8621, 288 }, { 8333, 268 }, { 8065, 252 }, { 7813, 237 }, { 7576, 223 }, { 7353, 210 }, { 7143, 199 }, + { 6944, 187 }, { 6757, 178 }, { 6579, 169 }, { 6410, 160 }, { 6250, 152 }, { 6098, 146 }, { 5952, 138 }, { 5814, 132 }, + { 5682, 126 }, { 5556, 121 }, { 5435, 116 }, { 5319, 111 }, { 5208, 106 }, { 5102, 102 }, { 5000, 98 }, { 4902, 94 }, + { 4808, 91 }, { 4717, 87 }, { 4630, 85 }, { 4545, 81 }, { 4464, 78 }, { 4386, 76 }, { 4310, 73 }, { 4237, 70 }, + { 4167, 69 }, { 4098, 66 }, { 4032, 64 }, { 3968, 62 }, { 3906, 60 }, { 3846, 58 }, { 3788, 57 }, { 3731, 55 }, + { 3676, 53 }, { 3623, 52 }, { 3571, 50 }, { 3521, 49 }, { 3472, 47 }, { 3425, 47 }, { 3378, 45 }, { 3333, 44 }, + { 3289, 42 }, { 3247, 42 }, { 3205, 40 }, { 3165, 40 }, { 3125, 39 }, { 3086, 37 }, { 3049, 37 }, { 3012, 36 }, + { 2976, 35 }, { 2941, 34 }, { 2907, 33 }, { 2874, 33 }, { 2841, 32 }, { 2809, 31 }, { 2778, 31 }, { 2747, 30 }, + { 2717, 29 }, { 2688, 28 }, { 2660, 28 }, { 2632, 28 }, { 2604, 27 }, { 2577, 26 }, { 2551, 26 }, { 2525, 25 }, + { 2500, 25 }, { 2475, 24 }, { 2451, 24 }, { 2427, 23 }, { 2404, 23 }, { 2381, 23 }, { 2358, 22 }, { 2336, 21 }, + { 2315, 21 }, { 2294, 21 }, { 2273, 21 }, { 2252, 20 }, { 2232, 20 }, { 2212, 19 }, { 2193, 19 }, { 2174, 19 }, + { 2155, 18 }, { 2137, 18 }, { 2119, 18 }, { 2101, 18 }, { 2083, 17 }, { 2066, 17 }, { 2049, 16 }, { 2033, 17 }, + { 2016, 16 }, { 2000, 16 }, { 1984, 15 }, { 1969, 16 }, { 1953, 15 }, { 1938, 15 }, { 1923, 15 }, { 1908, 14 }, + { 1894, 14 }, { 1880, 14 }, { 1866, 14 }, { 1852, 14 }, { 1838, 13 }, { 1825, 13 }, { 1812, 13 }, { 1799, 13 }, + { 1786, 13 }, { 1773, 12 }, { 1761, 13 }, { 1748, 12 }, { 1736, 12 }, { 1724, 12 }, { 1712, 11 }, { 1701, 12 }, + { 1689, 11 }, { 1678, 11 }, { 1667, 11 }, { 1656, 11 }, { 1645, 11 }, { 1634, 11 }, { 1623, 10 }, { 1613, 10 }, + { 1603, 11 }, { 1592, 10 }, { 1582, 10 }, { 1572, 9 }, { 1563, 10 }, { 1553, 10 }, { 1543, 9 }, { 1534, 10 }, + { 1524, 9 }, { 1515, 9 }, { 1506, 9 }, { 1497, 9 }, { 1488, 9 }, { 1479, 8 }, { 1471, 9 }, { 1462, 9 }, + { 1453, 8 }, { 1445, 8 }, { 1437, 8 }, { 1429, 9 }, { 1420, 8 }, { 1412, 8 }, { 1404, 7 }, { 1397, 8 }, + { 1389, 8 }, { 1381, 7 }, { 1374, 8 }, { 1366, 7 }, { 1359, 8 }, { 1351, 7 }, { 1344, 7 }, { 1337, 7 }, + { 1330, 7 }, { 1323, 7 }, { 1316, 7 }, { 1309, 7 }, { 1302, 7 }, { 1295, 6 }, { 1289, 7 }, { 1282, 6 }, + { 1276, 7 }, { 1269, 6 }, { 1263, 7 }, { 1256, 6 }, { 1250, 6 }, { 1244, 6 }, { 1238, 6 }, { 1232, 7 }, + { 1225, 5 }, { 1220, 6 }, { 1214, 6 }, { 1208, 6 }, { 1202, 6 }, { 1196, 6 }, { 1190, 5 }, { 1185, 6 }, + { 1179, 5 }, { 1174, 6 }, { 1168, 5 }, { 1163, 6 }, { 1157, 5 }, { 1152, 5 }, { 1147, 5 }, { 1142, 6 }, + { 1136, 5 }, { 1131, 5 }, { 1126, 5 }, { 1121, 5 }, { 1116, 5 }, { 1111, 5 }, { 1106, 5 }, { 1101, 5 }, + { 1096, 4 }, { 1092, 5 }, { 1087, 5 }, { 1082, 4 }, { 1078, 5 }, { 1073, 5 }, { 1068, 4 }, { 1064, 5 }, + { 1059, 4 }, { 1055, 5 }, { 1050, 4 }, { 1046, 4 }, { 1042, 5 }, { 1037, 4 }, { 1033, 4 }, { 1029, 4 }, + { 1025, 5 }, { 1020, 4 }, { 1016, 4 }, { 1012, 4 }, { 1008, 4 }, { 1004, 4 }, { 1000, 4 }, { 996, 4 }, + { 992, 4 }, { 988, 4 }, { 984, 4 }, { 980, 3 }, { 977, 4 }, { 973, 4 }, { 969, 4 }, { 965, 4 }, }; #elif F_CPU == 20000000 - const uint16_t speed_lookuptable_fast[256][2] PROGMEM = { - {62500, 54055}, {8445, 3917}, {4528, 1434}, {3094, 745}, {2349, 456}, {1893, 307}, {1586, 222}, {1364, 167}, - {1197, 131}, {1066, 105}, {961, 86}, {875, 72}, {803, 61}, {742, 53}, {689, 45}, {644, 40}, - {604, 35}, {569, 32}, {537, 28}, {509, 25}, {484, 23}, {461, 21}, {440, 19}, {421, 17}, - {404, 16}, {388, 15}, {373, 14}, {359, 13}, {346, 12}, {334, 11}, {323, 10}, {313, 10}, - {303, 9}, {294, 9}, {285, 8}, {277, 7}, {270, 8}, {262, 7}, {255, 6}, {249, 6}, - {243, 6}, {237, 6}, {231, 5}, {226, 5}, {221, 5}, {216, 5}, {211, 4}, {207, 5}, - {202, 4}, {198, 4}, {194, 4}, {190, 3}, {187, 4}, {183, 3}, {180, 3}, {177, 4}, - {173, 3}, {170, 3}, {167, 2}, {165, 3}, {162, 3}, {159, 2}, {157, 3}, {154, 2}, - {152, 3}, {149, 2}, {147, 2}, {145, 2}, {143, 2}, {141, 2}, {139, 2}, {137, 2}, - {135, 2}, {133, 2}, {131, 2}, {129, 1}, {128, 2}, {126, 2}, {124, 1}, {123, 2}, - {121, 1}, {120, 2}, {118, 1}, {117, 1}, {116, 2}, {114, 1}, {113, 1}, {112, 2}, - {110, 1}, {109, 1}, {108, 1}, {107, 2}, {105, 1}, {104, 1}, {103, 1}, {102, 1}, - {101, 1}, {100, 1}, {99, 1}, {98, 1}, {97, 1}, {96, 1}, {95, 1}, {94, 1}, - {93, 1}, {92, 1}, {91, 0}, {91, 1}, {90, 1}, {89, 1}, {88, 1}, {87, 0}, - {87, 1}, {86, 1}, {85, 1}, {84, 0}, {84, 1}, {83, 1}, {82, 1}, {81, 0}, - {81, 1}, {80, 1}, {79, 0}, {79, 1}, {78, 0}, {78, 1}, {77, 1}, {76, 0}, - {76, 1}, {75, 0}, {75, 1}, {74, 1}, {73, 0}, {73, 1}, {72, 0}, {72, 1}, - {71, 0}, {71, 1}, {70, 0}, {70, 1}, {69, 0}, {69, 1}, {68, 0}, {68, 1}, - {67, 0}, {67, 1}, {66, 0}, {66, 1}, {65, 0}, {65, 0}, {65, 1}, {64, 0}, - {64, 1}, {63, 0}, {63, 1}, {62, 0}, {62, 0}, {62, 1}, {61, 0}, {61, 1}, - {60, 0}, {60, 0}, {60, 1}, {59, 0}, {59, 0}, {59, 1}, {58, 0}, {58, 0}, - {58, 1}, {57, 0}, {57, 0}, {57, 1}, {56, 0}, {56, 0}, {56, 1}, {55, 0}, - {55, 0}, {55, 1}, {54, 0}, {54, 0}, {54, 1}, {53, 0}, {53, 0}, {53, 0}, - {53, 1}, {52, 0}, {52, 0}, {52, 1}, {51, 0}, {51, 0}, {51, 0}, {51, 1}, - {50, 0}, {50, 0}, {50, 0}, {50, 1}, {49, 0}, {49, 0}, {49, 0}, {49, 1}, - {48, 0}, {48, 0}, {48, 0}, {48, 1}, {47, 0}, {47, 0}, {47, 0}, {47, 1}, - {46, 0}, {46, 0}, {46, 0}, {46, 0}, {46, 1}, {45, 0}, {45, 0}, {45, 0}, - {45, 1}, {44, 0}, {44, 0}, {44, 0}, {44, 0}, {44, 1}, {43, 0}, {43, 0}, - {43, 0}, {43, 0}, {43, 1}, {42, 0}, {42, 0}, {42, 0}, {42, 0}, {42, 0}, - {42, 1}, {41, 0}, {41, 0}, {41, 0}, {41, 0}, {41, 0}, {41, 1}, {40, 0}, - {40, 0}, {40, 0}, {40, 0}, {40, 1}, {39, 0}, {39, 0}, {39, 0}, {39, 0}, - {39, 0}, {39, 0}, {39, 1}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, + const struct { uint16_t base; uint8_t gain; } speed_lookuptable_fast[256] PROGMEM = { + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, // dummy first row + { 1221, 136 }, { 1085, 108 }, { 977, 89 }, { 888, 74 }, { 814, 63 }, { 751, 53 }, { 698, 47 }, { 651, 41 }, + { 610, 36 }, { 574, 31 }, { 543, 29 }, { 514, 26 }, { 488, 23 }, { 465, 21 }, { 444, 19 }, { 425, 18 }, + { 407, 16 }, { 391, 15 }, { 376, 14 }, { 362, 13 }, { 349, 12 }, { 337, 11 }, { 326, 11 }, { 315, 10 }, + { 305, 9 }, { 296, 9 }, { 287, 8 }, { 279, 8 }, { 271, 7 }, { 264, 7 }, { 257, 7 }, { 250, 6 }, + { 244, 6 }, { 238, 5 }, { 233, 6 }, { 227, 5 }, { 222, 5 }, { 217, 5 }, { 212, 4 }, { 208, 5 }, + { 203, 4 }, { 199, 4 }, { 195, 4 }, { 191, 3 }, { 188, 4 }, { 184, 3 }, { 181, 3 }, { 178, 4 }, + { 174, 3 }, { 171, 3 }, { 168, 2 }, { 166, 3 }, { 163, 3 }, { 160, 2 }, { 158, 3 }, { 155, 2 }, + { 153, 3 }, { 150, 2 }, { 148, 2 }, { 146, 2 }, { 144, 2 }, { 142, 2 }, { 140, 2 }, { 138, 2 }, + { 136, 2 }, { 134, 2 }, { 132, 2 }, { 130, 2 }, { 128, 1 }, { 127, 2 }, { 125, 1 }, { 124, 2 }, + { 122, 1 }, { 121, 2 }, { 119, 1 }, { 118, 2 }, { 116, 1 }, { 115, 1 }, { 114, 2 }, { 112, 1 }, + { 111, 1 }, { 110, 1 }, { 109, 2 }, { 107, 1 }, { 106, 1 }, { 105, 1 }, { 104, 1 }, { 103, 1 }, + { 102, 1 }, { 101, 1 }, { 100, 1 }, { 99, 1 }, { 98, 1 }, { 97, 1 }, { 96, 1 }, { 95, 1 }, + { 94, 1 }, { 93, 1 }, { 92, 1 }, { 91, 1 }, { 90, 0 }, { 90, 1 }, { 89, 1 }, { 88, 1 }, + { 87, 1 }, { 86, 0 }, { 86, 1 }, { 85, 1 }, { 84, 1 }, { 83, 0 }, { 83, 1 }, { 82, 1 }, + { 81, 0 }, { 81, 1 }, { 80, 1 }, { 79, 0 }, { 79, 1 }, { 78, 0 }, { 78, 1 }, { 77, 1 }, + { 76, 0 }, { 76, 1 }, { 75, 0 }, { 75, 1 }, { 74, 1 }, { 73, 0 }, { 73, 1 }, { 72, 0 }, + { 72, 1 }, { 71, 0 }, { 71, 1 }, { 70, 0 }, { 70, 1 }, { 69, 0 }, { 69, 1 }, { 68, 0 }, + { 68, 1 }, { 67, 0 }, { 67, 1 }, { 66, 0 }, { 66, 0 }, { 66, 1 }, { 65, 0 }, { 65, 1 }, + { 64, 0 }, { 64, 1 }, { 63, 0 }, { 63, 0 }, { 63, 1 }, { 62, 0 }, { 62, 1 }, { 61, 0 }, + { 61, 0 }, { 61, 1 }, { 60, 0 }, { 60, 0 }, { 60, 1 }, { 59, 0 }, { 59, 1 }, { 58, 0 }, + { 58, 0 }, { 58, 1 }, { 57, 0 }, { 57, 0 }, { 57, 1 }, { 56, 0 }, { 56, 0 }, { 56, 1 }, + { 55, 0 }, { 55, 0 }, { 55, 0 }, { 55, 1 }, { 54, 0 }, { 54, 0 }, { 54, 1 }, { 53, 0 }, + { 53, 0 }, { 53, 0 }, { 53, 1 }, { 52, 0 }, { 52, 0 }, { 52, 1 }, { 51, 0 }, { 51, 0 }, + { 51, 0 }, { 51, 1 }, { 50, 0 }, { 50, 0 }, { 50, 0 }, { 50, 1 }, { 49, 0 }, { 49, 0 }, + { 49, 0 }, { 49, 1 }, { 48, 0 }, { 48, 0 }, { 48, 0 }, { 48, 1 }, { 47, 0 }, { 47, 0 }, + { 47, 0 }, { 47, 0 }, { 47, 1 }, { 46, 0 }, { 46, 0 }, { 46, 0 }, { 46, 1 }, { 45, 0 }, + { 45, 0 }, { 45, 0 }, { 45, 0 }, { 45, 1 }, { 44, 0 }, { 44, 0 }, { 44, 0 }, { 44, 0 }, + { 44, 1 }, { 43, 0 }, { 43, 0 }, { 43, 0 }, { 43, 0 }, { 43, 1 }, { 42, 0 }, { 42, 0 }, + { 42, 0 }, { 42, 0 }, { 42, 0 }, { 42, 1 }, { 41, 0 }, { 41, 0 }, { 41, 0 }, { 41, 0 }, + { 41, 0 }, { 41, 1 }, { 40, 0 }, { 40, 0 }, { 40, 0 }, { 40, 0 }, { 40, 0 }, { 40, 1 }, + { 39, 0 }, { 39, 0 }, { 39, 0 }, { 39, 0 }, { 39, 0 }, { 39, 1 }, { 38, 0 }, { 38, 0 }, }; const uint16_t speed_lookuptable_slow[256][2] PROGMEM = { - {62500, 10417}, {52083, 7441}, {44642, 5580}, {39062, 4340}, {34722, 3472}, {31250, 2841}, {28409, 2368}, {26041, 2003}, - {24038, 1717}, {22321, 1488}, {20833, 1302}, {19531, 1149}, {18382, 1021}, {17361, 914}, {16447, 822}, {15625, 745}, - {14880, 676}, {14204, 618}, {13586, 566}, {13020, 520}, {12500, 481}, {12019, 445}, {11574, 414}, {11160, 385}, - {10775, 359}, {10416, 336}, {10080, 315}, {9765, 296}, {9469, 278}, {9191, 263}, {8928, 248}, {8680, 235}, - {8445, 222}, {8223, 211}, {8012, 200}, {7812, 191}, {7621, 181}, {7440, 173}, {7267, 165}, {7102, 158}, - {6944, 151}, {6793, 145}, {6648, 138}, {6510, 133}, {6377, 127}, {6250, 123}, {6127, 118}, {6009, 113}, - {5896, 109}, {5787, 106}, {5681, 101}, {5580, 98}, {5482, 95}, {5387, 91}, {5296, 88}, {5208, 86}, - {5122, 82}, {5040, 80}, {4960, 78}, {4882, 75}, {4807, 73}, {4734, 70}, {4664, 69}, {4595, 67}, - {4528, 64}, {4464, 63}, {4401, 61}, {4340, 60}, {4280, 58}, {4222, 56}, {4166, 55}, {4111, 53}, - {4058, 52}, {4006, 51}, {3955, 49}, {3906, 48}, {3858, 48}, {3810, 45}, {3765, 45}, {3720, 44}, - {3676, 43}, {3633, 42}, {3591, 40}, {3551, 40}, {3511, 39}, {3472, 38}, {3434, 38}, {3396, 36}, - {3360, 36}, {3324, 35}, {3289, 34}, {3255, 34}, {3221, 33}, {3188, 32}, {3156, 31}, {3125, 31}, - {3094, 31}, {3063, 30}, {3033, 29}, {3004, 28}, {2976, 28}, {2948, 28}, {2920, 27}, {2893, 27}, - {2866, 26}, {2840, 25}, {2815, 25}, {2790, 25}, {2765, 24}, {2741, 24}, {2717, 24}, {2693, 23}, - {2670, 22}, {2648, 22}, {2626, 22}, {2604, 22}, {2582, 21}, {2561, 21}, {2540, 20}, {2520, 20}, - {2500, 20}, {2480, 20}, {2460, 19}, {2441, 19}, {2422, 19}, {2403, 18}, {2385, 18}, {2367, 18}, - {2349, 17}, {2332, 18}, {2314, 17}, {2297, 16}, {2281, 17}, {2264, 16}, {2248, 16}, {2232, 16}, - {2216, 16}, {2200, 15}, {2185, 15}, {2170, 15}, {2155, 15}, {2140, 15}, {2125, 14}, {2111, 14}, - {2097, 14}, {2083, 14}, {2069, 14}, {2055, 13}, {2042, 13}, {2029, 13}, {2016, 13}, {2003, 13}, - {1990, 13}, {1977, 12}, {1965, 12}, {1953, 13}, {1940, 11}, {1929, 12}, {1917, 12}, {1905, 12}, - {1893, 11}, {1882, 11}, {1871, 11}, {1860, 11}, {1849, 11}, {1838, 11}, {1827, 11}, {1816, 10}, - {1806, 11}, {1795, 10}, {1785, 10}, {1775, 10}, {1765, 10}, {1755, 10}, {1745, 9}, {1736, 10}, - {1726, 9}, {1717, 10}, {1707, 9}, {1698, 9}, {1689, 9}, {1680, 9}, {1671, 9}, {1662, 9}, - {1653, 9}, {1644, 8}, {1636, 9}, {1627, 8}, {1619, 9}, {1610, 8}, {1602, 8}, {1594, 8}, - {1586, 8}, {1578, 8}, {1570, 8}, {1562, 8}, {1554, 7}, {1547, 8}, {1539, 8}, {1531, 7}, - {1524, 8}, {1516, 7}, {1509, 7}, {1502, 7}, {1495, 7}, {1488, 7}, {1481, 7}, {1474, 7}, - {1467, 7}, {1460, 7}, {1453, 7}, {1446, 6}, {1440, 7}, {1433, 7}, {1426, 6}, {1420, 6}, - {1414, 7}, {1407, 6}, {1401, 6}, {1395, 7}, {1388, 6}, {1382, 6}, {1376, 6}, {1370, 6}, - {1364, 6}, {1358, 6}, {1352, 6}, {1346, 5}, {1341, 6}, {1335, 6}, {1329, 5}, {1324, 6}, - {1318, 5}, {1313, 6}, {1307, 5}, {1302, 6}, {1296, 5}, {1291, 5}, {1286, 6}, {1280, 5}, - {1275, 5}, {1270, 5}, {1265, 5}, {1260, 5}, {1255, 5}, {1250, 5}, {1245, 5}, {1240, 5}, - {1235, 5}, {1230, 5}, {1225, 5}, {1220, 5}, {1215, 4}, {1211, 5}, {1206, 5}, {1201, 5}, + { 62500, 10417 }, { 52083, 7440 }, { 44643, 5580 }, { 39063, 4341 }, { 34722, 3472 }, { 31250, 2841 }, { 28409, 2367 }, { 26042, 2004 }, + { 24038, 1717 }, { 22321, 1488 }, { 20833, 1302 }, { 19531, 1149 }, { 18382, 1021 }, { 17361, 914 }, { 16447, 822 }, { 15625, 744 }, + { 14881, 676 }, { 14205, 618 }, { 13587, 566 }, { 13021, 521 }, { 12500, 481 }, { 12019, 445 }, { 11574, 413 }, { 11161, 385 }, + { 10776, 359 }, { 10417, 336 }, { 10081, 315 }, { 9766, 296 }, { 9470, 279 }, { 9191, 262 }, { 8929, 248 }, { 8681, 235 }, + { 8446, 222 }, { 8224, 211 }, { 8013, 200 }, { 7813, 191 }, { 7622, 182 }, { 7440, 173 }, { 7267, 165 }, { 7102, 158 }, + { 6944, 151 }, { 6793, 144 }, { 6649, 139 }, { 6510, 132 }, { 6378, 128 }, { 6250, 123 }, { 6127, 117 }, { 6010, 114 }, + { 5896, 109 }, { 5787, 105 }, { 5682, 102 }, { 5580, 98 }, { 5482, 94 }, { 5388, 91 }, { 5297, 89 }, { 5208, 85 }, + { 5123, 83 }, { 5040, 80 }, { 4960, 77 }, { 4883, 75 }, { 4808, 73 }, { 4735, 71 }, { 4664, 68 }, { 4596, 67 }, + { 4529, 65 }, { 4464, 63 }, { 4401, 61 }, { 4340, 59 }, { 4281, 58 }, { 4223, 56 }, { 4167, 55 }, { 4112, 54 }, + { 4058, 52 }, { 4006, 50 }, { 3956, 50 }, { 3906, 48 }, { 3858, 47 }, { 3811, 46 }, { 3765, 45 }, { 3720, 44 }, + { 3676, 42 }, { 3634, 42 }, { 3592, 41 }, { 3551, 40 }, { 3511, 39 }, { 3472, 38 }, { 3434, 37 }, { 3397, 37 }, + { 3360, 36 }, { 3324, 35 }, { 3289, 34 }, { 3255, 33 }, { 3222, 33 }, { 3189, 32 }, { 3157, 32 }, { 3125, 31 }, + { 3094, 30 }, { 3064, 30 }, { 3034, 29 }, { 3005, 29 }, { 2976, 28 }, { 2948, 27 }, { 2921, 27 }, { 2894, 27 }, + { 2867, 26 }, { 2841, 26 }, { 2815, 25 }, { 2790, 25 }, { 2765, 24 }, { 2741, 24 }, { 2717, 23 }, { 2694, 23 }, + { 2671, 23 }, { 2648, 22 }, { 2626, 22 }, { 2604, 21 }, { 2583, 22 }, { 2561, 20 }, { 2541, 21 }, { 2520, 20 }, + { 2500, 20 }, { 2480, 19 }, { 2461, 20 }, { 2441, 19 }, { 2422, 18 }, { 2404, 19 }, { 2385, 18 }, { 2367, 17 }, + { 2350, 18 }, { 2332, 17 }, { 2315, 17 }, { 2298, 17 }, { 2281, 17 }, { 2264, 16 }, { 2248, 16 }, { 2232, 16 }, + { 2216, 15 }, { 2201, 16 }, { 2185, 15 }, { 2170, 15 }, { 2155, 15 }, { 2140, 14 }, { 2126, 15 }, { 2111, 14 }, + { 2097, 14 }, { 2083, 13 }, { 2070, 14 }, { 2056, 14 }, { 2042, 13 }, { 2029, 13 }, { 2016, 13 }, { 2003, 13 }, + { 1990, 12 }, { 1978, 13 }, { 1965, 12 }, { 1953, 12 }, { 1941, 12 }, { 1929, 12 }, { 1917, 12 }, { 1905, 11 }, + { 1894, 11 }, { 1883, 12 }, { 1871, 11 }, { 1860, 11 }, { 1849, 11 }, { 1838, 11 }, { 1827, 10 }, { 1817, 11 }, + { 1806, 10 }, { 1796, 10 }, { 1786, 10 }, { 1776, 10 }, { 1766, 10 }, { 1756, 10 }, { 1746, 10 }, { 1736, 9 }, + { 1727, 10 }, { 1717, 9 }, { 1708, 10 }, { 1698, 9 }, { 1689, 9 }, { 1680, 9 }, { 1671, 9 }, { 1662, 9 }, + { 1653, 8 }, { 1645, 9 }, { 1636, 8 }, { 1628, 9 }, { 1619, 8 }, { 1611, 8 }, { 1603, 9 }, { 1594, 8 }, + { 1586, 8 }, { 1578, 8 }, { 1570, 7 }, { 1563, 8 }, { 1555, 8 }, { 1547, 8 }, { 1539, 7 }, { 1532, 8 }, + { 1524, 7 }, { 1517, 7 }, { 1510, 8 }, { 1502, 7 }, { 1495, 7 }, { 1488, 7 }, { 1481, 7 }, { 1474, 7 }, + { 1467, 7 }, { 1460, 7 }, { 1453, 6 }, { 1447, 7 }, { 1440, 7 }, { 1433, 6 }, { 1427, 7 }, { 1420, 6 }, + { 1414, 6 }, { 1408, 7 }, { 1401, 6 }, { 1395, 6 }, { 1389, 6 }, { 1383, 6 }, { 1377, 6 }, { 1371, 6 }, + { 1365, 6 }, { 1359, 6 }, { 1353, 6 }, { 1347, 6 }, { 1341, 6 }, { 1335, 5 }, { 1330, 6 }, { 1324, 5 }, + { 1319, 6 }, { 1313, 5 }, { 1308, 6 }, { 1302, 5 }, { 1297, 6 }, { 1291, 5 }, { 1286, 5 }, { 1281, 5 }, + { 1276, 6 }, { 1270, 5 }, { 1265, 5 }, { 1260, 5 }, { 1255, 5 }, { 1250, 5 }, { 1245, 5 }, { 1240, 5 }, + { 1235, 5 }, { 1230, 5 }, { 1225, 4 }, { 1221, 5 }, { 1216, 5 }, { 1211, 4 }, { 1207, 5 }, { 1202, 5 }, }; #endif diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 48ce020d3dca..02ae9cb1e4c4 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -46,7 +46,7 @@ enum StealthIndex : uint8_t { // AI = Axis Enum Index // SWHW = SW/SH UART selection #if ENABLED(TMC_USE_SW_SPI) - #define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK, ST##_CHAIN_POS) + #define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), TMC_SPI_MOSI, TMC_SPI_MISO, TMC_SPI_SCK, ST##_CHAIN_POS) #else #define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), ST##_CHAIN_POS) #endif @@ -227,7 +227,7 @@ enum StealthIndex : uint8_t { chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; - TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); + TERN_(EDGE_STEPPING, chopconf.dedge = true); st.CHOPCONF(chopconf.sr); st.rms_current(mA, hold_multiplier); @@ -262,7 +262,7 @@ enum StealthIndex : uint8_t { chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; - TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); + TERN_(EDGE_STEPPING, chopconf.dedge = true); st.CHOPCONF(chopconf.sr); st.rms_current(mA, hold_multiplier); @@ -684,7 +684,7 @@ enum StealthIndex : uint8_t { chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; - TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); + TERN_(EDGE_STEPPING, chopconf.dedge = true); st.CHOPCONF(chopconf.sr); st.rms_current(mA, hold_multiplier); @@ -726,7 +726,7 @@ enum StealthIndex : uint8_t { chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; - TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); + TERN_(EDGE_STEPPING, chopconf.dedge = true); st.CHOPCONF(chopconf.sr); st.rms_current(mA, hold_multiplier); @@ -766,7 +766,7 @@ enum StealthIndex : uint8_t { st.sdoff(0); st.rms_current(mA); st.microsteps(microsteps); - TERN_(SQUARE_WAVE_STEPPING, st.dedge(true)); + TERN_(EDGE_STEPPING, st.dedge(true)); st.intpol(interpolate); st.diss2g(true); // Disable short to ground protection. Too many false readings? TERN_(TMC_DEBUG, st.rdsel(0b01)); @@ -784,7 +784,7 @@ enum StealthIndex : uint8_t { chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; - TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); + TERN_(EDGE_STEPPING, chopconf.dedge = true); st.CHOPCONF(chopconf.sr); st.rms_current(mA, hold_multiplier); @@ -819,7 +819,7 @@ enum StealthIndex : uint8_t { chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; - TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); + TERN_(EDGE_STEPPING, chopconf.dedge = true); st.CHOPCONF(chopconf.sr); st.rms_current(mA, hold_multiplier); diff --git a/Marlin/src/module/stepper/trinamic.h b/Marlin/src/module/stepper/trinamic.h index 95bab7652c1a..3705543c9904 100644 --- a/Marlin/src/module/stepper/trinamic.h +++ b/Marlin/src/module/stepper/trinamic.h @@ -115,7 +115,7 @@ void restore_trinamic_drivers(); void reset_trinamic_drivers(); -#define AXIS_HAS_SQUARE_WAVE(A) (AXIS_IS_TMC(A) && ENABLED(SQUARE_WAVE_STEPPING)) +#define AXIS_HAS_DEDGE(A) (AXIS_IS_TMC(A) && ENABLED(EDGE_STEPPING)) // X Stepper #if AXIS_IS_TMC(X) @@ -126,7 +126,7 @@ void reset_trinamic_drivers(); #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing_X.toff : 0) #define X_ENABLE_READ() stepperX.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(X) + #if AXIS_HAS_DEDGE(X) #define X_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X_STEP_PIN); }while(0) #endif #endif @@ -140,7 +140,7 @@ void reset_trinamic_drivers(); #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y.toff : 0) #define Y_ENABLE_READ() stepperY.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(Y) + #if AXIS_HAS_DEDGE(Y) #define Y_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y_STEP_PIN); }while(0) #endif #endif @@ -154,7 +154,7 @@ void reset_trinamic_drivers(); #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z.toff : 0) #define Z_ENABLE_READ() stepperZ.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(Z) + #if AXIS_HAS_DEDGE(Z) #define Z_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z_STEP_PIN); }while(0) #endif #endif @@ -171,7 +171,7 @@ void reset_trinamic_drivers(); #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing_X2.toff : 0) #define X2_ENABLE_READ() stepperX2.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(X2) + #if AXIS_HAS_DEDGE(X2) #define X2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X2_STEP_PIN); }while(0) #endif #endif @@ -188,7 +188,7 @@ void reset_trinamic_drivers(); #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y2.toff : 0) #define Y2_ENABLE_READ() stepperY2.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(Y2) + #if AXIS_HAS_DEDGE(Y2) #define Y2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y2_STEP_PIN); }while(0) #endif #endif @@ -205,7 +205,7 @@ void reset_trinamic_drivers(); #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z2.toff : 0) #define Z2_ENABLE_READ() stepperZ2.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(Z2) + #if AXIS_HAS_DEDGE(Z2) #define Z2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z2_STEP_PIN); }while(0) #endif #endif @@ -222,7 +222,7 @@ void reset_trinamic_drivers(); #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z3.toff : 0) #define Z3_ENABLE_READ() stepperZ3.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(Z3) + #if AXIS_HAS_DEDGE(Z3) #define Z3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z3_STEP_PIN); }while(0) #endif #endif @@ -239,7 +239,7 @@ void reset_trinamic_drivers(); #define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z4.toff : 0) #define Z4_ENABLE_READ() stepperZ4.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(Z4) + #if AXIS_HAS_DEDGE(Z4) #define Z4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z4_STEP_PIN); }while(0) #endif #endif @@ -253,7 +253,7 @@ void reset_trinamic_drivers(); #define I_ENABLE_WRITE(STATE) stepperI.toff((STATE)==I_ENABLE_ON ? chopper_timing.toff : 0) #define I_ENABLE_READ() stepperI.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(I) + #if AXIS_HAS_DEDGE(I) #define I_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(I_STEP_PIN); }while(0) #endif #endif @@ -267,7 +267,7 @@ void reset_trinamic_drivers(); #define J_ENABLE_WRITE(STATE) stepperJ.toff((STATE)==J_ENABLE_ON ? chopper_timing.toff : 0) #define J_ENABLE_READ() stepperJ.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(J) + #if AXIS_HAS_DEDGE(J) #define J_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(J_STEP_PIN); }while(0) #endif #endif @@ -281,7 +281,7 @@ void reset_trinamic_drivers(); #define K_ENABLE_WRITE(STATE) stepperK.toff((STATE)==K_ENABLE_ON ? chopper_timing.toff : 0) #define K_ENABLE_READ() stepperK.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(K) + #if AXIS_HAS_DEDGE(K) #define K_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(K_STEP_PIN); }while(0) #endif #endif @@ -295,7 +295,7 @@ void reset_trinamic_drivers(); #define U_ENABLE_WRITE(STATE) stepperU.toff((STATE)==U_ENABLE_ON ? chopper_timing_U.toff : 0) #define U_ENABLE_READ() stepperU.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(U) + #if AXIS_HAS_DEDGE(U) #define U_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(U_STEP_PIN); }while(0) #endif #endif @@ -309,7 +309,7 @@ void reset_trinamic_drivers(); #define V_ENABLE_WRITE(STATE) stepperV.toff((STATE)==V_ENABLE_ON ? chopper_timing_V.toff : 0) #define V_ENABLE_READ() stepperV.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(V) + #if AXIS_HAS_DEDGE(V) #define V_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(V_STEP_PIN); }while(0) #endif #endif @@ -323,7 +323,7 @@ void reset_trinamic_drivers(); #define W_ENABLE_WRITE(STATE) stepperW.toff((STATE)==W_ENABLE_ON ? chopper_timing_W.toff : 0) #define W_ENABLE_READ() stepperW.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(W) + #if AXIS_HAS_DEDGE(W) #define W_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(W_STEP_PIN); }while(0) #endif #endif @@ -340,7 +340,7 @@ void reset_trinamic_drivers(); #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing_E0.toff : 0) #define E0_ENABLE_READ() stepperE0.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E0) + #if AXIS_HAS_DEDGE(E0) #define E0_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E0_STEP_PIN); }while(0) #endif #endif @@ -357,7 +357,7 @@ void reset_trinamic_drivers(); #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing_E1.toff : 0) #define E1_ENABLE_READ() stepperE1.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E1) + #if AXIS_HAS_DEDGE(E1) #define E1_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E1_STEP_PIN); }while(0) #endif #endif @@ -374,7 +374,7 @@ void reset_trinamic_drivers(); #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing_E2.toff : 0) #define E2_ENABLE_READ() stepperE2.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E2) + #if AXIS_HAS_DEDGE(E2) #define E2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E2_STEP_PIN); }while(0) #endif #endif @@ -391,7 +391,7 @@ void reset_trinamic_drivers(); #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing_E3.toff : 0) #define E3_ENABLE_READ() stepperE3.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E3) + #if AXIS_HAS_DEDGE(E3) #define E3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E3_STEP_PIN); }while(0) #endif #endif @@ -408,7 +408,7 @@ void reset_trinamic_drivers(); #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing_E4.toff : 0) #define E4_ENABLE_READ() stepperE4.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E4) + #if AXIS_HAS_DEDGE(E4) #define E4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E4_STEP_PIN); }while(0) #endif #endif @@ -425,7 +425,7 @@ void reset_trinamic_drivers(); #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing_E5.toff : 0) #define E5_ENABLE_READ() stepperE5.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E5) + #if AXIS_HAS_DEDGE(E5) #define E5_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E5_STEP_PIN); }while(0) #endif #endif @@ -442,7 +442,7 @@ void reset_trinamic_drivers(); #define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing_E6.toff : 0) #define E6_ENABLE_READ() stepperE6.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E6) + #if AXIS_HAS_DEDGE(E6) #define E6_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E6_STEP_PIN); }while(0) #endif #endif @@ -459,7 +459,7 @@ void reset_trinamic_drivers(); #define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing_E7.toff : 0) #define E7_ENABLE_READ() stepperE7.isEnabled() #endif - #if AXIS_HAS_SQUARE_WAVE(E7) + #if AXIS_HAS_DEDGE(E7) #define E7_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E7_STEP_PIN); }while(0) #endif #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index b5726902561b..29c3a787c5b6 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -319,6 +319,11 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); hotend_info_t Temperature::temp_hotend[HOTENDS]; constexpr celsius_t Temperature::hotend_maxtemp[HOTENDS]; + #if ENABLED(MPCTEMP) + bool MPC::e_paused; // = false + int32_t MPC::e_position; // = 0 + #endif + // Sanity-check max readable temperatures #define CHECK_MAXTEMP_(N,M,S) static_assert( \ S >= 998 || M <= _MAX(TT_NAME(S)[0].celsius, TT_NAME(S)[COUNT(TT_NAME(S)) - 1].celsius) - HOTEND_OVERSHOOT, \ @@ -508,8 +513,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); // Init min and max temp with extreme values to prevent false errors during startup raw_adc_t Temperature::mintemp_raw_BED = TEMP_SENSOR_BED_RAW_LO_TEMP, Temperature::maxtemp_raw_BED = TEMP_SENSOR_BED_RAW_HI_TEMP; - TERN_(WATCH_BED, bed_watch_t Temperature::watch_bed); // = { 0 } - IF_DISABLED(PIDTEMPBED, millis_t Temperature::next_bed_check_ms); + #if WATCH_BED + bed_watch_t Temperature::watch_bed; // = { 0 } + #endif + #if DISABLED(PIDTEMPBED) + millis_t Temperature::next_bed_check_ms; + #endif #endif #if HAS_TEMP_CHAMBER @@ -519,8 +528,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); celsius_float_t old_temp = 9999; raw_adc_t Temperature::mintemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_LO_TEMP, Temperature::maxtemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_HI_TEMP; - TERN_(WATCH_CHAMBER, chamber_watch_t Temperature::watch_chamber{0}); - IF_DISABLED(PIDTEMPCHAMBER, millis_t Temperature::next_chamber_check_ms); + #if WATCH_CHAMBER + chamber_watch_t Temperature::watch_chamber; // = { 0 } + #endif + #if DISABLED(PIDTEMPCHAMBER) + millis_t Temperature::next_chamber_check_ms; + #endif #endif #endif @@ -580,11 +593,6 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); volatile bool Temperature::raw_temps_ready = false; - -#if ENABLED(MPCTEMP) - int32_t Temperature::mpc_e_position; // = 0 -#endif - #define TEMPDIR(N) ((TEMP_SENSOR_##N##_RAW_LO_TEMP) < (TEMP_SENSOR_##N##_RAW_HI_TEMP) ? 1 : -1) #define TP_CMP(S,A,B) (TEMPDIR(S) < 0 ? ((A)<(B)) : ((A)>(B))) @@ -925,7 +933,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif // HAS_PID_HEATING -#if ENABLED(MPCTEMP) +#if ENABLED(MPC_AUTOTUNE) #if EITHER(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) #define SINGLEFAN 1 @@ -951,7 +959,6 @@ volatile bool Temperature::raw_temps_ready = false; TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); if (!wait_for_heatup) { - SERIAL_ECHOPGM(STR_MPC_AUTOTUNE); SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED)); return true; @@ -981,7 +988,6 @@ volatile bool Temperature::raw_temps_ready = false; } } on_exit(e); - SERIAL_ECHOPGM(STR_MPC_AUTOTUNE); SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_START, e); MPCHeaterInfo &hotend = temp_hotend[e]; MPC_t &mpc = hotend.mpc; @@ -1150,7 +1156,6 @@ volatile bool Temperature::raw_temps_ready = false; mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; mpc.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); - SERIAL_ECHOPGM(STR_MPC_AUTOTUNE); SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_DONE)); @@ -1171,7 +1176,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_FAN, SERIAL_ECHOLNPAIR_F("MPC_AMBIENT_XFER_COEFF_FAN255 ", ambient_xfer_coeff_fan255, 4)); } -#endif // MPCTEMP +#endif // MPC_AUTOTUNE int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { switch (heater_id) { @@ -1189,44 +1194,55 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { } } -#define _EFANOVERLAP(A,B) _FANOVERLAP(E##A,B) - #if HAS_AUTO_FAN + #define _EFANOVERLAP(I,N) ((I != N) && _FANOVERLAP(I,E##N)) + #if EXTRUDER_AUTO_FAN_SPEED != 255 - #define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0) + #define INIT_E_AUTO_FAN_PIN(P) do{ if (PWM_PIN(P)) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0) #else #define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P) #endif #if CHAMBER_AUTO_FAN_SPEED != 255 - #define INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0) + #define INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (PWM_PIN(P)) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0) #else #define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P) #endif + #if COOLER_AUTO_FAN_SPEED != 255 + #define INIT_COOLER_AUTO_FAN_PIN(P) do{ if (PWM_PIN(P)) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0) + #else + #define INIT_COOLER_AUTO_FAN_PIN(P) SET_OUTPUT(P) + #endif #ifndef CHAMBER_FAN_INDEX #define CHAMBER_FAN_INDEX HOTENDS #endif void Temperature::update_autofans() { - #define _EFAN(B,A) _EFANOVERLAP(A,B) ? B : + #define _EFAN(I,N) _EFANOVERLAP(I,N) ? I : static const uint8_t fanBit[] PROGMEM = { 0 #if HAS_MULTI_HOTEND #define _NEXT_FAN(N) , REPEAT2(N,_EFAN,N) N RREPEAT_S(1, HOTENDS, _NEXT_FAN) #endif + #define _NFAN HOTENDS #if HAS_AUTO_CHAMBER_FAN - #define _CFAN(B) _FANOVERLAP(CHAMBER,B) ? B : - , REPEAT(HOTENDS,_CFAN) (HOTENDS) + #define _CHFAN(I) _FANOVERLAP(I,CHAMBER) ? I : + , (REPEAT(HOTENDS,_CHFAN) (_NFAN)) + #undef _NFAN + #define _NFAN INCREMENT(HOTENDS) + #endif + #if HAS_AUTO_COOLER_FAN + #define _COFAN(I) _FANOVERLAP(I,COOLER) ? I : + , (REPEAT(HOTENDS,_COFAN) (_NFAN)) #endif }; uint8_t fanState = 0; HOTEND_LOOP() { - if (temp_hotend[e].celsius >= EXTRUDER_AUTO_FAN_TEMPERATURE) { + if (temp_hotend[e].celsius >= EXTRUDER_AUTO_FAN_TEMPERATURE) SBI(fanState, pgm_read_byte(&fanBit[e])); - } } #if HAS_AUTO_CHAMBER_FAN @@ -1257,6 +1273,11 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { chamberfan_speed = fan_on ? CHAMBER_AUTO_FAN_SPEED : 0; break; #endif + #if ENABLED(AUTO_POWER_COOLER_FAN) + case COOLER_FAN_INDEX: + coolerfan_speed = fan_on ? COOLER_AUTO_FAN_SPEED : 0; + break; + #endif default: #if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK) autofan_speed[realFan] = fan_on ? EXTRUDER_AUTO_FAN_SPEED : 0; @@ -1270,35 +1291,16 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { #define _AUTOFAN_SPEED() EXTRUDER_AUTO_FAN_SPEED #endif #define _AUTOFAN_CASE(N) case N: _UPDATE_AUTO_FAN(E##N, fan_on, _AUTOFAN_SPEED()); break + #define AUTOFAN_CASE(N) OPTCODE(HAS_AUTO_FAN_##N, _AUTOFAN_CASE(N)) switch (f) { - #if HAS_AUTO_FAN_0 - _AUTOFAN_CASE(0); - #endif - #if HAS_AUTO_FAN_1 - _AUTOFAN_CASE(1); - #endif - #if HAS_AUTO_FAN_2 - _AUTOFAN_CASE(2); - #endif - #if HAS_AUTO_FAN_3 - _AUTOFAN_CASE(3); - #endif - #if HAS_AUTO_FAN_4 - _AUTOFAN_CASE(4); - #endif - #if HAS_AUTO_FAN_5 - _AUTOFAN_CASE(5); - #endif - #if HAS_AUTO_FAN_6 - _AUTOFAN_CASE(6); - #endif - #if HAS_AUTO_FAN_7 - _AUTOFAN_CASE(7); - #endif + REPEAT(8, AUTOFAN_CASE) #if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E case CHAMBER_FAN_INDEX: _UPDATE_AUTO_FAN(CHAMBER, fan_on, CHAMBER_AUTO_FAN_SPEED); break; #endif + #if HAS_AUTO_COOLER_FAN && !AUTO_COOLER_IS_E + case COOLER_FAN_INDEX: _UPDATE_AUTO_FAN(COOLER, fan_on, COOLER_AUTO_FAN_SPEED); break; + #endif } SBI(fanDone, realFan); } @@ -1507,14 +1509,14 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { if (this_hotend) { const int32_t e_position = stepper.position(E_AXIS); - const float e_speed = (e_position - mpc_e_position) * planner.mm_per_step[E_AXIS] / MPC_dT; + const float e_speed = (e_position - MPC::e_position) * planner.mm_per_step[E_AXIS] / MPC_dT; - // The position can appear to make big jumps when, e.g. homing + // The position can appear to make big jumps when, e.g., homing if (fabs(e_speed) > planner.settings.max_feedrate_mm_s[E_AXIS]) - mpc_e_position = e_position; + MPC::e_position = e_position; else if (e_speed > 0.0f) { // Ignore retract/recover moves - ambient_xfer_coeff += e_speed * mpc.filament_heat_capacity_permm; - mpc_e_position = e_position; + if (!MPC::e_paused) ambient_xfer_coeff += e_speed * mpc.filament_heat_capacity_permm; + MPC::e_position = e_position; } } @@ -2628,51 +2630,51 @@ void Temperature::init() { #if HAS_HEATER_0 #ifdef BOARD_OPENDRAIN_MOSFETS - OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING); + OUT_WRITE_OD(HEATER_0_PIN, ENABLED(HEATER_0_INVERTING)); #else - OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING); + OUT_WRITE(HEATER_0_PIN, ENABLED(HEATER_0_INVERTING)); #endif #endif #if HAS_HEATER_1 - OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING); + OUT_WRITE(HEATER_1_PIN, ENABLED(HEATER_1_INVERTING)); #endif #if HAS_HEATER_2 - OUT_WRITE(HEATER_2_PIN, HEATER_2_INVERTING); + OUT_WRITE(HEATER_2_PIN, ENABLED(HEATER_2_INVERTING)); #endif #if HAS_HEATER_3 - OUT_WRITE(HEATER_3_PIN, HEATER_3_INVERTING); + OUT_WRITE(HEATER_3_PIN, ENABLED(HEATER_3_INVERTING)); #endif #if HAS_HEATER_4 - OUT_WRITE(HEATER_4_PIN, HEATER_4_INVERTING); + OUT_WRITE(HEATER_4_PIN, ENABLED(HEATER_4_INVERTING)); #endif #if HAS_HEATER_5 - OUT_WRITE(HEATER_5_PIN, HEATER_5_INVERTING); + OUT_WRITE(HEATER_5_PIN, ENABLED(HEATER_5_INVERTING)); #endif #if HAS_HEATER_6 - OUT_WRITE(HEATER_6_PIN, HEATER_6_INVERTING); + OUT_WRITE(HEATER_6_PIN, ENABLED(HEATER_6_INVERTING)); #endif #if HAS_HEATER_7 - OUT_WRITE(HEATER_7_PIN, HEATER_7_INVERTING); + OUT_WRITE(HEATER_7_PIN, ENABLED(HEATER_7_INVERTING)); #endif #if HAS_HEATED_BED #ifdef BOARD_OPENDRAIN_MOSFETS - OUT_WRITE_OD(HEATER_BED_PIN, HEATER_BED_INVERTING); + OUT_WRITE_OD(HEATER_BED_PIN, ENABLED(HEATER_BED_INVERTING)); #else - OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING); + OUT_WRITE(HEATER_BED_PIN, ENABLED(HEATER_BED_INVERTING)); #endif #endif #if HAS_HEATED_CHAMBER - OUT_WRITE(HEATER_CHAMBER_PIN, HEATER_CHAMBER_INVERTING); + OUT_WRITE(HEATER_CHAMBER_PIN, ENABLED(HEATER_CHAMBER_INVERTING)); #endif #if HAS_COOLER - OUT_WRITE(COOLER_PIN, COOLER_INVERTING); + OUT_WRITE(COOLER_PIN, ENABLED(COOLER_INVERTING)); #endif #if HAS_FAN0 - INIT_FAN_PIN(FAN_PIN); + INIT_FAN_PIN(FAN0_PIN); #endif #if HAS_FAN1 INIT_FAN_PIN(FAN1_PIN); @@ -2732,33 +2734,39 @@ void Temperature::init() { HAL_timer_start(MF_TIMER_TEMP, TEMP_TIMER_FREQUENCY); ENABLE_TEMPERATURE_INTERRUPT(); - #if HAS_AUTO_FAN_0 - INIT_E_AUTO_FAN_PIN(E0_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_1 && !_EFANOVERLAP(1,0) - INIT_E_AUTO_FAN_PIN(E1_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_2 && !(_EFANOVERLAP(2,0) || _EFANOVERLAP(2,1)) - INIT_E_AUTO_FAN_PIN(E2_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_3 && !(_EFANOVERLAP(3,0) || _EFANOVERLAP(3,1) || _EFANOVERLAP(3,2)) - INIT_E_AUTO_FAN_PIN(E3_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_4 && !(_EFANOVERLAP(4,0) || _EFANOVERLAP(4,1) || _EFANOVERLAP(4,2) || _EFANOVERLAP(4,3)) - INIT_E_AUTO_FAN_PIN(E4_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_5 && !(_EFANOVERLAP(5,0) || _EFANOVERLAP(5,1) || _EFANOVERLAP(5,2) || _EFANOVERLAP(5,3) || _EFANOVERLAP(5,4)) - INIT_E_AUTO_FAN_PIN(E5_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_6 && !(_EFANOVERLAP(6,0) || _EFANOVERLAP(6,1) || _EFANOVERLAP(6,2) || _EFANOVERLAP(6,3) || _EFANOVERLAP(6,4) || _EFANOVERLAP(6,5)) - INIT_E_AUTO_FAN_PIN(E6_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_FAN_7 && !(_EFANOVERLAP(7,0) || _EFANOVERLAP(7,1) || _EFANOVERLAP(7,2) || _EFANOVERLAP(7,3) || _EFANOVERLAP(7,4) || _EFANOVERLAP(7,5) || _EFANOVERLAP(7,6)) - INIT_E_AUTO_FAN_PIN(E7_AUTO_FAN_PIN); - #endif - #if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E - INIT_CHAMBER_AUTO_FAN_PIN(CHAMBER_AUTO_FAN_PIN); - #endif + #if HAS_AUTO_FAN + #define _OREFAN(I,N) || _EFANOVERLAP(I,N) + #if HAS_AUTO_FAN_0 + INIT_E_AUTO_FAN_PIN(E0_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_1 && !_EFANOVERLAP(0,1) + INIT_E_AUTO_FAN_PIN(E1_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_2 && !(0 REPEAT2(2, _OREFAN, 2)) + INIT_E_AUTO_FAN_PIN(E2_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_3 && !(0 REPEAT2(3, _OREFAN, 3)) + INIT_E_AUTO_FAN_PIN(E3_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_4 && !(0 REPEAT2(4, _OREFAN, 4)) + INIT_E_AUTO_FAN_PIN(E4_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_5 && !(0 REPEAT2(5, _OREFAN, 5)) + INIT_E_AUTO_FAN_PIN(E5_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_6 && !(0 REPEAT2(6, _OREFAN, 6)) + INIT_E_AUTO_FAN_PIN(E6_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_FAN_7 && !(0 REPEAT2(7, _OREFAN, 7)) + INIT_E_AUTO_FAN_PIN(E7_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E + INIT_CHAMBER_AUTO_FAN_PIN(CHAMBER_AUTO_FAN_PIN); + #endif + #if HAS_AUTO_COOLER_FAN && !AUTO_COOLER_IS_E + INIT_COOLER_AUTO_FAN_PIN(COOLER_AUTO_FAN_PIN); + #endif + #endif // HAS_AUTO_FAN #if HAS_HOTEND #define _TEMP_MIN_E(NR) do{ \ @@ -2885,7 +2893,7 @@ void Temperature::init() { * * TODO: Embed the last 3 parameters during init, if not less optimal */ - void Temperature::tr_state_machine_t::run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) { + void Temperature::tr_state_machine_t::run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_float_t hysteresis_degc) { #if HEATER_IDLE_HANDLER // Convert the given heater_id_t to an idle array index @@ -2910,11 +2918,18 @@ void Temperature::init() { */ #if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR) + + #ifdef THERMAL_PROTECTION_VARIANCE_MONITOR_PERIOD + #define VARIANCE_WINDOW THERMAL_PROTECTION_VARIANCE_MONITOR_PERIOD + #else + #define VARIANCE_WINDOW period_seconds + #endif + if (state == TRMalfunction) { // temperature invariance may continue, regardless of heater state variance += ABS(current - last_temp); // no need for detection window now, a single change in variance is enough last_temp = current; if (!NEAR_ZERO(variance)) { - variance_timer = millis() + SEC_TO_MS(period_seconds); + variance_timer = millis() + SEC_TO_MS(VARIANCE_WINDOW); variance = 0.0; state = TRStable; // resume from where we detected the problem } @@ -2947,21 +2962,32 @@ void Temperature::init() { // While the temperature is stable watch for a bad temperature case TRStable: { + const celsius_float_t rdiff = running_temp - current; + #if ENABLED(ADAPTIVE_FAN_SLOWING) if (adaptive_fan_slowing && heater_id >= 0) { - const int fan_index = _MIN(heater_id, FAN_COUNT - 1); - if (fan_speed[fan_index] == 0 || current >= running_temp - (hysteresis_degc * 0.25f)) - fan_speed_scaler[fan_index] = 128; - else if (current >= running_temp - (hysteresis_degc * 0.3335f)) - fan_speed_scaler[fan_index] = 96; - else if (current >= running_temp - (hysteresis_degc * 0.5f)) - fan_speed_scaler[fan_index] = 64; - else if (current >= running_temp - (hysteresis_degc * 0.8f)) - fan_speed_scaler[fan_index] = 32; + const int_fast8_t fan_index = _MIN(heater_id, FAN_COUNT - 1); + uint8_t scale; + if (fan_speed[fan_index] == 0 || rdiff <= hysteresis_degc * 0.25f) + scale = 128; + else if (rdiff <= hysteresis_degc * 0.3335f) + scale = 96; + else if (rdiff <= hysteresis_degc * 0.5f) + scale = 64; + else if (rdiff <= hysteresis_degc * 0.8f) + scale = 32; else - fan_speed_scaler[fan_index] = 0; + scale = 0; + + if (TERN0(REPORT_ADAPTIVE_FAN_SLOWING, DEBUGGING(INFO))) { + const uint8_t fss7 = fan_speed_scaler[fan_index] & 0x80; + if (fss7 ^ (scale & 0x80)) + serial_ternary(fss7, F("Adaptive Fan Slowing "), nullptr, F("de"), F("activated.\n")); + } + + fan_speed_scaler[fan_index] = scale; } - #endif + #endif // ADAPTIVE_FAN_SLOWING const millis_t now = millis(); @@ -2975,13 +3001,13 @@ void Temperature::init() { state = TRMalfunction; break; } - variance_timer = now + SEC_TO_MS(period_seconds); + variance_timer = now + SEC_TO_MS(VARIANCE_WINDOW); variance = 0.0; last_temp = current; } #endif - if (current >= running_temp - hysteresis_degc) { + if (rdiff <= hysteresis_degc) { timer = now + SEC_TO_MS(period_seconds); break; } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index f86ec90d19b4..4bf76e5d4839 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -49,7 +49,7 @@ #define E_NAME TERN_(HAS_MULTI_HOTEND, e) // Element identifiers. Positive values are hotends. Negative values are other heaters or coolers. -typedef enum : int8_t { +typedef enum : int_fast8_t { H_REDUNDANT = HID_REDUNDANT, H_COOLER = HID_COOLER, H_PROBE = HID_PROBE, @@ -377,7 +377,9 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; #elif ENABLED(MPCTEMP) - typedef struct { + typedef struct MPC { + static bool e_paused; // Pause E filament permm tracking + static int32_t e_position; // For E tracking float heater_power; // M306 P float block_heat_capacity; // M306 C float sensor_responsiveness; // M306 R @@ -716,39 +718,39 @@ class Temperature { static hotend_watch_t watch_hotend[HOTENDS]; #endif - #if ENABLED(MPCTEMP) - static int32_t mpc_e_position; - #endif - #if HAS_HOTEND static temp_range_t temp_range[HOTENDS]; #endif #if HAS_HEATED_BED - #if ENABLED(WATCH_BED) + #if WATCH_BED static bed_watch_t watch_bed; #endif - IF_DISABLED(PIDTEMPBED, static millis_t next_bed_check_ms); + #if DISABLED(PIDTEMPBED) + static millis_t next_bed_check_ms; + #endif static raw_adc_t mintemp_raw_BED, maxtemp_raw_BED; #endif #if HAS_HEATED_CHAMBER - #if ENABLED(WATCH_CHAMBER) + #if WATCH_CHAMBER static chamber_watch_t watch_chamber; #endif - TERN(PIDTEMPCHAMBER,,static millis_t next_chamber_check_ms); + #if DISABLED(PIDTEMPCHAMBER) + static millis_t next_chamber_check_ms; + #endif static raw_adc_t mintemp_raw_CHAMBER, maxtemp_raw_CHAMBER; #endif #if HAS_COOLER - #if ENABLED(WATCH_COOLER) + #if WATCH_COOLER static cooler_watch_t watch_cooler; #endif static millis_t next_cooler_check_ms, cooler_fan_flush_ms; static raw_adc_t mintemp_raw_COOLER, maxtemp_raw_COOLER; #endif - #if HAS_TEMP_BOARD && ENABLED(THERMAL_PROTECTION_BOARD) + #if BOTH(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) static raw_adc_t mintemp_raw_BOARD, maxtemp_raw_BOARD; #endif @@ -1194,7 +1196,7 @@ class Temperature { #endif - #if ENABLED(MPCTEMP) + #if ENABLED(MPC_AUTOTUNE) void MPC_autotune(const uint8_t e); #endif @@ -1317,12 +1319,12 @@ class Temperature { typedef struct { millis_t timer = 0; TRState state = TRInactive; - float running_temp; + celsius_float_t running_temp; #if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR) millis_t variance_timer = 0; celsius_float_t last_temp = 0.0, variance = 0.0; #endif - void run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc); + void run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_float_t hysteresis_degc); } tr_state_machine_t; static tr_state_machine_t tr_state_machine[NR_HEATER_RUNAWAY]; diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 0defced87ece..43a50505ef4d 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -435,7 +435,6 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. } } - #endif // TOOL_SENSOR #if ENABLED(SWITCHING_TOOLHEAD) @@ -1173,7 +1172,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #endif // Z raise before retraction - #if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE) + #if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && !HAS_SWITCHING_NOZZLE if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) { // Do a small lift to avoid the workpiece in the move back (below) current_position.z += toolchange_settings.z_raise; @@ -1217,7 +1216,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #endif #endif - #if DISABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE) + #if NONE(TOOLCHANGE_ZRAISE_BEFORE_RETRACT, HAS_SWITCHING_NOZZLE) if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) { // Do a small lift to avoid the workpiece in the move back (below) current_position.z += toolchange_settings.z_raise; @@ -1227,7 +1226,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #endif // Toolchange park - #if ENABLED(TOOLCHANGE_PARK) && DISABLED(SWITCHING_NOZZLE) + #if ENABLED(TOOLCHANGE_PARK) && !HAS_SWITCHING_NOZZLE if (can_move_away && toolchange_settings.enable_park) { IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x); IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y); @@ -1279,6 +1278,11 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { fast_line_to_current(Z_AXIS); } move_nozzle_servo(new_tool); + #elif EITHER(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) + if (!no_move) { + current_position.z = _MIN(current_position.z + toolchange_settings.z_raise, _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS)); + fast_line_to_current(Z_AXIS); + } #endif IF_DISABLED(DUAL_X_CARRIAGE, active_extruder = new_tool); // Set the new active extruder @@ -1343,15 +1347,19 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (toolchange_settings.enable_park) do_blocking_move_to_xy_z(destination, destination.z, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE)); #else do_blocking_move_to_xy(destination, planner.settings.max_feedrate_mm_s[X_AXIS]); - do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); - SECONDARY_AXIS_CODE( - do_blocking_move_to_i(destination.i, planner.settings.max_feedrate_mm_s[I_AXIS]), - do_blocking_move_to_j(destination.j, planner.settings.max_feedrate_mm_s[J_AXIS]), - do_blocking_move_to_k(destination.k, planner.settings.max_feedrate_mm_s[K_AXIS]), - do_blocking_move_to_u(destination.u, planner.settings.max_feedrate_mm_s[U_AXIS]), - do_blocking_move_to_v(destination.v, planner.settings.max_feedrate_mm_s[V_AXIS]), - do_blocking_move_to_w(destination.w, planner.settings.max_feedrate_mm_s[W_AXIS]) - ); + + // If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE below. + #if NONE(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) + do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); + SECONDARY_AXIS_CODE( + do_blocking_move_to_i(destination.i, planner.settings.max_feedrate_mm_s[I_AXIS]), + do_blocking_move_to_j(destination.j, planner.settings.max_feedrate_mm_s[J_AXIS]), + do_blocking_move_to_k(destination.k, planner.settings.max_feedrate_mm_s[K_AXIS]), + do_blocking_move_to_u(destination.u, planner.settings.max_feedrate_mm_s[U_AXIS]), + do_blocking_move_to_v(destination.v, planner.settings.max_feedrate_mm_s[V_AXIS]), + do_blocking_move_to_w(destination.w, planner.settings.max_feedrate_mm_s[W_AXIS]) + ); + #endif #endif #endif @@ -1373,7 +1381,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { TERN_(DUAL_X_CARRIAGE, idex_set_parked(false)); } - #if ENABLED(SWITCHING_NOZZLE) + #if HAS_SWITCHING_NOZZLE // Move back down. (Including when the new tool is higher.) if (!should_move) do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); @@ -1460,6 +1468,29 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { } #endif + // If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE + // so that nozzle does not lower below print surface if new hotend Z offset is higher than old hotend Z offset. + #if EITHER(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) + #if HAS_HOTEND_OFFSET + xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool]; + TERN_(DUAL_X_CARRIAGE, diff.x = 0); + #else + constexpr xyz_pos_t diff{0}; + #endif + + if (!no_move) { + // Move to new hotend Z offset and reverse Z_RAISE + do_blocking_move_to_z( + _MIN( + _MAX((destination.z - diff.z) - toolchange_settings.z_raise, + _MAX(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.min.z, Z_MIN_POS), Z_MIN_POS) + ), + _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS)), + planner.settings.max_feedrate_mm_s[Z_AXIS] + ); + } + #endif + #ifdef EVENT_GCODE_AFTER_TOOLCHANGE if (TERN1(DUAL_X_CARRIAGE, dual_x_carriage_mode == DXC_AUTO_PARK_MODE)) gcode.process_subcommands_now(F(EVENT_GCODE_AFTER_TOOLCHANGE)); diff --git a/Marlin/src/pins/esp32/pins_E4D.h b/Marlin/src/pins/esp32/pins_E4D.h index d12b5276b7be..15b697a85b2c 100644 --- a/Marlin/src/pins/esp32/pins_E4D.h +++ b/Marlin/src/pins/esp32/pins_E4D.h @@ -90,7 +90,7 @@ // Heaters / Fans // #define HEATER_0_PIN 2 -#define FAN_PIN 0 +#define FAN0_PIN 0 #define HEATER_BED_PIN 15 // diff --git a/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h b/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h index 80923d972deb..e911900b1d09 100644 --- a/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h +++ b/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h @@ -101,7 +101,7 @@ // General use mosfets, useful for things like pumps and solenoids // Shift register pins 128, 129, 130 and 131 are broken out and can be used -#define FAN_PIN 132 +#define FAN0_PIN 132 #define FAN1_PIN 134 #define FAN2_PIN 135 #define FAN3_PIN 136 diff --git a/Marlin/src/pins/esp32/pins_ESP32.h b/Marlin/src/pins/esp32/pins_ESP32.h index 266de7e9f60e..1c01be8a88bc 100644 --- a/Marlin/src/pins/esp32/pins_ESP32.h +++ b/Marlin/src/pins/esp32/pins_ESP32.h @@ -79,7 +79,7 @@ // Heaters / Fans // #define HEATER_0_PIN 2 -#define FAN_PIN 13 +#define FAN0_PIN 13 #define HEATER_BED_PIN 4 // SPI diff --git a/Marlin/src/pins/esp32/pins_ESPA_common.h b/Marlin/src/pins/esp32/pins_ESPA_common.h index ca949cdf9716..36068150f720 100644 --- a/Marlin/src/pins/esp32/pins_ESPA_common.h +++ b/Marlin/src/pins/esp32/pins_ESPA_common.h @@ -68,7 +68,7 @@ // Heaters / Fans // #define HEATER_0_PIN 2 -#define FAN_PIN 13 +#define FAN0_PIN 13 #define HEATER_BED_PIN 4 // diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 37ce4ee94e56..791ddcab41f1 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -104,7 +104,7 @@ // #define HEATER_0_PIN 145 #define HEATER_1_PIN 146 -#define FAN_PIN 147 +#define FAN0_PIN 147 #define FAN1_PIN 148 #define HEATER_BED_PIN 144 diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPE.h b/Marlin/src/pins/esp32/pins_MRR_ESPE.h index f372de9e0110..b95e54841e0e 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPE.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPE.h @@ -102,7 +102,7 @@ // Heaters / Fans // #define HEATER_0_PIN 145 // 2 -#define FAN_PIN 146 // 15 +#define FAN0_PIN 146 // 15 #define HEATER_BED_PIN 144 // 4 #define CONTROLLER_FAN_PIN 147 diff --git a/Marlin/src/pins/esp32/pins_PANDA_common.h b/Marlin/src/pins/esp32/pins_PANDA_common.h index afc9a78aec01..232580567610 100644 --- a/Marlin/src/pins/esp32/pins_PANDA_common.h +++ b/Marlin/src/pins/esp32/pins_PANDA_common.h @@ -74,7 +74,7 @@ // #define HEATER_0_PIN 108 #define HEATER_BED_PIN 109 -#define FAN_PIN 118 // FAN0 +#define FAN0_PIN 118 // FAN0 #define FAN1_PIN 119 // FAN1 #ifndef E0_AUTO_FAN_PIN diff --git a/Marlin/src/pins/gd32f1/env_validate.h b/Marlin/src/pins/gd32f1/env_validate.h new file mode 100644 index 000000000000..4b07cce4e5c4 --- /dev/null +++ b/Marlin/src/pins/gd32f1/env_validate.h @@ -0,0 +1,32 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 NOT_TARGET(__STM32F1__, STM32F1) + #if DISABLED(ALLOW_STM32F4) + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" + #elif NOT_TARGET(STM32F4) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" + #endif +#endif + +#undef ALLOW_STM32F4 diff --git a/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h b/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h new file mode 100644 index 000000000000..f09f63322080 --- /dev/null +++ b/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h @@ -0,0 +1,152 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "env_validate.h" + +#define BOARD_INFO_NAME "TRIGORILLA_V006" +#define DEFAULT_MACHINE_NAME "GD32F103" + +#define BOARD_NO_NATIVE_USB + +// Release PA13 from SWD for CASE_LIGHT_PIN +#define DISABLE_DEBUG +#define DISABLE_JTAG + +// +// EEPROM +// +#define FLASH_EEPROM_EMULATION +#define MARLIN_EEPROM_SIZE 0x1000 // 4KB + +// +// Limit Switches +// +#define X_MIN_PIN PA7 +#define X_MAX_PIN PC6 +#define Y_MIN_PIN PC5 +#define Y_MAX_PIN -1 +#define Z_MIN_PIN PB2 +#define Z_MAX_PIN -1 + +// +// Steppers +// +#define X_ENABLE_PIN PC3 +#define X_STEP_PIN PC2 +#define X_DIR_PIN PB9 + +#define Y_ENABLE_PIN PC13 +#define Y_STEP_PIN PB8 +#define Y_DIR_PIN PB7 + +#define Z_ENABLE_PIN PC14 +#define Z_STEP_PIN PB6 +#define Z_DIR_PIN PB5 + +#define E0_ENABLE_PIN PA15 +#define E0_STEP_PIN PB4 +#define E0_DIR_PIN PB3 + +#define E1_ENABLE_PIN PC15 +#define E1_STEP_PIN PC0 +#define E1_DIR_PIN PC1 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC4 // T0 +#define TEMP_1_PIN -1 // T1 PA6 used for power loss +#define TEMP_BED_PIN PB0 // TB + +// +// Heaters +// +#define HEATER_0_PIN PA1 // H0 +#define HEATER_1_PIN PA8 // H1 +#define HEATER_BED_PIN PA4 // HB + +// +// Fans +// +#define FAN0_PIN PA0 // FAN +#define FAN1_PIN PA14 // Connected to +24V +#define FAN2_PIN -1 // PB1, auto fan for E0 +#define CONTROLLER_FAN_PIN FAN1_PIN + +// +// Misc +// +#define BEEPER_PIN PB15 +#define LED_PIN -1 +#define POWER_LOSS_PIN PA6 +#define FIL_RUNOUT_PIN PA5 +#define CASE_LIGHT_PIN PA13 +#define POWER_MONITOR_VOLTAGE_PIN PA6 + +#define AUTO_LEVEL_TX_PIN PB13 +#define AUTO_LEVEL_RX_PIN PB12 + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN AUTO_LEVEL_RX_PIN +#endif + +// +// SD Card +// +#define SD_DETECT_PIN PC7 + +#ifndef SDIO_SUPPORT + #define SDIO_SUPPORT +#endif +#if ENABLED(SDIO_SUPPORT) + // + // SPI + // + #define SPI_DEVICE -1 + #define SCK_PIN -1 + #define MISO_PIN -1 + #define MOSI_PIN -1 + #define SS_PIN -1 + + // + // SDIO + // + #define SDIO_READ_RETRIES 16 + #define SDIO_D0_PIN PC8 + #define SDIO_D1_PIN PC9 + #define SDIO_D2_PIN PC10 + #define SDIO_D3_PIN PC11 + #define SDIO_CK_PIN PC12 + #define SDIO_CMD_PIN PD2 + +#else + + #undef SDSS + #define SDSS PC11 // SDIO_D3_PIN + #define SS_PIN SDSS + #define SCK_PIN PC12 // SDIO_CK_PIN + #define MISO_PIN PC8 // SDIO_D0_PIN + #define MOSI_PIN PD2 // SDIO_CMD_PIN + #define SOFTWARE_SPI + +#endif diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 3616b7a27c43..bfef46c9459b 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -161,21 +161,21 @@ #define HEATER_0_PIN MOSFET_A_PIN #if FET_ORDER_EFB // Hotend, Fan, Bed - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #define HEATER_BED_PIN MOSFET_C_PIN #elif FET_ORDER_EEF // Hotend, Hotend, Fan #define HEATER_1_PIN MOSFET_B_PIN - #define FAN_PIN MOSFET_C_PIN + #define FAN0_PIN MOSFET_C_PIN #elif FET_ORDER_EEB // Hotend, Hotend, Bed #define HEATER_1_PIN MOSFET_B_PIN #define HEATER_BED_PIN MOSFET_C_PIN #elif FET_ORDER_EFF // Hotend, Fan, Fan - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #define FAN1_PIN MOSFET_C_PIN #elif FET_ORDER_SF // Spindle, Fan - #define FAN_PIN MOSFET_C_PIN + #define FAN0_PIN MOSFET_C_PIN #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #define HEATER_BED_PIN MOSFET_C_PIN #if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL) #define FAN1_PIN MOSFET_D_PIN @@ -184,8 +184,8 @@ #endif #endif -#ifndef FAN_PIN - #define FAN_PIN 4 // IO pin. Buffer needed +#ifndef FAN0_PIN + #define FAN0_PIN 4 // IO pin. Buffer needed #endif // @@ -247,18 +247,16 @@ #endif /** - * Default pins for TMC software SPI + * Default pins for TMC SPI */ -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 66 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 44 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 64 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI 66 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO 44 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK 64 #endif #if HAS_TMC_UART diff --git a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h index 4d1dbecf2e8f..ca8010493bb9 100644 --- a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -80,8 +82,8 @@ // EFB #define HEATER_0_PIN P2_04 #define HEATER_BED_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P2_07 +#ifndef FAN0_PIN + #define FAN0_PIN P2_07 #endif #define FAN1_PIN P0_26 diff --git a/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h b/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h index 10a610ff95f7..7115cea0bd48 100644 --- a/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h +++ b/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h @@ -22,11 +22,7 @@ #pragma once /** - * BIQU BQ111-A4 - * - * Applies to the following boards: - * - * BOARD_BIQU_BQ111_A4 (Hotend, Fan, Bed) + * BIQU Thunder B300 V1.0 */ #include "env_validate.h" @@ -77,18 +73,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P0_18 // ETH - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_17 // ETH - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_15 // ETH - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P0_18 // ETH +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_17 // ETH +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_15 // ETH #endif // @@ -103,8 +97,8 @@ // #define HEATER_0_PIN P2_07 #define HEATER_BED_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P2_04 +#ifndef FAN0_PIN + #define FAN0_PIN P2_04 #endif // @@ -174,7 +168,7 @@ * PWM1.4 P1_23 * PWM1.4 P2_3 E0_STEP_PIN * PWM1.5 P1_24 X_MIN_PIN - * PWM1.5 P2_4 FAN_PIN + * PWM1.5 P2_4 FAN0_PIN * PWM1.6 P1_26 Y_MIN_PIN * PWM1.6 P2_5 HEATER_BED_PIN */ diff --git a/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h b/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h index 92152170a013..d5f1d0a29616 100644 --- a/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h +++ b/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h @@ -23,6 +23,10 @@ /** * BIQU BQ111-A4 pin assignments + * + * Applies to the following boards: + * + * BOARD_BIQU_BQ111_A4 (Hotend, Fan, Bed) */ #include "env_validate.h" @@ -70,8 +74,8 @@ // #define HEATER_0_PIN P2_07 #define HEATER_BED_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P2_04 +#ifndef FAN0_PIN + #define FAN0_PIN P2_04 #endif // @@ -143,7 +147,7 @@ * PWM1.4 P1_23 * PWM1.4 P2_3 E0_STEP_PIN * PWM1.5 P1_24 X_MIN_PIN - * PWM1.5 P2_4 FAN_PIN + * PWM1.5 P2_4 FAN0_PIN * PWM1.6 P1_26 Y_MIN_PIN * PWM1.6 P2_5 HEATER_BED_PIN */ 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 d11224315bb7..d1ea2c0197b6 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h @@ -23,6 +23,8 @@ /** * 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 */ #define BOARD_INFO_NAME "BTT SKR V1.1" @@ -56,7 +58,6 @@ #define E0_DIR_PIN P2_13 #define E0_ENABLE_PIN P2_12 - /** ------ ------ * 1.30 | 1 2 | 2.11 0.17 | 1 2 | 0.15 * 0.18 | 3 4 | 0.16 3.26 | 3 4 | 1.23 @@ -165,12 +166,12 @@ // When using any TMC SPI-based drivers, software SPI is used // because pins may be shared with the display or SD card. #define TMC_USE_SW_SPI - #define TMC_SW_MOSI EXP2_06_PIN - #define TMC_SW_MISO EXP2_01_PIN + #define TMC_SPI_MOSI EXP2_06_PIN + #define TMC_SPI_MISO EXP2_01_PIN // To minimize pin usage use the same clock pin as the display/SD card reader. (May generate LCD noise.) - #define TMC_SW_SCK EXP2_02_PIN + #define TMC_SPI_SCK EXP2_02_PIN // If pin 2_06 is unused, it can be used for the clock to avoid the LCD noise. - //#define TMC_SW_SCK P2_06 + //#define TMC_SPI_SCK P2_06 #if ENABLED(SOFTWARE_DRIVER_ENABLE) 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 03994187c88f..aafc8d3f9fe5 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -23,6 +23,8 @@ /** * 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 */ #define BOARD_INFO_NAME "BTT SKR V1.3" @@ -137,18 +139,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P4_28 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_05 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_04 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P4_28 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_05 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_04 #endif #if HAS_TMC_UART @@ -289,7 +289,7 @@ #define DOGLCD_A0 EXP1_06_PIN #define DOGLCD_SCK EXP1_04_PIN #define DOGLCD_MOSI EXP1_01_PIN - #define LCD_BACKLIGHT_PIN -1 + #define LCD_BACKLIGHT_PIN -1 #elif ENABLED(CR10_STOCKDISPLAY) 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 a574a9fe8d0d..b4fafbf7a4ce 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -194,18 +196,16 @@ #define TEMP_BED_PIN P0_25_A2 // A2 (T2) - (69) - TEMP_BED_PIN // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_17 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_05 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_04 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P1_17 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_05 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_04 #endif #if HAS_TMC_UART diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h index ec74cc640e85..2b01b4ce6f9a 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h @@ -101,8 +101,8 @@ #define HEATER_1_PIN P2_04 #endif #endif -#ifndef FAN_PIN - #define FAN_PIN P2_03 +#ifndef FAN0_PIN + #define FAN0_PIN P2_03 #endif #ifndef HEATER_BED_PIN #define HEATER_BED_PIN P2_05 diff --git a/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h b/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h index 6e1ea403b1f2..43a9b786eb7d 100644 --- a/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h +++ b/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h @@ -23,6 +23,8 @@ /** * 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 * * Board pins<->features assignments are based on the * Micro-Delta Rework printer default connections. @@ -85,7 +87,7 @@ #define HEATER_0_PIN P2_06 // (H2: 10A shared) #define HEATER_1_PIN P2_07 // (H3: 10A shared) -#define FAN_PIN P2_11 // (FAN0: 1A) +#define FAN0_PIN P2_11 // (FAN0: 1A) #define FAN1_PIN P2_13 // (FAN1: 1A) // diff --git a/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h b/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h index 39ab0bbd8968..63760d962bc9 100644 --- a/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h +++ b/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -121,7 +123,7 @@ // #define HEATER_BED_PIN P1_19 // Not a PWM pin, software PWM required #define HEATER_0_PIN P3_26 // PWM1[3] -#define FAN_PIN P3_25 // Part cooling fan - connected to PWM1[2] +#define FAN0_PIN P3_25 // Part cooling fan - connected to PWM1[2] #define E0_AUTO_FAN_PIN P0_27 // Extruder cooling fan // diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index cf12a98aef28..9218bb168d6f 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -23,6 +23,8 @@ /** * 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" @@ -99,8 +101,8 @@ #define HEATER_BED_PIN P2_05 #define HEATER_0_PIN P2_07 #define HEATER_1_PIN P2_06 -#ifndef FAN_PIN - #define FAN_PIN P2_04 +#ifndef FAN0_PIN + #define FAN0_PIN P2_04 #endif // @@ -184,7 +186,7 @@ #define SD_MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8) #define SD_MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.9) #define SD_SS_PIN P0_28 - #define LPC_SOFTWARE_SPI // With a custom cable we need software SPI because the + #define SOFTWARE_SPI // With a custom cable we need software SPI because the // selected pins are not on a hardware SPI controller #elif SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD) #define SD_SCK_PIN P0_07 @@ -300,16 +302,14 @@ // Hardware SPI is on EXP2. See if you can make it work: // https://github.com/makerbase-mks/MKS-SBASE/issues/25 #define TMC_USE_SW_SPI - #if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P0_03 // AUX1 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_02 // AUX1 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_26 // TH4 - #endif + #ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P0_03 // AUX1 + #endif + #ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_02 // AUX1 + #endif + #ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_26 // TH4 #endif #endif diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 4e9f98c85285..155d53c7803f 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -132,18 +134,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P4_28 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_05 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_04 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P4_28 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_05 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_04 #endif #if HAS_TMC_UART @@ -209,8 +209,8 @@ #define HEATER_1_PIN P2_06 #endif #endif -#ifndef FAN_PIN - #define FAN_PIN P2_04 +#ifndef FAN0_PIN + #define FAN0_PIN P2_04 #endif // diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index 9a210e16070a..b9edef8678db 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -23,6 +23,8 @@ /** * 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 * * Applies to the following boards: * @@ -97,18 +99,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_00 // ETH - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P1_08 // ETH - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P1_09 // ETH - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P1_00 // ETH +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P1_08 // ETH +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P1_09 // ETH #endif #if HAS_TMC_UART @@ -119,7 +119,6 @@ * If undefined software serial is used according to the pins below */ - // P2_08 E1-Step // P2_13 E1-Dir @@ -204,15 +203,15 @@ #endif #endif -#ifndef FAN_PIN +#ifndef FAN0_PIN #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN MOSFET_C_PIN + #define FAN0_PIN MOSFET_C_PIN #elif FET_ORDER_EEB // Hotend, Hotend, Bed - #define FAN_PIN P1_18 // (4) IO pin. Buffer needed + #define FAN0_PIN P1_18 // (4) IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #endif #endif diff --git a/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h b/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h index 2972ac756079..996cb52c6cfa 100644 --- a/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h +++ b/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -85,8 +87,8 @@ #define HEATER_BED2_PIN P2_04 #define HEATER_0_PIN P2_07 #define HEATER_1_PIN P2_06 -#ifndef FAN_PIN - #define FAN_PIN P1_24 +#ifndef FAN0_PIN + #define FAN0_PIN P1_24 #endif #define FAN1_PIN P1_26 diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h index bc7cada8da05..9dfb80772fb2 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -98,8 +100,8 @@ #define HEATER_BED_PIN P2_07 #define HEATER_0_PIN P2_04 #define HEATER_1_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P0_26 +#ifndef FAN0_PIN + #define FAN0_PIN P0_26 #endif #define FAN1_PIN P1_22 diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h index c33fe6e28f45..2d96194db58c 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h @@ -23,6 +23,10 @@ /** * 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 */ #include "env_validate.h" @@ -100,8 +104,8 @@ // #define HEATER_BED_PIN P2_07 #define HEATER_0_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P0_26 +#ifndef FAN0_PIN + #define FAN0_PIN P0_26 #endif #define FAN1_PIN P1_25 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 086bacbac0f6..74439e4f3d27 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h @@ -23,6 +23,8 @@ /** * 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 */ #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 dbaafb89ccf7..70f7f748c064 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -177,7 +179,7 @@ #define HEATER_0_PIN P2_03 // EXTRUDER 0 #define HEATER_1_PIN P2_04 // EXTRUDER 1 #define HEATER_BED_PIN P2_05 // BED -#define FAN_PIN P2_01 +#define FAN0_PIN P2_01 #define FAN1_PIN P2_02 #ifndef CONTROLLER_FAN_PIN 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 7f428fc91881..1bd70d8fb598 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,6 +23,8 @@ /** * 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 */ #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 237dfaec36fb..fa389f49247c 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h @@ -23,6 +23,8 @@ /** * 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/ */ #include "env_validate.h" @@ -70,16 +72,14 @@ // // Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P1_16 // Ethernet Expansion - Pin 5 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P1_17 // Ethernet Expansion - Pin 6 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P1_08 // Ethernet Expansion - Pin 7 #endif // @@ -94,8 +94,8 @@ // #define HEATER_BED_PIN P2_05 #define HEATER_0_PIN P2_07 // FET 1 -#ifndef FAN_PIN - #define FAN_PIN P2_06 // FET 3 +#ifndef FAN0_PIN + #define FAN0_PIN P2_06 // FET 3 #endif // @@ -125,7 +125,7 @@ #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #undef HEATER_BED_PIN #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET - #undef FAN_PIN + #undef FAN0_PIN #define SPINDLE_DIR_PIN P2_06 // FET 3 #endif diff --git a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h index ea2e0b708251..2d44a3859b48 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -87,16 +89,14 @@ // // Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P1_16 // Ethernet Expansion - Pin 5 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P1_17 // Ethernet Expansion - Pin 6 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P1_08 // Ethernet Expansion - Pin 7 #endif // @@ -119,8 +119,8 @@ #define HEATER_0_PIN P2_07 // FET 1 #define HEATER_1_PIN P1_23 // FET 2 #define HEATER_2_PIN P1_22 // FET 3 -#ifndef FAN_PIN - #define FAN_PIN P2_06 // FET 4 +#ifndef FAN0_PIN + #define FAN0_PIN P2_06 // FET 4 #endif // @@ -152,7 +152,7 @@ #if HAS_CUTTER #undef HEATER_0_PIN #undef HEATER_BED_PIN - #undef FAN_PIN + #undef FAN0_PIN #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET #define SPINDLE_DIR_PIN P2_06 // FET 4 diff --git a/Marlin/src/pins/lpc1769/pins_FLY_CDY.h b/Marlin/src/pins/lpc1769/pins_FLY_CDY.h index ec0b14af9043..796df12e754f 100644 --- a/Marlin/src/pins/lpc1769/pins_FLY_CDY.h +++ b/Marlin/src/pins/lpc1769/pins_FLY_CDY.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -92,18 +94,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P0_20 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_19 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_21 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P0_20 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_19 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_21 #endif #if HAS_TMC_UART @@ -144,8 +144,8 @@ #define HEATER_0_PIN P3_25 #define HEATER_1_PIN P1_20 #define HEATER_2_PIN P1_23 -#ifndef FAN_PIN - #define FAN_PIN P1_18 +#ifndef FAN0_PIN + #define FAN0_PIN P1_18 #endif #define FAN1_PIN P1_21 #define FAN2_PIN P1_24 diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h index 23bcecc78d74..1e71fccfe5c5 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h @@ -23,6 +23,8 @@ /** * 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 * * 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 2f25d8b5fdd3..f49aae0c45f3 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -146,18 +148,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_16 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_05 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_04 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI P1_16 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO P0_05 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK P0_04 #endif #if HAS_TMC_UART @@ -229,8 +229,8 @@ #define FAN2_PIN P2_06 // HE1 for FAN3 #endif #endif -#ifndef FAN_PIN - #define FAN_PIN P2_04 // FAN1 +#ifndef FAN0_PIN + #define FAN0_PIN P2_04 // FAN1 #endif #ifndef FAN1_PIN #define FAN1_PIN P1_04 // FAN2 @@ -342,7 +342,7 @@ #define TFT_CS_PIN EXP1_07_PIN #define TFT_DC_PIN EXP1_08_PIN - #define TFT_A0_PIN TFT_DC_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TFT_MISO_PIN EXP2_01_PIN #define TFT_BACKLIGHT_PIN EXP1_03_PIN #define TFT_RESET_PIN EXP1_04_PIN diff --git a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h index cfaca164f89e..c8526611d086 100644 --- a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -83,8 +85,8 @@ #define HEATER_BED_PIN P2_05 #define HEATER_0_PIN P2_07 #define HEATER_1_PIN P1_23 -#ifndef FAN_PIN - #define FAN_PIN P2_06 +#ifndef FAN0_PIN + #define FAN0_PIN P2_06 #endif #define FAN1_PIN P2_04 diff --git a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h index 12a7934a3ead..8ad3cd28214e 100644 --- a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h @@ -119,8 +119,8 @@ // #define HEATER_BED_PIN P2_05 #define HEATER_0_PIN P2_07 -#ifndef FAN_PIN - #define FAN_PIN P2_06 +#ifndef FAN0_PIN + #define FAN0_PIN P2_06 #endif #define FAN1_PIN P1_22 diff --git a/Marlin/src/pins/mega/pins_CHEAPTRONIC.h b/Marlin/src/pins/mega/pins_CHEAPTRONIC.h index 8bcb263bc1fd..e95f6c4adead 100644 --- a/Marlin/src/pins/mega/pins_CHEAPTRONIC.h +++ b/Marlin/src/pins/mega/pins_CHEAPTRONIC.h @@ -23,6 +23,7 @@ /** * Cheaptronic v1.0 pin assignments + * ATmega2560 */ #include "env_validate.h" diff --git a/Marlin/src/pins/mega/pins_CHEAPTRONICv2.h b/Marlin/src/pins/mega/pins_CHEAPTRONICv2.h index 01438975b979..92c5a6f12392 100644 --- a/Marlin/src/pins/mega/pins_CHEAPTRONICv2.h +++ b/Marlin/src/pins/mega/pins_CHEAPTRONICv2.h @@ -24,7 +24,9 @@ /** * Cheaptronic v2.0 pin assignments * Built and sold by Michal Dyntar - RRO - * www.reprapobchod.cz + * www.reprapobchod.cz (DOES NOT EXIST ANYMORE) + * https://web.archive.org/web/20190306201523/http://reprapobchod.cz/ + * ATmega2560 */ #include "env_validate.h" @@ -84,8 +86,8 @@ #define HEATER_1_PIN 7 #define HEATER_2_PIN 8 #define HEATER_BED_PIN 9 -#ifndef FAN_PIN - #define FAN_PIN 3 +#ifndef FAN0_PIN + #define FAN0_PIN 3 #endif #define FAN2_PIN 58 // additional fan or light control output diff --git a/Marlin/src/pins/mega/pins_CNCONTROLS_11.h b/Marlin/src/pins/mega/pins_CNCONTROLS_11.h index 5f7a534d115b..60d68a8607ba 100644 --- a/Marlin/src/pins/mega/pins_CNCONTROLS_11.h +++ b/Marlin/src/pins/mega/pins_CNCONTROLS_11.h @@ -23,6 +23,9 @@ /** * CartesioV11 pin assignments + * Comes with an Arduino Mega, see + * https://web.archive.org/web/20171024190029/http://mauk.cc/mediawiki/index.php/Electronical_assembly + * ATmega2560, ATmega1280 */ #define ALLOW_MEGA1280 @@ -90,8 +93,8 @@ #define HEATER_3_PIN 46 #define HEATER_BED_PIN 2 -#ifndef FAN_PIN - //#define FAN_PIN 7 // common PWM pin for all tools +#ifndef FAN0_PIN + //#define FAN0_PIN 7 // common PWM pin for all tools #endif // diff --git a/Marlin/src/pins/mega/pins_CNCONTROLS_12.h b/Marlin/src/pins/mega/pins_CNCONTROLS_12.h index 0aa0b59ca945..5c92f92e29d6 100644 --- a/Marlin/src/pins/mega/pins_CNCONTROLS_12.h +++ b/Marlin/src/pins/mega/pins_CNCONTROLS_12.h @@ -23,6 +23,9 @@ /** * CartesioV12 pin assignments + * Comes with an Arduino Mega, see + * https://web.archive.org/web/20171024190029/http://mauk.cc/mediawiki/index.php/Electronical_assembly + * ATmega2560, ATmega1280 */ #define ALLOW_MEGA1280 @@ -90,8 +93,8 @@ #define HEATER_3_PIN 3 #define HEATER_BED_PIN 24 -#ifndef FAN_PIN - #define FAN_PIN 5 // 5 is PWMtool3 -> 7 is common PWM pin for all tools +#ifndef FAN0_PIN + #define FAN0_PIN 5 // 5 is PWMtool3 -> 7 is common PWM pin for all tools #endif // diff --git a/Marlin/src/pins/mega/pins_CNCONTROLS_15.h b/Marlin/src/pins/mega/pins_CNCONTROLS_15.h index 6de3b7172eb0..bbb0385844f9 100644 --- a/Marlin/src/pins/mega/pins_CNCONTROLS_15.h +++ b/Marlin/src/pins/mega/pins_CNCONTROLS_15.h @@ -23,6 +23,7 @@ /** * CNControls V15 for HMS434 pin assignments + * ATmega2560, ATmega1280 */ #define ALLOW_MEGA1280 @@ -86,7 +87,7 @@ // // Fans // -#define FAN_PIN 8 +#define FAN0_PIN 8 // // Auto fans diff --git a/Marlin/src/pins/mega/pins_EINSTART-S.h b/Marlin/src/pins/mega/pins_EINSTART-S.h index c8cbee674011..813cbf7dc42f 100644 --- a/Marlin/src/pins/mega/pins_EINSTART-S.h +++ b/Marlin/src/pins/mega/pins_EINSTART-S.h @@ -23,6 +23,7 @@ /** * Einstart-S pin assignments + * ATmega2560, ATmega1280 * PCB Silkscreen: 3DPrinterCon_v3.5 */ @@ -69,7 +70,7 @@ #define HEATER_0_PIN 83 #define HEATER_BED_PIN 38 -#define FAN_PIN 82 +#define FAN0_PIN 82 // // Misc. Functions diff --git a/Marlin/src/pins/mega/pins_ELEFU_3.h b/Marlin/src/pins/mega/pins_ELEFU_3.h index f5e146cff99c..71797a30fff8 100644 --- a/Marlin/src/pins/mega/pins_ELEFU_3.h +++ b/Marlin/src/pins/mega/pins_ELEFU_3.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #include "env_validate.h" @@ -89,8 +92,8 @@ #define HEATER_2_PIN 17 // 12V PWM3 #define HEATER_BED_PIN 44 // DOUBLE 12V PWM -#ifndef FAN_PIN - #define FAN_PIN 16 // 5V PWM +#ifndef FAN0_PIN + #define FAN0_PIN 16 // 5V PWM #endif // diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_A.h b/Marlin/src/pins/mega/pins_GT2560_REV_A.h index 99e8704ea558..99e2031706ec 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_A.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_A.h @@ -25,6 +25,9 @@ * 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 + * ATmega2560 */ #define ALLOW_MEGA1280 @@ -92,8 +95,8 @@ #define HEATER_0_PIN 2 #define HEATER_1_PIN 3 #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 7 +#ifndef FAN0_PIN + #define FAN0_PIN 7 #endif // 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 7e2ce20c6798..a982a0e00e73 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #define BOARD_INFO_NAME "GT2560 Rev.A+" diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_B.h b/Marlin/src/pins/mega/pins_GT2560_REV_B.h index be71ec4902dc..0702d14eb8d2 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_B.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_B.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #define BOARD_INFO_NAME "GT2560 Rev B" diff --git a/Marlin/src/pins/mega/pins_GT2560_V3.h b/Marlin/src/pins/mega/pins_GT2560_V3.h index 46b4ebf4287e..e4e51c30b374 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 * * Also GT2560 RevB and GT2560 4.0/4.1 */ @@ -135,7 +138,7 @@ #define HEATER_1_PIN 3 #define HEATER_2_PIN 2 #define HEATER_BED_PIN 4 -#define FAN_PIN 9 +#define FAN0_PIN 9 #define FAN1_PIN 8 #define FAN2_PIN 7 diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h index 986dd1cb04bb..628f897b0ca6 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h @@ -23,6 +23,7 @@ /** * Geeetech A20M board pin assignments + * ATmega2560 */ #define LCD_PINS_RS 5 @@ -30,7 +31,7 @@ #define LCD_PINS_D4 21 #define LCD_PINS_D7 6 -#define SPEAKER // The speaker can produce tones +#define SPEAKER // The speaker can produce tones #if IS_NEWPANEL #define BTN_EN1 16 diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h b/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h index e683d4dfda4b..70854c5716dd 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h @@ -23,6 +23,7 @@ /** * Geeetech GT2560 V 3.0 board pin assignments (for Mecreator 2) + * ATmega2560 */ #define BOARD_INFO_NAME "GT2560 V3.0 (MC2)" diff --git a/Marlin/src/pins/mega/pins_GT2560_V4.h b/Marlin/src/pins/mega/pins_GT2560_V4.h index 6ac07b70bfce..98f503886f89 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V4.h +++ b/Marlin/src/pins/mega/pins_GT2560_V4.h @@ -23,6 +23,9 @@ /** * 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 */ #define BOARD_INFO_NAME "GT2560 4.x" diff --git a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h index 83a612e67cdc..8ca2d44db99a 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h @@ -23,6 +23,7 @@ /** * Geeetech A20 GT2560 V4.x board pin assignments + * ATmega2560 */ #define BOARD_INFO_NAME "GT2560 4.x" @@ -32,7 +33,7 @@ #define LCD_PINS_D4 21 #define LCD_PINS_D7 6 -#define SPEAKER // The speaker can produce tones +#define SPEAKER // The speaker can produce tones #if IS_NEWPANEL #define BTN_EN1 16 diff --git a/Marlin/src/pins/mega/pins_HJC2560C_REV2.h b/Marlin/src/pins/mega/pins_HJC2560C_REV2.h index 5c3b1dc9f6d6..ea197e50dbcf 100644 --- a/Marlin/src/pins/mega/pins_HJC2560C_REV2.h +++ b/Marlin/src/pins/mega/pins_HJC2560C_REV2.h @@ -23,6 +23,7 @@ /** * Geeetech HJC2560-C Rev 2.x board pin assignments + * ATmega2560 */ #include "env_validate.h" @@ -91,8 +92,8 @@ #define HEATER_1_PIN 3 #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 7 //默认不使用PWM_FAN冷却喷嘴,如果需要,则取消注释 +#ifndef FAN0_PIN + #define FAN0_PIN 7 //默认不使用PWM_FAN冷却喷嘴,如果需要,则取消注释 #endif // diff --git a/Marlin/src/pins/mega/pins_INTAMSYS40.h b/Marlin/src/pins/mega/pins_INTAMSYS40.h index 2e2a9b85db14..903849a14005 100644 --- a/Marlin/src/pins/mega/pins_INTAMSYS40.h +++ b/Marlin/src/pins/mega/pins_INTAMSYS40.h @@ -23,6 +23,7 @@ /** * Intamsys Funmat HT V4.0 Mainboard + * ATmega2560 * 4988 Drivers Tested * 2208 version exists and may or may not work */ @@ -98,7 +99,7 @@ #define HEATER_0_PIN 2 // PWM #define HEATER_BED_PIN 4 // PWM #define HEATER_CHAMBER_PIN 3 // PWM -#define FAN_PIN 7 // PWM +#define FAN0_PIN 7 // PWM // // Misc. Functions diff --git a/Marlin/src/pins/mega/pins_LEAPFROG.h b/Marlin/src/pins/mega/pins_LEAPFROG.h index 4700fd6729bd..d986728e7273 100644 --- a/Marlin/src/pins/mega/pins_LEAPFROG.h +++ b/Marlin/src/pins/mega/pins_LEAPFROG.h @@ -23,6 +23,7 @@ /** * Leapfrog Driver board pin assignments + * ATmega2560, ATmega1280 */ #define ALLOW_MEGA1280 @@ -78,7 +79,7 @@ #define HEATER_2_PIN 11 // 13 #define HEATER_BED_PIN 10 // 14/15 -#define FAN_PIN 7 +#define FAN0_PIN 7 // // Misc. Functions diff --git a/Marlin/src/pins/mega/pins_LEAPFROG_XEED2015.h b/Marlin/src/pins/mega/pins_LEAPFROG_XEED2015.h index 4a32472949a3..7b3cb2b723db 100644 --- a/Marlin/src/pins/mega/pins_LEAPFROG_XEED2015.h +++ b/Marlin/src/pins/mega/pins_LEAPFROG_XEED2015.h @@ -23,6 +23,7 @@ /** * Leapfrog Xeed Driver board pin assignments + * ATmega2560 * * This board is used by other Leapfrog printers in addition to the Xeed, * such as the Creatr HS and Bolt. The pin assignments vary wildly between @@ -103,7 +104,7 @@ #define HEATER_1_PIN 9 // Misc Connector, pins 5 and 6 (Out3) #define HEATER_BED_PIN 6 // Misc Connector, pins 9(-) and 10(+) (OutA) -#define FAN_PIN 10 // Misc Connector, pins 7(-) and 8 (+) (Out4) +#define FAN0_PIN 10 // Misc Connector, pins 7(-) and 8 (+) (Out4) #define LED_PIN 13 diff --git a/Marlin/src/pins/mega/pins_MALYAN_M180.h b/Marlin/src/pins/mega/pins_MALYAN_M180.h index 19095a53799f..4eb7928825cd 100644 --- a/Marlin/src/pins/mega/pins_MALYAN_M180.h +++ b/Marlin/src/pins/mega/pins_MALYAN_M180.h @@ -24,6 +24,8 @@ /** * Malyan M180 pin assignments * Contributed by Timo Birnschein (timo.birnschein@microforge.de) + * @Timo: sind diese Pin Definitionen immernoch korrekt? (Antwort an turningtides@outlook.de bitte) + * ATmega2560 */ #include "env_validate.h" @@ -91,8 +93,8 @@ #define HEATER_1_PIN 11 #define HEATER_BED_PIN 45 -#ifndef FAN_PIN - #define FAN_PIN 7 // M106 Sxxx command supported and tested. M107 as well. +#ifndef FAN0_PIN + #define FAN0_PIN 7 // M106 Sxxx command supported and tested. M107 as well. #endif #ifndef FAN_PIN1 diff --git a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h index 7ebef6e281cf..19808817c93d 100644 --- a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -111,8 +114,8 @@ #define HEATER_1_PIN 34 #define HEATER_BED_PIN 28 -#ifndef FAN_PIN - #define FAN_PIN 39 +#ifndef FAN0_PIN + #define FAN0_PIN 39 #endif #define FAN1_PIN 35 #define FAN2_PIN 36 diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS.h b/Marlin/src/pins/mega/pins_MEGATRONICS.h index ac0ba4eea662..b038c9935c26 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #include "env_validate.h" @@ -86,8 +89,8 @@ #define HEATER_1_PIN 8 #define HEATER_BED_PIN 10 -#ifndef FAN_PIN - #define FAN_PIN 7 // IO pin. Buffer needed +#ifndef FAN0_PIN + #define FAN0_PIN 7 // IO pin. Buffer needed #endif // diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h index e52703591063..5ebcbefe0883 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #include "env_validate.h" @@ -100,8 +103,8 @@ #define HEATER_1_PIN 8 #define HEATER_BED_PIN 10 -#ifndef FAN_PIN - #define FAN_PIN 7 +#ifndef FAN0_PIN + #define FAN0_PIN 7 #endif #define FAN1_PIN 6 diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h index 86aff16f920e..b3edfc5e17a7 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h @@ -23,6 +23,8 @@ /** * MegaTronics v3.0 / v3.1 / v3.2 pin assignments + * Schematic Origin: https://github.com/brupje/Megatronics_3/blob/master/Design%20Files/megatronics.sch + * ATmega2560 */ #include "env_validate.h" @@ -125,8 +127,8 @@ #define HEATER_2_PIN 8 #define HEATER_BED_PIN 10 -#ifndef FAN_PIN - #define FAN_PIN 6 +#ifndef FAN0_PIN + #define FAN0_PIN 6 #endif #define FAN1_PIN 7 diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index cff3a11af16f..0a1553c64ecf 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -23,6 +23,8 @@ /** * 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 * also works for Rev D boards. It's all rev E despite what the silk screen says */ @@ -144,39 +146,34 @@ //#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN // -// FET Pin Mapping - FET 1 is closest to the input power connector +// FET Pin Mapping - FET A is closest to the input power connector // -#define MOSFET_1_PIN 6 // Plug EX1 Pin 1-2 -> PH3 #15 -> Logical 06 -#define MOSFET_2_PIN 7 // Plug EX1 Pin 3-4 -> PH4 #16 -> Logical 07 -#define MOSFET_3_PIN 11 // Plug EX2 1-2 -> PB5 #24 -> Logical 11 -#define MOSFET_4_PIN 12 // Plug EX2 3-4 -> PB6 #25 -> Logical 12 -#define MOSFET_5_PIN 45 // Plug HBD 1-2 -> PL4 #39 -> Logical 45 -#define MOSFET_6_PIN 44 // Plug Extra 1-2 -> PL5 #40 -> Logical 44 (FET not soldered in all boards) +#define MOSFET_A_PIN 6 // Plug EX1 Pin 1-2 -> PH3 #15 -> Logical 06 +#define MOSFET_B_PIN 11 // Plug EX2 1-2 -> PB5 #24 -> Logical 11 +#define MOSFET_C_PIN 45 // Plug HBD 1-2 -> PL4 #39 -> Logical 45 +#define MOSFET_D_PIN 7 // Plug EX1 Pin 3-4 -> PH4 #16 -> Logical 07 +#define MOSFET_E_PIN 12 // Plug EX2 3-4 -> PB6 #25 -> Logical 12 +#define MOSFET_F_PIN 44 // Plug Extra 1-2 -> PL5 #40 -> Logical 44 (FET not soldered in all boards) // // Heaters / Fans (24V) // -#define HEATER_0_PIN MOSFET_1_PIN // EX1 -#define HEATER_1_PIN MOSFET_3_PIN // EX2 -#define HEATER_BED_PIN MOSFET_5_PIN // HBP +#define HEATER_0_PIN MOSFET_A_PIN // EX1 +#define HEATER_1_PIN MOSFET_B_PIN // EX2 +#define HEATER_BED_PIN MOSFET_C_PIN // HBP -// EX1 FAN (Automatic Fans are disabled by default in Configuration_adv.h - comment that out for auto fans) #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN MOSFET_2_PIN -#else - #ifndef FAN_PIN - #define FAN_PIN MOSFET_2_PIN - #endif + #define E0_AUTO_FAN_PIN MOSFET_D_PIN +#elif !defined(FAN0_PIN) + #define FAN0_PIN MOSFET_D_PIN #endif -// EX2 FAN (Automatic Fans are disabled by default in Configuration_adv.h - comment that out for auto fans) + #ifndef E1_AUTO_FAN_PIN - #define E1_AUTO_FAN_PIN MOSFET_4_PIN -#else - #ifndef FAN1_PIN - #define FAN1_PIN MOSFET_4_PIN - #endif + #define E1_AUTO_FAN_PIN MOSFET_E_PIN +#elif !defined(FAN1_PIN) + #define FAN1_PIN MOSFET_E_PIN #endif // diff --git a/Marlin/src/pins/mega/pins_MINITRONICS.h b/Marlin/src/pins/mega/pins_MINITRONICS.h index ec712a3b90e5..5145cb496d0b 100644 --- a/Marlin/src/pins/mega/pins_MINITRONICS.h +++ b/Marlin/src/pins/mega/pins_MINITRONICS.h @@ -23,6 +23,11 @@ /** * 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 + * ATmega1281 */ /** @@ -85,8 +90,8 @@ #define HEATER_1_PIN 8 // EXTRUDER 2 #define HEATER_BED_PIN 3 // BED -#ifndef FAN_PIN - #define FAN_PIN 9 +#ifndef FAN0_PIN + #define FAN0_PIN 9 #endif // diff --git a/Marlin/src/pins/mega/pins_OVERLORD.h b/Marlin/src/pins/mega/pins_OVERLORD.h index 49accf9f7c4c..3bccbbc7410e 100644 --- a/Marlin/src/pins/mega/pins_OVERLORD.h +++ b/Marlin/src/pins/mega/pins_OVERLORD.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -92,7 +95,7 @@ #define HEATER_1_PIN 3 #define HEATER_BED_PIN 4 -#define FAN_PIN 7 // material cooling fan +#define FAN0_PIN 7 // material cooling fan // // SD Card diff --git a/Marlin/src/pins/mega/pins_PICA.h b/Marlin/src/pins/mega/pins_PICA.h index 0e29d8dffe75..3926978e6d5e 100644 --- a/Marlin/src/pins/mega/pins_PICA.h +++ b/Marlin/src/pins/mega/pins_PICA.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 * * PICA is Power, Interface, and Control Adapter and is open source hardware. * See https://github.com/mjrice/PICA for schematics etc. @@ -105,8 +108,8 @@ #endif #define HEATER_BED_PIN 8 // HEAT-BED -#ifndef FAN_PIN - #define FAN_PIN 9 +#ifndef FAN0_PIN + #define FAN0_PIN 9 #endif #ifndef FAN_2_PIN #define FAN_2_PIN 7 diff --git a/Marlin/src/pins/mega/pins_PICAOLD.h b/Marlin/src/pins/mega/pins_PICAOLD.h index e19ea744e5eb..e15b4637b7f3 100644 --- a/Marlin/src/pins/mega/pins_PICAOLD.h +++ b/Marlin/src/pins/mega/pins_PICAOLD.h @@ -21,9 +21,13 @@ */ #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 +// ATmega2560 + #define HEATER_0_PIN 9 // E0 #define HEATER_1_PIN 10 // E1 -#define FAN_PIN 11 +#define FAN0_PIN 11 #define FAN2_PIN 12 #include "pins_PICA.h" 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 f2e4d3da0266..962fddc19248 100644 --- a/Marlin/src/pins/mega/pins_PROTONEER_CNC_SHIELD_V3.h +++ b/Marlin/src/pins/mega/pins_PROTONEER_CNC_SHIELD_V3.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 * * This CNC shield has an UNO pinout and fits all Arduino-compatibles. * @@ -51,16 +54,16 @@ #define Y_STEP_PIN 3 #define Y_DIR_PIN 6 -#define Y_ENABLE_PIN X_ENABLE_PIN +#define Y_ENABLE_PIN X_ENABLE_PIN #define Z_STEP_PIN 4 #define Z_DIR_PIN 7 -#define Z_ENABLE_PIN X_ENABLE_PIN +#define Z_ENABLE_PIN X_ENABLE_PIN // Designated with letter "A" on BOARD #define E0_STEP_PIN 12 #define E0_DIR_PIN 13 -#define E0_ENABLE_PIN X_ENABLE_PIN +#define E0_ENABLE_PIN X_ENABLE_PIN // // Temperature sensors - These could be any analog output not hidden by board diff --git a/Marlin/src/pins/mega/pins_SILVER_GATE.h b/Marlin/src/pins/mega/pins_SILVER_GATE.h index c2ca5b31038a..dd26a2714c3a 100644 --- a/Marlin/src/pins/mega/pins_SILVER_GATE.h +++ b/Marlin/src/pins/mega/pins_SILVER_GATE.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2561 + #if NOT_TARGET(__AVR_ATmega1281__, __AVR_ATmega2561__) #error "Oops! Select 'Silvergate' in 'Tools > Board.'" #endif @@ -55,8 +57,8 @@ #define FIL_RUNOUT_PIN 34 // X_MAX unless overridden #endif -#ifndef FAN_PIN - #define FAN_PIN 5 +#ifndef FAN0_PIN + #define FAN0_PIN 5 #endif #define HEATER_0_PIN 7 @@ -73,7 +75,7 @@ #define TEMP_BED_PIN 6 #if HAS_WIRED_LCD - #if IS_U8GLIB_ST7920 // SPI GLCD 12864 ST7920 + #if IS_U8GLIB_ST7920 // SPI GLCD 12864 ST7920 #define LCD_PINS_RS 30 #define LCD_PINS_ENABLE 20 #define LCD_PINS_D4 25 diff --git a/Marlin/src/pins/mega/pins_WANHAO_ONEPLUS.h b/Marlin/src/pins/mega/pins_WANHAO_ONEPLUS.h index 503dd9ec8148..e224e061787f 100644 --- a/Marlin/src/pins/mega/pins_WANHAO_ONEPLUS.h +++ b/Marlin/src/pins/mega/pins_WANHAO_ONEPLUS.h @@ -23,6 +23,7 @@ /** * Wanhao 0ne+ pin assignments + * ATmega2560 */ #include "env_validate.h" @@ -75,7 +76,7 @@ // #define HEATER_0_PIN 4 #define HEATER_BED_PIN 44 -#define FAN_PIN 12 // IO pin. Buffer needed +#define FAN0_PIN 12 // IO pin. Buffer needed // // SD Card diff --git a/Marlin/src/pins/mega/pins_WEEDO_62A.h b/Marlin/src/pins/mega/pins_WEEDO_62A.h index 4b3bf6a43bee..7b417c19a113 100644 --- a/Marlin/src/pins/mega/pins_WEEDO_62A.h +++ b/Marlin/src/pins/mega/pins_WEEDO_62A.h @@ -23,6 +23,7 @@ /** * Based on WEEDO 62A pin configuration * Copyright (c) 2019 WEEDO3D Perron + * ATmega2560 */ #pragma once @@ -73,7 +74,7 @@ // #define HEATER_0_PIN 10 // EXTRUDER 1 #define HEATER_BED_PIN 8 // BED -#define FAN_PIN 4 // IO pin. Buffer needed +#define FAN0_PIN 4 // IO pin. Buffer needed // // Misc. Functions diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 7826b7f271b8..70d5577f978b 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -530,7 +530,7 @@ #elif MB(MKS_ROBIN_E3D) #include "stm32f1/pins_MKS_ROBIN_E3D.h" // STM32F1 env:mks_robin_e3 #elif MB(MKS_ROBIN_E3D_V1_1) - #include "stm32f1/pins_MKS_ROBIN_E3D_V1_1.h" // STM32F1 env:mks_robin_e3 + #include "stm32f1/pins_MKS_ROBIN_E3D_V1_1.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple #elif MB(MKS_ROBIN_E3P) #include "stm32f1/pins_MKS_ROBIN_E3P.h" // STM32F1 env:mks_robin_e3p env:mks_robin_e3p_maple #elif MB(BTT_EBB42_V1_1) @@ -627,6 +627,10 @@ #include "stm32f1/pins_ERYONE_ERY32_MINI.h" // STM32F103VET6 env:ERYONE_ERY32_MINI_maple #elif MB(PANDA_PI_V29) #include "stm32f1/pins_PANDA_PI_V29.h" // STM32F103RCT6 env:PANDA_PI_V29 +#elif MB(SOVOL_V131) + #include "stm32f1/pins_SOVOL_V131.h" // GD32F1 env:GD32F103RET6_sovol_maple +#elif MB(TRIGORILLA_V006) + #include "gd32f1/pins_TRIGORILLA_V006.h" // GD32F103 env:trigorilla_v006 // // ARM Cortex-M4F @@ -666,11 +670,11 @@ #elif MB(BTT_SKR_V2_0_REV_B) #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug env:BIGTREE_SKR_2_F429 env:BIGTREE_SKR_2_F429_USB env:BIGTREE_SKR_2_F429_USB_debug #elif MB(BTT_OCTOPUS_V1_0) - #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB + #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB #elif MB(BTT_OCTOPUS_V1_1) - #include "stm32f4/pins_BTT_OCTOPUS_V1_1.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB env:BIGTREE_OCTOPUS_V1_F407 env:BIGTREE_OCTOPUS_V1_F407_USB + #include "stm32f4/pins_BTT_OCTOPUS_V1_1.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB env:STM32F429ZG_btt env:STM32F429ZG_btt_USB env:STM32F407ZE_btt env:STM32F407ZE_btt_USB #elif MB(BTT_OCTOPUS_PRO_V1_0) - #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB env:BIGTREE_OCTOPUS_PRO_V1_F429 env:BIGTREE_OCTOPUS_PRO_V1_F429_USB + #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB env:STM32F429ZG_btt env:STM32F429ZG_btt_USB env:STM32H723Zx_btt #elif MB(LERDGE_K) #include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:LERDGEK env:LERDGEK_usb_flash_drive #elif MB(LERDGE_S) @@ -741,9 +745,11 @@ #elif MB(BTT_SKR_SE_BX_V3) #include "stm32h7/pins_BTT_SKR_SE_BX_V3.h" // STM32H7 env:BTT_SKR_SE_BX #elif MB(BTT_SKR_V3_0) - #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H7 env:STM32H743Vx_btt + #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H7 env:STM32H723Vx_btt env:STM32H743Vx_btt #elif MB(BTT_SKR_V3_0_EZ) - #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H7 env:STM32H743Vx_btt + #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H7 env:STM32H723Vx_btt env:STM32H743Vx_btt +#elif MB(BTT_OCTOPUS_MAX_EZ_V1_0) + #include "stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h" // STM32H7 env:STM32H723Vx_btt env:STM32H723Zx_btt #elif MB(TEENSY41) #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 #elif MB(T41U5XBB) @@ -803,7 +809,7 @@ // Linux Native Debug board // -#elif MB(LINUX_RAMPS) +#elif MB(SIMULATED) #include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release #else @@ -839,6 +845,7 @@ #define BOARD_TH3D_EZBOARD_LITE_V2 99923 #define BOARD_BTT_SKR_SE_BX 99924 #define BOARD_MKS_MONSTER8 99925 + #define BOARD_LINUX_RAMPS 99926 #if MB(MKS_13) #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." @@ -894,6 +901,8 @@ #error "BOARD_BTT_SKR_SE_BX is now BOARD_BTT_SKR_SE_BX_V2 or BOARD_BTT_SKR_SE_BX_V3. Please update your configuration." #elif MB(MKS_MONSTER8) #error "BOARD_MKS_MONSTER8 is now BOARD_MKS_MONSTER8_V1 or BOARD_MKS_MONSTER8_V2. Please update your configuration." + #elif MB(LINUX_RAMPS) + #error "BOARD_LINUX_RAMPS is now BOARD_SIMULATED. Please update your configuration." #elif defined(MOTHERBOARD) #error "Unknown MOTHERBOARD value set in Configuration.h." #else @@ -927,6 +936,7 @@ #undef BOARD_TH3D_EZBOARD_LITE_V2 #undef BOARD_BTT_SKR_SE_BX #undef BOARD_MKS_MONSTER8 + #undef BOARD_LINUX_RAMPS #endif diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 39e07c739a23..16dd2a0c4569 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -489,18 +489,27 @@ REPORT_NAME_DIGITAL(__LINE__, EXP3_10_PIN) #endif -#if _EXISTS(TMC_SW_MISO) - REPORT_NAME_DIGITAL(__LINE__, TMC_SW_MISO) +#if _EXISTS(TMC_SPI_MISO) + REPORT_NAME_DIGITAL(__LINE__, TMC_SPI_MISO) #endif -#if _EXISTS(TMC_SW_MOSI) - REPORT_NAME_DIGITAL(__LINE__, TMC_SW_MOSI) +#if _EXISTS(TMC_SPI_MOSI) + REPORT_NAME_DIGITAL(__LINE__, TMC_SPI_MOSI) #endif -#if _EXISTS(TMC_SW_SCK) - REPORT_NAME_DIGITAL(__LINE__, TMC_SW_SCK) +#if _EXISTS(TMC_SPI_SCK) + REPORT_NAME_DIGITAL(__LINE__, TMC_SPI_SCK) #endif #if _EXISTS(TFTGLCD_CS) REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_CS) #endif +#if _EXISTS(TFTGLCD_SCK) + REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_SCK) +#endif +#if _EXISTS(TFTGLCD_MISO) + REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_MISO) +#endif +#if _EXISTS(TFTGLCD_MOSI) + REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_MOSI) +#endif // // E Multiplexing @@ -730,8 +739,8 @@ // // Fans // -#if PIN_EXISTS(FAN) - REPORT_NAME_DIGITAL(__LINE__, FAN_PIN) +#if PIN_EXISTS(FAN0) + REPORT_NAME_DIGITAL(__LINE__, FAN0_PIN) #endif #if PIN_EXISTS(FAN1) REPORT_NAME_DIGITAL(__LINE__, FAN1_PIN) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 5b5cbcd2147a..708eb7f8e6cf 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -377,10 +377,9 @@ #undef W_SERIAL_RX_PIN #endif -#ifndef FAN_PIN - #define FAN_PIN -1 +#ifndef FAN0_PIN + #define FAN0_PIN -1 #endif -#define FAN0_PIN FAN_PIN #ifndef FAN1_PIN #define FAN1_PIN -1 #endif @@ -487,6 +486,11 @@ #define NUM_SERVO_PLUGS 4 #endif +// Only used within pins files +#undef NEEDS_X_MINMAX +#undef NEEDS_Y_MINMAX +#undef NEEDS_Z_MINMAX + // // Assign endstop pins for boards with only 3 connectors // diff --git a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h index de9ecc5b4505..be1af14bb18d 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h @@ -23,6 +23,8 @@ /** * 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 */ #include "env_validate.h" @@ -126,11 +128,11 @@ #define HEATER_0_PIN 3 #define HEATER_BED_PIN 4 -#ifndef FAN_PIN +#ifndef FAN0_PIN #ifdef MK3_FAN_PINS - #define FAN_PIN 6 + #define FAN0_PIN 6 #else - #define FAN_PIN 8 + #define FAN0_PIN 8 #endif #endif diff --git a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h index 413eb8c98cc6..315a17ee0300 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h @@ -23,6 +23,10 @@ /** * 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 */ #include "env_validate.h" @@ -131,8 +135,8 @@ #define HEATER_0_PIN 3 #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 8 +#ifndef FAN0_PIN + #define FAN0_PIN 8 #endif #define FAN1_PIN 6 diff --git a/Marlin/src/pins/rambo/pins_MINIRAMBO.h b/Marlin/src/pins/rambo/pins_MINIRAMBO.h index 31d44f2b34ba..da55c1ec0711 100644 --- a/Marlin/src/pins/rambo/pins_MINIRAMBO.h +++ b/Marlin/src/pins/rambo/pins_MINIRAMBO.h @@ -23,6 +23,10 @@ /** * 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 */ #include "env_validate.h" @@ -105,8 +109,8 @@ #endif #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 8 +#ifndef FAN0_PIN + #define FAN0_PIN 8 #endif #define FAN1_PIN 6 diff --git a/Marlin/src/pins/rambo/pins_RAMBO.h b/Marlin/src/pins/rambo/pins_RAMBO.h index cb7a05913414..7c70c7c753d4 100644 --- a/Marlin/src/pins/rambo/pins_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_RAMBO.h @@ -39,6 +39,8 @@ /** * 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 */ #include "env_validate.h" @@ -138,8 +140,8 @@ #define HEATER_2_PIN 6 #define HEATER_BED_PIN 3 -#ifndef FAN_PIN - #define FAN_PIN 8 +#ifndef FAN0_PIN + #define FAN0_PIN 8 #endif #ifndef FAN1_PIN #define FAN1_PIN 6 diff --git a/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h b/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h index 533284a4bf5e..2230eaa35bc9 100644 --- a/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h +++ b/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h @@ -25,7 +25,7 @@ * Rambo pin assignments MODIFIED FOR Scoovo X9H ************************************************/ -#include "env_target.h" +#include "env_validate.h" #define BOARD_INFO_NAME "Scoovo X9H" @@ -105,8 +105,8 @@ #define HEATER_1_PIN 7 #define HEATER_BED_PIN 3 -#ifndef FAN_PIN - #define FAN_PIN 8 +#ifndef FAN0_PIN + #define FAN0_PIN 8 #endif #define FAN1_PIN 6 #define FAN2_PIN 2 diff --git a/Marlin/src/pins/ramps/pins_3DRAG.h b/Marlin/src/pins/ramps/pins_3DRAG.h index 1e9d53a6cb58..c14284865beb 100644 --- a/Marlin/src/pins/ramps/pins_3DRAG.h +++ b/Marlin/src/pins/ramps/pins_3DRAG.h @@ -23,6 +23,10 @@ /** * 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 + * ATmega2560, ATmega1280 */ #ifndef BOARD_INFO_NAME @@ -113,7 +117,7 @@ #define SPINDLE_LASER_PWM_PIN 46 // Hardware PWM #define SPINDLE_LASER_ENA_PIN 62 // Pullup! #define SPINDLE_DIR_PIN 48 - #elif !BOTH(HAS_WIRED_LCD, IS_NEWPANEL) // Use expansion header if no LCD in use + #elif !BOTH(HAS_WIRED_LCD, IS_NEWPANEL) // Use expansion header if no LCD in use #define SPINDLE_LASER_ENA_PIN 16 // Pullup or pulldown! #define SPINDLE_DIR_PIN 17 #if !NUM_SERVOS // Use servo connector if possible diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h index 31adea42709d..4d3722655df9 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #define REQUIRE_MEGA2560 diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h index 24266bb9d289..b0eee92c7218 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -53,8 +56,8 @@ #define Y_STOP_PIN 14 #define Z_STOP_PIN 18 -#ifndef FAN_PIN - #define FAN_PIN 6 +#ifndef FAN0_PIN + #define FAN0_PIN 6 #endif #if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) diff --git a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h index fa622ffb15dc..f3439aa6bbba 100644 --- a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h +++ b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560, ATmega1280 */ #if HOTENDS > 2 || E_STEPPERS > 2 diff --git a/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h b/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h index 58a62fb8bc74..aab66f0feacd 100644 --- a/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h +++ b/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h @@ -23,6 +23,7 @@ /** * KFB 2.0 – Arduino Mega2560 with RAMPS v1.4 pin assignments + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -34,7 +35,6 @@ // // Heaters / Fans // -// Power outputs BEEF or BEFF -#define MOSFET_D_PIN 7 +#define MOSFET_D_PIN 7 #include "pins_RAMPS.h" 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 4a54b85ae0bd..efedb8ffaf54 100644 --- a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -118,9 +121,10 @@ #include "pins_RAMPS_13.h" // ... RAMPS // -// Used by the Hephestos 2 heated bed upgrade kit +// Hephestos 2 heated bed upgrade kit uses pin 8 // #if ENABLED(HEPHESTOS2_HEATED_BED_KIT) #undef HEATER_BED_PIN #define HEATER_BED_PIN 8 + #define HEATER_BED_INVERTING true #endif diff --git a/Marlin/src/pins/ramps/pins_COPYMASTER_3D.h b/Marlin/src/pins/ramps/pins_COPYMASTER_3D.h index 020941027aaf..1285d0244c2e 100644 --- a/Marlin/src/pins/ramps/pins_COPYMASTER_3D.h +++ b/Marlin/src/pins/ramps/pins_COPYMASTER_3D.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2560 + #define BOARD_INFO_NAME "Copymaster 3D RAMPS" #define Z_STEP_PIN 47 diff --git a/Marlin/src/pins/ramps/pins_DAGOMA_F5.h b/Marlin/src/pins/ramps/pins_DAGOMA_F5.h index e1bd2ec4ed54..9760ccbef52a 100644 --- a/Marlin/src/pins/ramps/pins_DAGOMA_F5.h +++ b/Marlin/src/pins/ramps/pins_DAGOMA_F5.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2560 + #if HOTENDS > 2 || E_STEPPERS > 2 #error "Dagoma3D F5 supports up to 2 hotends / E steppers." #endif diff --git a/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h b/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h index 1a4b83f02dce..a147eba9fd35 100644 --- a/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h +++ b/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h @@ -23,6 +23,7 @@ /** * Wanhao Duplicator i3 Plus pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -71,7 +72,7 @@ #define HEATER_0_PIN 4 // PG5 / PWM4 #define HEATER_BED_PIN 3 // PE5 / PWM3 -#define FAN_PIN 5 // PE3 / PWM5 +#define FAN0_PIN 5 // PE3 / PWM5 // // Misc. Functions diff --git a/Marlin/src/pins/ramps/pins_FELIX2.h b/Marlin/src/pins/ramps/pins_FELIX2.h index 3e7849d71f23..f88923e0c9ad 100644 --- a/Marlin/src/pins/ramps/pins_FELIX2.h +++ b/Marlin/src/pins/ramps/pins_FELIX2.h @@ -23,6 +23,7 @@ /** * FELIXprinters v2.0/3.0 (RAMPS v1.4) pin assignments + * ATmega2560, ATmega1280 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -34,7 +35,6 @@ // // Heaters / Fans // -// Power outputs EFBF or EFBE #define MOSFET_D_PIN 7 #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h index a6791ff7c8b5..f9e4517a1183 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h @@ -23,6 +23,7 @@ /** * Formbot Raptor pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -128,8 +129,8 @@ #define HEATER_1_PIN 7 #define HEATER_BED_PIN 8 -#ifndef FAN_PIN - #define FAN_PIN 9 +#ifndef FAN0_PIN + #define FAN0_PIN 9 #endif #ifndef FIL_RUNOUT_PIN diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h index 4fb10bfd356b..d79eb8041cbe 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h @@ -23,12 +23,13 @@ /** * Formbot Raptor 2 pin assignments + * ATmega2560 */ #define BOARD_INFO_NAME "Formbot Raptor2" #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME -#define FAN_PIN 6 +#define FAN0_PIN 6 #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN 22 diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h index 17d3abc71f37..e671184a53a2 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h @@ -22,7 +22,8 @@ #pragma once /** - * Formbot pin assignments + * Formbot T-Rex 2+ pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -125,7 +126,7 @@ #define HEATER_1_PIN 7 #define HEATER_BED_PIN 58 -#define FAN_PIN 9 +#define FAN0_PIN 9 #if HAS_FILAMENT_SENSOR #define FIL_RUNOUT_PIN 4 diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h index e23a63994faa..3babc257b4c0 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h @@ -22,7 +22,8 @@ #pragma once /** - * Formbot pin assignments + * Formbot T-Rex 3 pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -131,7 +132,7 @@ #define HEATER_1_PIN 7 #define HEATER_BED_PIN 8 -#define FAN_PIN 9 +#define FAN0_PIN 9 #define FAN1_PIN 12 #define FIL_RUNOUT_PIN 22 diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index b8de260909b6..9cae3797c3f6 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -23,6 +23,9 @@ // // 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 +// ATmega2560 // #if NOT_TARGET(__AVR_ATmega2560__) @@ -182,7 +185,7 @@ #define HEATER_2_PIN 7 #define HEATER_BED_PIN 8 -#define FAN_PIN 44 +#define FAN0_PIN 44 #define FAN1_PIN 45 #define FAN2_PIN 46 diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h index 1fc24154b733..9604d0ecbfc1 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h @@ -23,6 +23,9 @@ // // 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 +// ATmega2560 // #define BOARD_INFO_NAME "FYSETC F6 1.4" diff --git a/Marlin/src/pins/ramps/pins_K8200.h b/Marlin/src/pins/ramps/pins_K8200.h index 395e1ccca50e..d2557b26c3ee 100644 --- a/Marlin/src/pins/ramps/pins_K8200.h +++ b/Marlin/src/pins/ramps/pins_K8200.h @@ -24,6 +24,9 @@ /** * 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 + * ATmega2560 */ #define BOARD_INFO_NAME "Velleman K8200" diff --git a/Marlin/src/pins/ramps/pins_K8400.h b/Marlin/src/pins/ramps/pins_K8400.h index 22ac1be8abc9..56ec66191b32 100644 --- a/Marlin/src/pins/ramps/pins_K8400.h +++ b/Marlin/src/pins/ramps/pins_K8400.h @@ -24,6 +24,9 @@ /** * 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 + * ATmega2560, ATmega1280 * * K8400 has some minor differences over a normal 3Drag: * - No X/Y max endstops diff --git a/Marlin/src/pins/ramps/pins_K8600.h b/Marlin/src/pins/ramps/pins_K8600.h index e4468a609882..2ffa8c6b101f 100644 --- a/Marlin/src/pins/ramps/pins_K8600.h +++ b/Marlin/src/pins/ramps/pins_K8600.h @@ -23,6 +23,7 @@ /** * VERTEX NANO Arduino Mega with RAMPS EFB v1.4 pin assignments. + * ATmega2560, ATmega1280 */ #if HAS_MULTI_HOTEND @@ -48,7 +49,7 @@ // Heaters / Fans // #define HEATER_BED_PIN -1 -#define FAN_PIN 8 +#define FAN0_PIN 8 // // Misc. Functions diff --git a/Marlin/src/pins/ramps/pins_K8800.h b/Marlin/src/pins/ramps/pins_K8800.h index 17bb59fdc9d0..6c4fa1cc7ca1 100644 --- a/Marlin/src/pins/ramps/pins_K8800.h +++ b/Marlin/src/pins/ramps/pins_K8800.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560, ATmega1280 */ #include "env_validate.h" @@ -71,7 +74,7 @@ // Heaters / Fans // #define HEATER_0_PIN 10 -#define FAN_PIN 8 +#define FAN0_PIN 8 #define CONTROLLER_FAN_PIN 9 // diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index 51f9cd80381c..d9759153c334 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -23,6 +23,7 @@ /** * Longer3D LK1/LK4/LK5 Pro board pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 diff --git a/Marlin/src/pins/ramps/pins_MAKEBOARD_MINI.h b/Marlin/src/pins/ramps/pins_MAKEBOARD_MINI.h index a42dba874f41..2ab463d681af 100644 --- a/Marlin/src/pins/ramps/pins_MAKEBOARD_MINI.h +++ b/Marlin/src/pins/ramps/pins_MAKEBOARD_MINI.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2560 + #define BOARD_INFO_NAME "MAKEboard Mini" // diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h index 64efa46c0550..8d46ac36fa6e 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h @@ -23,6 +23,12 @@ /** * 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 + * 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_14.h b/Marlin/src/pins/ramps/pins_MKS_BASE_14.h index 7e2a722cf222..9877877ffdfa 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_14.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_14.h @@ -23,6 +23,7 @@ /** * MKS BASE v1.4 with A4982 stepper drivers and digital micro-stepping + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -32,11 +33,6 @@ #define BOARD_INFO_NAME "MKS BASE 1.4" #define MKS_BASE_VERSION 14 -// -// Heaters / Fans -// -#define FAN_PIN 9 // PH6 ** Pin18 ** PWM9 - // Other Mods #define SERVO3_PIN 12 // PB6 ** Pin25 ** D12 diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_15.h b/Marlin/src/pins/ramps/pins_MKS_BASE_15.h index 5fedd3f97c8a..1d93ec5cf9bf 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_15.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_15.h @@ -23,6 +23,7 @@ /** * MKS BASE v1.5 with A4982 stepper drivers and digital micro-stepping + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h index 63e0b51d3cc5..765a601fd029 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h b/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h index 973f924e7c16..c50f28a40734 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h @@ -23,6 +23,7 @@ /** * MKS BASE with Heroic HR4982 stepper drivers + * ATmega2560 */ #include "pins_MKS_BASE_15.h" // ... MKS_BASE_common ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_common.h b/Marlin/src/pins/ramps/pins_MKS_BASE_common.h index 9047a4bcf0e6..b0f0866bc66a 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_common.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_common.h @@ -23,6 +23,7 @@ /** * MKS BASE – Arduino Mega2560 with RAMPS pin assignments + * ATmega2560 */ #ifndef BOARD_INFO_NAME @@ -33,8 +34,8 @@ // // Heaters / Fans // - // Power outputs EFBF or EFBE - #define MOSFET_D_PIN 7 + #define MOSFET_B_PIN 7 + #define FAN0_PIN 9 // // M3/M4/M5 - Spindle/Laser Control @@ -49,12 +50,9 @@ #define CASE_LIGHT_PIN 2 #endif -#endif - -// -// Microstepping pins -// -#if MKS_BASE_VERSION >= 14 // |===== 1.4 =====|===== 1.5+ =====| + // + // Microstepping pins + // |===== 1.4 =====|===== 1.5+ =====| #define X_MS1_PIN 5 // PE3 | Pin 5 | PWM5 | | D3 | SERVO2_PIN #define X_MS2_PIN 6 // PH3 | Pin 15 | PWM6 | Pin 14 | D6 | SERVO1_PIN #define Y_MS1_PIN 59 // PF5 | Pin 92 | A5 | | | diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h index 1e354a10dcf2..4cf66ed2cd41 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560, ATmega1280 * * MKS GEN v1.3 (Extruder, Fan, Bed) * MKS GEN v1.3 (Extruder, Extruder, Fan, Bed) @@ -39,10 +42,8 @@ // // Heaters / Fans // -// Power outputs EFBF or EFBE -// #define MOSFET_B_PIN 7 -#define FAN_PIN 9 +#define FAN0_PIN 9 // // PSU / SERVO diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h index ca1f1338164e..5d1136e4ef1a 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560, ATmega1280 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -34,14 +37,11 @@ // // Heaters / Fans // -// Power outputs EFBF or EFBE -#define MOSFET_D_PIN 7 -// Hotend, Hotend, Bed + Fan on D9 -#if FET_ORDER_EEB - #define MOSFET_B_PIN 7 - #define FAN_PIN 9 -#endif +#define MOSFET_A_PIN 9 // HE0 +#define MOSFET_B_PIN 8 // HE1 +#define MOSFET_C_PIN 10 // HBED +#define FAN0_PIN 7 // // CS Pins wired to avoid conflict with the LCD @@ -49,11 +49,11 @@ // #ifndef X_CS_PIN - #define X_CS_PIN 59 + #define X_CS_PIN 59 #endif #ifndef Y_CS_PIN - #define Y_CS_PIN 63 + #define Y_CS_PIN 63 #endif #include "pins_RAMPS.h" 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 0378b166a2d4..931843de7c73 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -34,8 +37,8 @@ // // Heaters / Fans // -// Power outputs EFBF or EFBE -#define MOSFET_D_PIN 7 +#define MOSFET_B_PIN 7 +#define FAN0_PIN 9 // // CS Pins wired to avoid conflict with the LCD 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 d508cb453f4d..6cea92c15b78 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -34,8 +37,8 @@ // // Heaters / Fans // -// Power outputs EFBF or EFBE -#define MOSFET_D_PIN 7 +#define MOSFET_B_PIN 7 +#define FAN0_PIN 9 // // CS Pins wired to avoid conflict with the LCD diff --git a/Marlin/src/pins/ramps/pins_ORTUR_4.h b/Marlin/src/pins/ramps/pins_ORTUR_4.h index e47bae191520..7f0fe93084b7 100644 --- a/Marlin/src/pins/ramps/pins_ORTUR_4.h +++ b/Marlin/src/pins/ramps/pins_ORTUR_4.h @@ -23,6 +23,7 @@ /** * Ortur 4 Arduino Mega based on RAMPS v1.4 pin assignments + * ATmega2560 */ #define BOARD_INFO_NAME "Ortur 4.3" diff --git a/Marlin/src/pins/ramps/pins_PXMALION_CORE_I3.h b/Marlin/src/pins/ramps/pins_PXMALION_CORE_I3.h index 12c40c7dca03..ee0633992e60 100644 --- a/Marlin/src/pins/ramps/pins_PXMALION_CORE_I3.h +++ b/Marlin/src/pins/ramps/pins_PXMALION_CORE_I3.h @@ -22,6 +22,7 @@ /** * Pxmalion Core i3 - https://github.com/Pxmalion + * ATmega2560 */ #include "env_validate.h" diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 4e4ca6058389..58b9b786487e 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -23,6 +23,7 @@ /** * Arduino Mega with RAMPS v1.4 (or v1.3) pin assignments + * ATmega2560, ATmega1280 * * Applies to the following boards: * @@ -256,15 +257,15 @@ #endif #endif -#ifndef FAN_PIN +#ifndef FAN0_PIN #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN MOSFET_C_PIN + #define FAN0_PIN MOSFET_C_PIN #elif FET_ORDER_EEB // Hotend, Hotend, Bed - #define FAN_PIN 4 // IO pin. Buffer needed + #define FAN0_PIN 4 // IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN MOSFET_B_PIN + #define FAN0_PIN MOSFET_B_PIN #endif #endif @@ -319,16 +320,14 @@ // // TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 66 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 44 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 64 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI 66 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO 44 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK 64 #endif #if HAS_TMC_UART @@ -877,7 +876,7 @@ #define BEEPER_PIN EXP2_05_PIN - #if ENABLED(PANEL_ONE) // Buttons connect directly to AUX-2 + #if ENABLED(PANEL_ONE) // Buttons connect directly to AUX-2 #define BTN_EN1 AUX2_03_PIN #define BTN_EN2 AUX2_04_PIN #define BTN_ENC AUX3_02_PIN diff --git a/Marlin/src/pins/ramps/pins_RAMPS_13.h b/Marlin/src/pins/ramps/pins_RAMPS_13.h index 6e7c8cbab592..026492e4a871 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_13.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_13.h @@ -23,6 +23,7 @@ /** * Arduino Mega with RAMPS v1.3 pin assignments + * ATmega2560, ATmega1280 * * Applies to the following boards: * diff --git a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h index 3d5f5d6f9107..8c65b2e0b41d 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2560 + #if HOTENDS > 2 || E_STEPPERS > 2 #error "Creality RAMPS supports up to 2 hotends / E steppers." #endif @@ -30,8 +32,8 @@ // // Heaters / Fans // -#define MOSFET_B_PIN 7 // For HEATER_1_PIN ("EEF" or "EEB") -#define FAN_PIN 9 +#define MOSFET_B_PIN 7 +#define FAN0_PIN 9 #define FIL_RUNOUT_PIN 2 #if NUM_RUNOUT_SENSORS >= 2 diff --git a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h index 8f9148b732ee..ece072b50953 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2560 + #if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Ender-4 only supports 1 hotend / E stepper." #endif @@ -34,7 +36,7 @@ // band (case light). Thus the hotend and controller fans are always-on. #if ENABLED(CASE_LIGHT_ENABLE) - #undef FAN_PIN + #undef FAN0_PIN #ifndef CASE_LIGHT_PIN #define CASE_LIGHT_PIN MOSFET_B_PIN #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_OLD.h b/Marlin/src/pins/ramps/pins_RAMPS_OLD.h index 974766623594..663c6e47921b 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_OLD.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_OLD.h @@ -23,6 +23,7 @@ /** * Arduino Mega with RAMPS v1.0, v1.1, v1.2 pin assignments + * ATmega2560, ATmega1280 */ #include "env_validate.h" @@ -87,14 +88,14 @@ #if ENABLED(RAMPS_V_1_0) #define HEATER_0_PIN 12 #define HEATER_BED_PIN -1 - #ifndef FAN_PIN - #define FAN_PIN 11 + #ifndef FAN0_PIN + #define FAN0_PIN 11 #endif #else // RAMPS_V_1_1 or RAMPS_V_1_2 #define HEATER_0_PIN 10 #define HEATER_BED_PIN 8 - #ifndef FAN_PIN - #define FAN_PIN 9 + #ifndef FAN0_PIN + #define FAN0_PIN 9 #endif #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h b/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h index 8ccb14c866db..f93c6919d960 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h @@ -23,6 +23,7 @@ /** * Arduino Mega with RAMPS v1.4Plus, also known as 3DYMY version, pin assignments + * ATmega2560, ATmega1280 * * Applies to the following boards: * diff --git a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h index f41573b527cd..bb1e2764169d 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h @@ -24,6 +24,7 @@ /** * Arduino Mega with RAMPS-S v1.2 by Sakul.cz pin assignments * Written by Michal Rábek + * ATmega2560 * * Applies to the following boards: * @@ -171,12 +172,12 @@ #if MB(RAMPS_S_12_EEFB) // Hotend0, Hotend1, Fan, Bed #define HEATER_1_PIN RAMPS_S_HE_1 - #define FAN_PIN RAMPS_S_HE_2 + #define FAN0_PIN RAMPS_S_HE_2 #elif MB(RAMPS_S_12_EEEB) // Hotend0, Hotend1, Hotend2, Bed #define HEATER_1_PIN RAMPS_S_HE_1 #define HEATER_2_PIN RAMPS_S_HE_2 #elif MB(RAMPS_S_12_EFFB) // Hotend, Fan0, Fan1, Bed - #define FAN_PIN RAMPS_S_HE_1 + #define FAN0_PIN RAMPS_S_HE_1 #define FAN1_PIN RAMPS_S_HE_2 #endif @@ -218,16 +219,14 @@ // // TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 51 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 50 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 53 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI 51 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO 50 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK 53 #endif // diff --git a/Marlin/src/pins/ramps/pins_RIGIDBOARD.h b/Marlin/src/pins/ramps/pins_RIGIDBOARD.h index 273e0274a8e7..8eab6c7d9b4f 100644 --- a/Marlin/src/pins/ramps/pins_RIGIDBOARD.h +++ b/Marlin/src/pins/ramps/pins_RIGIDBOARD.h @@ -23,6 +23,7 @@ /** * RIGIDBOARD Arduino Mega with RAMPS v1.4 pin assignments + * ATmega2560, ATmega1280 */ #ifndef BOARD_INFO_NAME @@ -83,8 +84,8 @@ #undef HEATER_BED_PIN #define HEATER_BED_PIN 10 -#ifndef FAN_PIN - #define FAN_PIN 8 // Same as RAMPS_13_EEF +#ifndef FAN0_PIN + #define FAN0_PIN 8 // Same as RAMPS_13_EEF #endif // diff --git a/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h b/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h index 8242f1a77294..dc27378a15bc 100644 --- a/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h +++ b/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h @@ -23,6 +23,7 @@ /** * RIGIDBOARD V2 Arduino Mega with RAMPS v1.4 pin assignments + * ATmega2560, ATmega1280 */ #define BOARD_INFO_NAME "RigidBoard V2" diff --git a/Marlin/src/pins/ramps/pins_RL200.h b/Marlin/src/pins/ramps/pins_RL200.h index 00fb39a43901..219a3a525d02 100644 --- a/Marlin/src/pins/ramps/pins_RL200.h +++ b/Marlin/src/pins/ramps/pins_RL200.h @@ -24,6 +24,7 @@ /** * Rapide Lite 200 v1 (RUMBA clone) pin assignments. Has slightly different assignment for * extruder motors due to dual Z motors. Pinout therefore based on pins_RUMBA.h. + * ATmega2560 */ #define BOARD_INFO_NAME "RL200" diff --git a/Marlin/src/pins/ramps/pins_RUMBA.h b/Marlin/src/pins/ramps/pins_RUMBA.h index eb049c48dd99..3c6873e7653b 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA.h +++ b/Marlin/src/pins/ramps/pins_RUMBA.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -156,8 +159,8 @@ #define HEATER_3_PIN 8 #define HEATER_BED_PIN 9 -#ifndef FAN_PIN - #define FAN_PIN 7 +#ifndef FAN0_PIN + #define FAN0_PIN 7 #endif #ifndef FAN1_PIN #define FAN1_PIN 8 diff --git a/Marlin/src/pins/ramps/pins_RUMBA_RAISE3D.h b/Marlin/src/pins/ramps/pins_RUMBA_RAISE3D.h index 39942613ffbf..57ee32ab2969 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA_RAISE3D.h +++ b/Marlin/src/pins/ramps/pins_RUMBA_RAISE3D.h @@ -21,6 +21,8 @@ */ #pragma once +// ATmega2560 + #define BOARD_INFO_NAME "Raise3D Rumba" #define DEFAULT_MACHINE_NAME "Raise3D N Series" diff --git a/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h b/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h index d25029a7a39c..6354cc7618e1 100644 --- a/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h +++ b/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h @@ -23,13 +23,14 @@ /** * Sainsmart 2-in-1 pin assignments + * ATmega2560, ATmega1280 */ #if HOTENDS > 2 || E_STEPPERS > 2 #error "Sainsmart 2-in-1 supports up to 2 hotends / E steppers." #endif -#define BOARD_INFO_NAME "Sainsmart" +#define BOARD_INFO_NAME "Sainsmart 2-in-1" // // Heaters / Fans diff --git a/Marlin/src/pins/ramps/pins_TANGO.h b/Marlin/src/pins/ramps/pins_TANGO.h index 451d2f874d7f..54dd4433998f 100644 --- a/Marlin/src/pins/ramps/pins_TANGO.h +++ b/Marlin/src/pins/ramps/pins_TANGO.h @@ -23,11 +23,14 @@ /** * 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 + * ATmega2560 */ #define BOARD_INFO_NAME "Tango" -#define FAN_PIN 8 +#define FAN0_PIN 8 #define FAN1_PIN -1 #ifndef E0_AUTO_FAN_PIN diff --git a/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h b/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h index b11487b21d36..a00720b576df 100644 --- a/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h +++ b/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h @@ -22,7 +22,8 @@ #pragma once /** - * Tenlog pin assignments + * Tenlog D3 Hero pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -137,7 +138,7 @@ #define HEATER_1_PIN 11 #define HEATER_BED_PIN 8 -#define FAN_PIN 9 +#define FAN0_PIN 9 #define FAN1_PIN 5 // Normally this would be a servo pin // XXX Runout support unknown? diff --git a/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h b/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h index b3f7d5f216b5..0cf6e3b18b3f 100644 --- a/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h +++ b/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h @@ -22,7 +22,8 @@ #pragma once /** - * Tenlog pin assignments + * Tenlog MB1 V2.3 pin assignments + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -94,7 +95,7 @@ #define HEATER_1_PIN 10 #define HEATER_BED_PIN 8 -#define FAN_PIN 9 +#define FAN0_PIN 9 #define FAN2_PIN 5 // Normally this would be a servo pin //#define NUM_RUNOUT_SENSORS 0 diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h index 71dfb8c70441..83dac111cbbe 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h @@ -23,21 +23,22 @@ /** * Arduino Mega with RAMPS v1.3 for Anycubic + * ATmega2560 */ #define BOARD_INFO_NAME "Anycubic RAMPS 1.3" -#define MOSFET_B_PIN 44 +#define MOSFET_B_PIN 44 -#define E1_STEP_PIN -1 -#define E1_DIR_PIN -1 -#define E1_ENABLE_PIN -1 -#define E1_CS_PIN -1 +#define E1_STEP_PIN -1 +#define E1_DIR_PIN -1 +#define E1_ENABLE_PIN -1 +#define E1_CS_PIN -1 -#define FAN2_PIN 9 +#define FAN2_PIN 9 #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN 9 + #define E0_AUTO_FAN_PIN 9 #endif #include "pins_RAMPS_13.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index 96c3fced4cc1..0e6e8ee41dec 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -23,6 +23,7 @@ /** * Arduino Mega with RAMPS v1.4 for Anycubic + * ATmega2560 */ #define BOARD_INFO_NAME "Anycubic RAMPS 1.4" @@ -45,7 +46,7 @@ // // Heaters / Fans // -#define FAN_PIN 9 // FAN0 +#define FAN0_PIN 9 // FAN0 #define FAN1_PIN 7 // FAN1 #define FAN2_PIN 44 // FAN2 #ifndef E0_AUTO_FAN_PIN diff --git a/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h b/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h index 04c6af67b002..0104dadf7ff2 100644 --- a/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h +++ b/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h @@ -23,6 +23,7 @@ /** * Arduino Mega for Tronxy X5S-2E, etc. + * ATmega2560 */ #define REQUIRE_MEGA2560 diff --git a/Marlin/src/pins/ramps/pins_TT_OSCAR.h b/Marlin/src/pins/ramps/pins_TT_OSCAR.h index f81cc6039aed..5150ad55b637 100644 --- a/Marlin/src/pins/ramps/pins_TT_OSCAR.h +++ b/Marlin/src/pins/ramps/pins_TT_OSCAR.h @@ -21,10 +21,12 @@ */ #pragma once +// ATmega2560 + #include "env_validate.h" #if HOTENDS > 5 || E_STEPPERS > 5 - #error "TTOSCAR supports up to 5 hotends / E steppers." + #error "TT OSCAR supports up to 5 hotends / E steppers." #endif #define BOARD_INFO_NAME "TT OSCAR" @@ -150,16 +152,14 @@ // // Default pins for TMC software SPI // -//#if ENABLED(TMC_USE_SW_SPI) -// #ifndef TMC_SW_MOSI -// #define TMC_SW_MOSI 66 -// #endif -// #ifndef TMC_SW_MISO -// #define TMC_SW_MISO 44 -// #endif -// #ifndef TMC_SW_SCK -// #define TMC_SW_SCK 64 -// #endif +//#ifndef TMC_SPI_MOSI +// #define TMC_SPI_MOSI 66 +//#endif +//#ifndef TMC_SPI_MISO +// #define TMC_SPI_MISO 44 +//#endif +//#ifndef TMC_SPI_SCK +// #define TMC_SPI_SCK 64 //#endif // @@ -192,7 +192,7 @@ #define HEATER_2_PIN 44 #define HEATER_BED_PIN 8 -#define FAN_PIN 9 +#define FAN0_PIN 9 #if EXTRUDERS >= 5 #define HEATER_4_PIN 6 diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index 0b15cd35ade9..16400be05966 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -23,6 +23,25 @@ /** * 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 + * - https://github.com/Ultimaker/Ultimaker2/blob/master/1546%20ultimainboard%20V2.1.4/schema3.SchDoc + * - 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 + * ATmega2560 */ /** @@ -93,8 +112,8 @@ #define HEATER_1_PIN 3 #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 7 +#ifndef FAN0_PIN + #define FAN0_PIN 7 #endif #ifndef E0_AUTO_FAN_PIN diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER.h b/Marlin/src/pins/ramps/pins_ULTIMAKER.h index 0bc04d962aaf..c29318c37291 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER.h @@ -23,6 +23,7 @@ /** * Ultimaker pin assignments + * ATmega2560, ATmega1280 */ /** @@ -98,8 +99,8 @@ #define HEATER_1_PIN 3 #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 7 +#ifndef FAN0_PIN + #define FAN0_PIN 7 #endif // diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h index 146c519ff962..25cc278adab8 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h @@ -23,6 +23,9 @@ /** * 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_VORON.h b/Marlin/src/pins/ramps/pins_VORON.h index 93903810104f..4aee2ab1424a 100644 --- a/Marlin/src/pins/ramps/pins_VORON.h +++ b/Marlin/src/pins/ramps/pins_VORON.h @@ -24,19 +24,16 @@ /** * VORON Design v2 pin assignments * See https://github.com/mzbotreprap/VORON/blob/master/Firmware/Marlin/pins_RAMPS_VORON.h + * ATmega2560 */ #define BOARD_INFO_NAME "VORON Design v2" -#define MOSFET_C_PIN 11 - -#include "pins_RAMPS.h" - // // Heaters / Fans // -#undef FAN_PIN -#define FAN_PIN 5 // Using the pin for the controller fan since controller fan is always on. +#define MOSFET_C_PIN 11 +#define FAN0_PIN 5 // Using the pin for the controller fan since controller fan is always on. #define CONTROLLER_FAN_PIN 8 // @@ -49,6 +46,8 @@ #define E1_AUTO_FAN_PIN 6 // Servo pin 6 for E3D Fan (same pin for both extruders since it's the same fan) #endif +#include "pins_RAMPS.h" + // // LCDs and Controllers // diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V20.h b/Marlin/src/pins/ramps/pins_ZRIB_V20.h index 3e236e36ba99..127fffa7944b 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V20.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V20.h @@ -22,8 +22,13 @@ #pragma once /** - * ZRIB V2.0 & V3.0 pin assignments + * 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 + * ATmega2560, ATmega1280 */ #ifndef FILWIDTH_PIN diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V52.h b/Marlin/src/pins/ramps/pins_ZRIB_V52.h index 44e0beaa9fb9..5eada31c9cf9 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V52.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V52.h @@ -22,7 +22,10 @@ #pragma once /** - * ZRIB V5.2 Based on MKS BASE v1.4 with A4982 stepper drivers and digital micro-stepping + * 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 + * ATmega2560, ATmega1280 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -36,8 +39,6 @@ // // Heaters / Fans // -#define HEATER_1_PIN 7 -#define FAN_PIN 9 // PH6 ** Pin18 ** PWM9 #define FAN1_PIN 6 // diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V53.h b/Marlin/src/pins/ramps/pins_ZRIB_V53.h index 7a5cf1479166..74188190fe5a 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V53.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V53.h @@ -22,7 +22,8 @@ #pragma once /** - * ZRIB V5.3 Based on MKS BASE v1.4 with A4982 stepper drivers and digital micro-stepping + * ZONESTAR ZRIB V5.3 Based on MKS BASE v1.4 with A4982 stepper drivers and digital micro-stepping + * ATmega2560, ATmega1280 */ #include "env_validate.h" @@ -163,7 +164,7 @@ #define HEATER_0_PIN 10 #define HEATER_1_PIN 7 -#define FAN_PIN 9 +#define FAN0_PIN 9 #define HEATER_BED_PIN 8 #define FAN1_PIN 6 diff --git a/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h b/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h index b68e3edb4567..e4603591d12a 100644 --- a/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h +++ b/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h @@ -23,6 +23,7 @@ /** * Z-Bolt X Series board – based on Arduino Mega2560 + * ATmega2560 */ #define REQUIRE_MEGA2560 @@ -135,7 +136,7 @@ #define HEATER_3_PIN 5 #define HEATER_BED_PIN 8 -#define FAN_PIN 9 +#define FAN0_PIN 9 // // Misc. Functions @@ -182,16 +183,14 @@ // // TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 66 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 44 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 64 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI 66 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO 44 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK 64 #endif #if HAS_TMC_UART diff --git a/Marlin/src/pins/sam/pins_ADSK.h b/Marlin/src/pins/sam/pins_ADSK.h index 425d6d45afb3..7e47f122f61d 100644 --- a/Marlin/src/pins/sam/pins_ADSK.h +++ b/Marlin/src/pins/sam/pins_ADSK.h @@ -116,7 +116,7 @@ A stepper for E0 extruder // #define HEATER_0_PIN 55 // "Hold": Analog pin 1, Digital pin 55 #define HEATER_BED_PIN 57 // "CoolEn": Analog pin 3, Digital pin 57 -#define FAN_PIN 54 // "Abort": Analog pin 0, Digital pin 54 +#define FAN0_PIN 54 // "Abort": Analog pin 0, Digital pin 54 #undef E0_AUTO_FAN_PIN #define E0_AUTO_FAN_PIN 56 // "Resume": Analog pin 2, Digital pin 56 diff --git a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h index 76431937a712..bdbea60150d9 100644 --- a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h @@ -113,8 +113,8 @@ #define HEATER_3_PIN 97 // PC20 on piggy #define HEATER_BED_PIN 69 // PA0 -#ifndef FAN_PIN - #define FAN_PIN 92 // PA5 +#ifndef FAN0_PIN + #define FAN0_PIN 92 // PA5 #endif #define FAN1_PIN 31 // PA7 diff --git a/Marlin/src/pins/sam/pins_ARCHIM1.h b/Marlin/src/pins/sam/pins_ARCHIM1.h index d9f1dcbf9427..e01b93a01852 100644 --- a/Marlin/src/pins/sam/pins_ARCHIM1.h +++ b/Marlin/src/pins/sam/pins_ARCHIM1.h @@ -153,8 +153,8 @@ #define HEATER_2_PIN 8 // D8 PC22 FET_PWM5 #define HEATER_BED_PIN 9 // D9 PC21 BED_PWM -#ifndef FAN_PIN - #define FAN_PIN 4 // D4 PC26 FET_PWM1 +#ifndef FAN0_PIN + #define FAN0_PIN 4 // D4 PC26 FET_PWM1 #endif #define FAN1_PIN 5 // D5 PC25 FET_PWM2 diff --git a/Marlin/src/pins/sam/pins_ARCHIM2.h b/Marlin/src/pins/sam/pins_ARCHIM2.h index 310dd8e2ac27..de06a72809b7 100644 --- a/Marlin/src/pins/sam/pins_ARCHIM2.h +++ b/Marlin/src/pins/sam/pins_ARCHIM2.h @@ -145,19 +145,17 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers. +// SPI pins for TMC2130 stepper drivers. // Required for the Archim2 board. // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 28 // PD3 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 26 // PD1 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 27 // PD2 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI 28 // PD3 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO 26 // PD1 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK 27 // PD2 #endif // @@ -176,8 +174,8 @@ #define HEATER_2_PIN 8 // D8 PC22 FET_PWM5 #define HEATER_BED_PIN 9 // D9 PC21 BED_PWM -#ifndef FAN_PIN - #define FAN_PIN 4 // D4 PC26 FET_PWM1 +#ifndef FAN0_PIN + #define FAN0_PIN 4 // D4 PC26 FET_PWM1 #endif #define FAN1_PIN 5 // D5 PC25 FET_PWM2 diff --git a/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h b/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h index d44f6490da63..3d15f37e47fa 100644 --- a/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h +++ b/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h @@ -91,7 +91,7 @@ // // Fans // -//#define FAN_PIN 8 +//#define FAN0_PIN 8 // // Auto fans diff --git a/Marlin/src/pins/sam/pins_DUE3DOM.h b/Marlin/src/pins/sam/pins_DUE3DOM.h index 81eca3e4b14a..5d47f28abae7 100644 --- a/Marlin/src/pins/sam/pins_DUE3DOM.h +++ b/Marlin/src/pins/sam/pins_DUE3DOM.h @@ -96,8 +96,8 @@ #define HEATER_1_PIN 8 // HOTEND1 MOSFET #define HEATER_BED_PIN 39 // BED MOSFET -#ifndef FAN_PIN - #define FAN_PIN 11 // FAN1 header on board - PRINT FAN +#ifndef FAN0_PIN + #define FAN0_PIN 11 // FAN1 header on board - PRINT FAN #endif #define FAN1_PIN 9 // FAN2 header on board - CONTROLLER FAN #define FAN2_PIN 12 // FAN3 header on board - EXTRUDER0 FAN diff --git a/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h b/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h index 7754fa9329f9..9d56d3626457 100644 --- a/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h +++ b/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h @@ -84,8 +84,8 @@ #define HEATER_0_PIN 13 // HOTEND0 MOSFET #define HEATER_BED_PIN 7 // BED MOSFET -#ifndef FAN_PIN - #define FAN_PIN 11 // FAN1 header on board - PRINT FAN +#ifndef FAN0_PIN + #define FAN0_PIN 11 // FAN1 header on board - PRINT FAN #endif #define FAN1_PIN 12 // FAN2 header on board - CONTROLLER FAN #define FAN2_PIN 9 // FAN3 header on board - EXTRUDER0 FAN diff --git a/Marlin/src/pins/sam/pins_KRATOS32.h b/Marlin/src/pins/sam/pins_KRATOS32.h index f7867f9b2607..97449c2d83ae 100644 --- a/Marlin/src/pins/sam/pins_KRATOS32.h +++ b/Marlin/src/pins/sam/pins_KRATOS32.h @@ -126,8 +126,8 @@ #define HEATER_3_PIN 10 #define HEATER_BED_PIN 7 // BED -#ifndef FAN_PIN - #define FAN_PIN 9 +#ifndef FAN0_PIN + #define FAN0_PIN 9 #endif #define FAN1_PIN 8 diff --git a/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h b/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h index aa01a9227fb3..8fd1843ab59e 100644 --- a/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h +++ b/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h @@ -138,8 +138,8 @@ #define HEATER_0_PIN 40 // PA5 #define HEATER_BED_PIN 41 // PB24 -#ifndef FAN_PIN - #define FAN_PIN 13 // PB27 Fan1A +#ifndef FAN0_PIN + #define FAN0_PIN 13 // PB27 Fan1A #endif #define FAN1_PIN 58 // PA6 Fan1B diff --git a/Marlin/src/pins/sam/pins_RADDS.h b/Marlin/src/pins/sam/pins_RADDS.h index af24014614c1..e3de44427808 100644 --- a/Marlin/src/pins/sam/pins_RADDS.h +++ b/Marlin/src/pins/sam/pins_RADDS.h @@ -196,8 +196,8 @@ #define HEATER_BED_PIN 7 // BED #endif -#ifndef FAN_PIN - #define FAN_PIN 9 +#ifndef FAN0_PIN + #define FAN0_PIN 9 #endif #define FAN1_PIN 8 diff --git a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h index 00eba994a8d9..75d758439c57 100644 --- a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h @@ -124,8 +124,8 @@ #define HEATER_2_PIN 11 #define HEATER_BED_PIN 8 -#ifndef FAN_PIN - #define FAN_PIN 12 +#ifndef FAN0_PIN + #define FAN0_PIN 12 #endif // diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index f8ea65a36973..2ae1f4827756 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -122,8 +122,8 @@ #define HEATER_2_PIN 11 #define HEATER_BED_PIN 7 // BED H1 -#ifndef FAN_PIN - #define FAN_PIN 9 +#ifndef FAN0_PIN + #define FAN0_PIN 9 #endif #define FAN1_PIN 8 #define CONTROLLER_FAN_PIN -1 @@ -163,11 +163,13 @@ #define TFT_LCD_MODULE_COM 1 #define TFT_LCD_MODULE_BAUDRATE 115600 -// ESP WiFi Use internal USART-2 -#define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115600 -#define ESP_WIFI_MODULE_RESET_PIN -1 -#define PIGGY_GPIO_PIN -1 +#if ENABLED(WIFISUPPORT) + // ESP WiFi Use internal USART-2 + #define ESP_WIFI_MODULE_COM 2 + #define ESP_WIFI_MODULE_BAUDRATE 115600 + #define ESP_WIFI_MODULE_RESET_PIN -1 + #define PIGGY_GPIO_PIN -1 +#endif // // EEPROM diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h index 58cb3f7a75e9..6034a0e82a74 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h @@ -114,7 +114,7 @@ #define HEATER_2_PIN 11 #define HEATER_BED_PIN 7 // BED H1 -#define FAN_PIN 9 +#define FAN0_PIN 9 #define FAN1_PIN 8 #define CONTROLLER_FAN_PIN -1 @@ -153,11 +153,13 @@ #define TFT_LCD_MODULE_COM 1 #define TFT_LCD_MODULE_BAUDRATE 115200 -// ESP WiFi Use internal USART-2 -#define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115200 -#define ESP_WIFI_MODULE_RESET_PIN -1 -#define PIGGY_GPIO_PIN -1 +#if ENABLED(WIFISUPPORT) + // ESP WiFi Use internal USART-2 + #define ESP_WIFI_MODULE_COM 2 + #define ESP_WIFI_MODULE_BAUDRATE 115200 + #define ESP_WIFI_MODULE_RESET_PIN -1 + #define PIGGY_GPIO_PIN -1 +#endif // // EEPROM diff --git a/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h b/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h index fd30c2b69a86..4445cf24e886 100644 --- a/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h +++ b/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h @@ -120,8 +120,8 @@ #define HEATER_3_PIN 9 #define HEATER_BED_PIN 2 -#ifndef FAN_PIN - #define FAN_PIN 6 +#ifndef FAN0_PIN + #define FAN0_PIN 6 #endif #define FAN2_PIN 5 diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h index a3f98e388aa7..5cd258410421 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -102,7 +102,7 @@ // #define HEATER_0_PIN 6 #define HEATER_BED_PIN 7 -#define FAN_PIN 8 +#define FAN0_PIN 8 #define FAN1_PIN 9 // @@ -284,7 +284,6 @@ //#define DOGLCD_SCK 23 //#define DOGLCD_A0 LCD_PINS_DC - #else // Definitions for any standard Display #define LCD_PINS_RS EXP1_04_PIN diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 2343dbcf8217..13434fffeb52 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -152,7 +152,7 @@ #define HEATER_BED_PIN 7 // The board has 4 PWM fans, use and configure as desired -#define FAN_PIN 8 +#define FAN0_PIN 8 #define FAN1_PIN 9 #define FAN2_PIN 30 #define FAN3_PIN 31 diff --git a/Marlin/src/pins/samd/pins_MINITRONICS20.h b/Marlin/src/pins/samd/pins_MINITRONICS20.h index 02d806b3eccf..12438fe57e9e 100644 --- a/Marlin/src/pins/samd/pins_MINITRONICS20.h +++ b/Marlin/src/pins/samd/pins_MINITRONICS20.h @@ -149,7 +149,7 @@ #define SPINDLE_LASER_PWM_PIN 6 // The board has 4 PWM fans, use and configure as desired -#define FAN_PIN 24 +#define FAN0_PIN 24 // // LCD / Controller @@ -212,9 +212,9 @@ #if ENABLED(CR10_STOCKDISPLAY) // TO TEST - //#define LCD_PINS_RS EXP3_04_PIN - //#define LCD_PINS_ENABLE EXP3_03_PIN - //#define LCD_PINS_D4 EXP3_05_PIN + //#define LCD_PINS_RS EXP3_04_PIN + //#define LCD_PINS_ENABLE EXP3_03_PIN + //#define LCD_PINS_D4 EXP3_05_PIN #if !IS_NEWPANEL // TO TEST @@ -278,7 +278,7 @@ #if IS_RRD_SC - //#define BEEPER_PIN EXP1_01_PIN + //#define BEEPER_PIN EXP1_01_PIN #if ENABLED(CR10_STOCKDISPLAY) // TO TEST @@ -297,7 +297,7 @@ #ifndef SD_DETECT_PIN #define SD_DETECT_PIN EXP2_07_PIN #endif - //#define KILL_PIN EXP2_10_PIN + //#define KILL_PIN EXP2_10_PIN #if ENABLED(BQ_LCD_SMART_CONTROLLER) //#define LCD_BACKLIGHT_PIN EXP1_08_PIN // TO TEST diff --git a/Marlin/src/pins/samd/pins_RAMPS_144.h b/Marlin/src/pins/samd/pins_RAMPS_144.h index 7adb2404c158..ed10c4d284de 100644 --- a/Marlin/src/pins/samd/pins_RAMPS_144.h +++ b/Marlin/src/pins/samd/pins_RAMPS_144.h @@ -123,7 +123,7 @@ #else #define HEATER_1_PIN 8 #endif -#define FAN_PIN 9 +#define FAN0_PIN 9 #define FAN1_PIN 7 #define FAN2_PIN 12 @@ -164,18 +164,16 @@ #endif // -// TMC software SPI +// TMC SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 58 // Mega/Due:66 - AGCM4:58 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 44 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 56 // Mega/Due:64 - AGCM4:56 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI 58 // Mega/Due:66 - AGCM4:58 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO 44 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK 56 // Mega/Due:64 - AGCM4:56 #endif #if HAS_TMC_UART diff --git a/Marlin/src/pins/sanguino/pins_ANET_10.h b/Marlin/src/pins/sanguino/pins_ANET_10.h index bd69e167dc05..176bb2be12c4 100644 --- a/Marlin/src/pins/sanguino/pins_ANET_10.h +++ b/Marlin/src/pins/sanguino/pins_ANET_10.h @@ -23,6 +23,8 @@ /** * 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 */ /** @@ -146,8 +148,8 @@ #define HEATER_0_PIN 13 // (extruder) #define HEATER_BED_PIN 12 // (bed) -#ifndef FAN_PIN - #define FAN_PIN 4 +#ifndef FAN0_PIN + #define FAN0_PIN 4 #endif // diff --git a/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h b/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h index 4c721da00038..5767bc993b66 100644 --- a/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h +++ b/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h @@ -23,10 +23,12 @@ /** * 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 */ #define BOARD_INFO_NAME "Azteeg X1" -#define FAN_PIN 4 +#define FAN0_PIN 4 #include "pins_SANGUINOLOLU_12.h" // ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/sanguino/pins_GEN3_MONOLITHIC.h b/Marlin/src/pins/sanguino/pins_GEN3_MONOLITHIC.h index 1343739a119e..a5afc30187ed 100644 --- a/Marlin/src/pins/sanguino/pins_GEN3_MONOLITHIC.h +++ b/Marlin/src/pins/sanguino/pins_GEN3_MONOLITHIC.h @@ -23,6 +23,7 @@ /** * Gen3 Monolithic Electronics pin assignments + * https://reprap.org/wiki/Generation_3_Electronics */ /** diff --git a/Marlin/src/pins/sanguino/pins_GEN6.h b/Marlin/src/pins/sanguino/pins_GEN6.h index 51e8200b9570..75138845f402 100644 --- a/Marlin/src/pins/sanguino/pins_GEN6.h +++ b/Marlin/src/pins/sanguino/pins_GEN6.h @@ -23,6 +23,8 @@ /** * 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 */ /** diff --git a/Marlin/src/pins/sanguino/pins_GEN7_12.h b/Marlin/src/pins/sanguino/pins_GEN7_12.h index 0834da78c45c..0bf65c37cd38 100644 --- a/Marlin/src/pins/sanguino/pins_GEN7_12.h +++ b/Marlin/src/pins/sanguino/pins_GEN7_12.h @@ -23,6 +23,14 @@ /** * 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 */ /** @@ -54,7 +62,7 @@ #include "env_validate.h" #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "Gen7 v1.1 / 1.2" + #define BOARD_INFO_NAME "Gen7 v1.1 - v1.3" #endif #ifndef GEN7_VERSION @@ -109,8 +117,8 @@ #define HEATER_0_PIN 4 #define HEATER_BED_PIN 3 -#if !defined(FAN_PIN) && GEN7_VERSION < 13 // Gen7 v1.3 removed the fan pin - #define FAN_PIN 31 +#if !defined(FAN0_PIN) && GEN7_VERSION < 13 // Gen7 v1.3 removed the fan pin + #define FAN0_PIN 31 #endif // diff --git a/Marlin/src/pins/sanguino/pins_GEN7_14.h b/Marlin/src/pins/sanguino/pins_GEN7_14.h index 97bfdd28a727..698bd066066a 100644 --- a/Marlin/src/pins/sanguino/pins_GEN7_14.h +++ b/Marlin/src/pins/sanguino/pins_GEN7_14.h @@ -23,6 +23,10 @@ /** * 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 */ /** diff --git a/Marlin/src/pins/sanguino/pins_MELZI.h b/Marlin/src/pins/sanguino/pins_MELZI.h index d6f9288e8c2f..a0c7050a9111 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI.h +++ b/Marlin/src/pins/sanguino/pins_MELZI.h @@ -23,6 +23,8 @@ /** * 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 */ #ifndef BOARD_INFO_NAME @@ -31,8 +33,8 @@ #define IS_MELZI 1 -#ifndef FAN_PIN - #define FAN_PIN 4 +#ifndef FAN0_PIN + #define FAN0_PIN 4 #endif // Alter timing for graphical display diff --git a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h index 437ba35eeadc..7984e64b5f56 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h @@ -23,6 +23,9 @@ /** * 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 + * ATmega1284P * * The Creality 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 @@ -46,11 +49,12 @@ // LCD / Controller // #if ANY(MKS_MINI_12864, CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) - #if ENABLED(CR10_STOCKDISPLAY) + #if EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) #define LCD_PINS_RS 28 // ST9720 CS #define LCD_PINS_ENABLE 17 // ST9720 DAT #define LCD_PINS_D4 30 // ST9720 CLK - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #endif + #if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define DOGLCD_CS 28 #define DOGLCD_A0 30 #endif @@ -95,7 +99,7 @@ PIN: 2 Port: B2 Z_DIR_PIN protected PIN: 3 Port: B3 Z_STEP_PIN protected PIN: 4 Port: B4 AVR_SS_PIN protected - . FAN_PIN protected + . FAN0_PIN protected . SD_SS_PIN protected PIN: 5 Port: B5 AVR_MOSI_PIN Output = 1 . SD_MOSI_PIN Output = 1 diff --git a/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h b/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h index d6f36cc6f541..00c9db6f81a8 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h @@ -23,6 +23,7 @@ /** * Melzi (Malyan M150) pin assignments + * ATmega644P, ATmega1284P */ #define BOARD_INFO_NAME "Melzi (Malyan)" diff --git a/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h b/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h index aecad10dabfd..da010ab1a6e2 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h @@ -23,6 +23,7 @@ /** * Melzi pin assignments + * ATmega644P, ATmega1284P */ #define BOARD_INFO_NAME "Melzi (Tronxy)" diff --git a/Marlin/src/pins/sanguino/pins_MELZI_V2.h b/Marlin/src/pins/sanguino/pins_MELZI_V2.h index e49eb57b1137..2cd949e095de 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_V2.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_V2.h @@ -23,6 +23,8 @@ /** * 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 */ #define BOARD_INFO_NAME "Melzi V2" diff --git a/Marlin/src/pins/sanguino/pins_OMCA.h b/Marlin/src/pins/sanguino/pins_OMCA.h index 7f18283d1c54..65f9006adbf5 100644 --- a/Marlin/src/pins/sanguino/pins_OMCA.h +++ b/Marlin/src/pins/sanguino/pins_OMCA.h @@ -128,8 +128,8 @@ #define HEATER_0_PIN 3 // DONE PWM on RIGHT connector #define HEATER_BED_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 14 // PWM on MIDDLE connector +#ifndef FAN0_PIN + #define FAN0_PIN 14 // PWM on MIDDLE connector #endif // diff --git a/Marlin/src/pins/sanguino/pins_OMCA_A.h b/Marlin/src/pins/sanguino/pins_OMCA_A.h index a3ceb76a0de9..aa7f79d602d7 100644 --- a/Marlin/src/pins/sanguino/pins_OMCA_A.h +++ b/Marlin/src/pins/sanguino/pins_OMCA_A.h @@ -123,8 +123,8 @@ // #define HEATER_0_PIN 4 -#ifndef FAN_PIN - #define FAN_PIN 3 +#ifndef FAN0_PIN + #define FAN0_PIN 3 #endif // diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h index 3b6297ba4d1c..1459eab6463b 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h @@ -23,6 +23,16 @@ /** * 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 */ /** @@ -90,8 +100,8 @@ // #define HEATER_0_PIN 13 // (extruder) -#ifndef FAN_PIN - #define FAN_PIN 4 // Works for Panelolu2 too +#ifndef FAN0_PIN + #define FAN0_PIN 4 // Works for Panelolu2 too #endif #if DISABLED(SANGUINOLOLU_V_1_2) @@ -153,7 +163,7 @@ #define KILL_PIN 10 #define BEEPER_PIN 27 - #elif IS_U8GLIB_ST7920 // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0 + #elif IS_U8GLIB_ST7920 // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0 #if IS_MELZI #define LCD_PINS_RS 30 // CS chip select /SS chip slave select diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h index ec7621e28f3e..37d1e7030b42 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h @@ -23,6 +23,12 @@ /** * 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 * * Applies to the following boards: * @@ -46,8 +52,8 @@ #endif #define E0_ENABLE_PIN 14 -#if !defined(FAN_PIN) && ENABLED(LCD_I2C_PANELOLU2) - #define FAN_PIN 4 // Uses Transistor1 (PWM) on Panelolu2's Sanguino Adapter Board to drive the fan +#if !defined(FAN0_PIN) && ENABLED(LCD_I2C_PANELOLU2) + #define FAN0_PIN 4 // Uses Transistor1 (PWM) on Panelolu2's Sanguino Adapter Board to drive the fan #endif #define SANGUINOLOLU_V_1_2 diff --git a/Marlin/src/pins/sanguino/pins_SETHI.h b/Marlin/src/pins/sanguino/pins_SETHI.h index a2240b385b2b..31d5585cc8cf 100644 --- a/Marlin/src/pins/sanguino/pins_SETHI.h +++ b/Marlin/src/pins/sanguino/pins_SETHI.h @@ -97,13 +97,8 @@ #define HEATER_0_PIN 4 #define HEATER_BED_PIN 3 -#ifndef FAN_PIN - #if GEN7_VERSION >= 13 - // Gen7 v1.3 removed the fan pin - #define FAN_PIN -1 - #else - #define FAN_PIN 31 - #endif +#if !defined(FAN0_PIN) && GEN7_VERSION < 13 // Gen7 v1.3 removed the fan pin + #define FAN0_PIN 31 #endif // diff --git a/Marlin/src/pins/sanguino/pins_STB_11.h b/Marlin/src/pins/sanguino/pins_STB_11.h index ad0919e99e69..5c6c5d4f826c 100644 --- a/Marlin/src/pins/sanguino/pins_STB_11.h +++ b/Marlin/src/pins/sanguino/pins_STB_11.h @@ -22,13 +22,14 @@ #pragma once /** - * STB V1.1 pin assignments + * STB Electronics V1.1 pin assignments + * https://www.reprap.org/wiki/STB_Electronics */ #define BOARD_INFO_NAME "STB V1.1" -#ifndef FAN_PIN - #define FAN_PIN 4 // Works for Panelolu2 too +#ifndef FAN0_PIN + #define FAN0_PIN 4 // Works for Panelolu2 too #endif #include "pins_SANGUINOLOLU_12.h" // ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h index aa3ce556d16e..5b0b996d18f2 100644 --- a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h +++ b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h @@ -31,6 +31,8 @@ /** * 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 * * 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 @@ -77,7 +79,7 @@ * PIN: 25 Port: A6 FIL_RUNOUT_PIN * PIN: 26 Port: A5 E0_DIR_PIN * PIN: 27 Port: A4 E0_STEP_PIN - * PIN: 28 Port: A3 FAN_PIN + * PIN: 28 Port: A3 FAN0_PIN * PIN: 29 Port: A2 EXP1_3(BTN_ENC) * ADC_KEY_PIN * PIN: 30 Port: A1 TEMP_0_PIN @@ -142,7 +144,7 @@ // #define HEATER_0_PIN 0 #define HEATER_BED_PIN 1 -#define FAN_PIN 28 +#define FAN0_PIN 28 #define FAN1_PIN -1 // diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index 061e27faf4f7..abccac9dad9d 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -419,7 +419,7 @@ // Mixing stepper, Switching stepper, or regular stepper #define E_NEEDED(N) (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > N) \ - || (ENABLED(SWITCHING_EXTRUDER) && E_STEPPERS > N) \ + || (HAS_SWITCHING_EXTRUDER && E_STEPPERS > N) \ || (NONE(SWITCHING_EXTRUDER, MIXING_EXTRUDER) && EXTRUDERS > N) #define _E0_CS @@ -632,7 +632,7 @@ #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3 #endif -#if ENABLED(SWITCHING_EXTRUDER) +#if HAS_SWITCHING_EXTRUDER // Tools 0 and 1 use E0 #if EXTRUDERS > 2 // Tools 2 and 3 use E1 #undef _E1_PINS @@ -899,8 +899,8 @@ #define _Z_PROBE #endif -#if PIN_EXISTS(FAN) - #define _FAN0 FAN_PIN, +#if PIN_EXISTS(FAN0) + #define _FAN0 FAN0_PIN, #else #define _FAN0 #endif diff --git a/Marlin/src/pins/stm32f1/pins_BEAST.h b/Marlin/src/pins/stm32f1/pins_BEAST.h index 4dafe2f27365..80967bad074c 100644 --- a/Marlin/src/pins/stm32f1/pins_BEAST.h +++ b/Marlin/src/pins/stm32f1/pins_BEAST.h @@ -89,8 +89,8 @@ #define HEATER_BED_PIN PB9 // BED -#ifndef FAN_PIN - #define FAN_PIN PB10 +#ifndef FAN0_PIN + #define FAN0_PIN PB10 #endif #define FAN_SOFT_PWM_REQUIRED diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h index e3e91ff35ad4..00dc0613f27f 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h @@ -112,7 +112,7 @@ #define HEATER_0_PIN PC8 // HEATER1 #define HEATER_BED_PIN PC9 // HOT BED -#define FAN_PIN PC6 // FAN +#define FAN0_PIN PC6 // FAN #define FAN_SOFT_PWM_REQUIRED #define CONTROLLER_FAN_PIN PC7 diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index 075258991ddd..8fb194c27f06 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -94,18 +94,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB5 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB4 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB3 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB5 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB4 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB3 #endif #if HAS_TMC_UART @@ -147,7 +145,7 @@ // #define HEATER_0_PIN PC8 // "HE" #define HEATER_BED_PIN PC9 // "HB" -#define FAN_PIN PA8 // "FAN0" +#define FAN0_PIN PA8 // "FAN0" // // USB connect control diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h index c0428279f0fe..7e6798deafd6 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h @@ -37,7 +37,7 @@ #undef NO_EEPROM_SELECTED #endif -#define FAN_PIN PC6 +#define FAN0_PIN PC6 // // USB connect control diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index 5770f4a5ba01..9d85e211f763 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -100,8 +100,8 @@ #define HEATER_0_PIN PC8 // "HE" #define HEATER_BED_PIN PC9 // "HB" -#ifndef FAN_PIN - #define FAN_PIN PA8 // "FAN0" +#ifndef FAN0_PIN + #define FAN0_PIN PA8 // "FAN0" #endif // diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h index c544e1353c1f..c45e7fb282d3 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h @@ -68,40 +68,39 @@ #define E0_DIR_PIN PB0 #define E0_ENABLE_PIN PC4 -#if ENABLED(TMC_USE_SW_SPI) // Shared with EXP2 - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB3 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB4 - #endif - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB5 - #endif +// Shared with EXP2 +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB3 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB4 +#endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB5 #endif #if HAS_TMC_UART // Shared with EXP1 - #define X_SERIAL_TX_PIN PC10 - #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + #define X_SERIAL_TX_PIN PC10 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN - #define Y_SERIAL_TX_PIN PC11 - #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + #define Y_SERIAL_TX_PIN PC11 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN - #define Z_SERIAL_TX_PIN PC12 - #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + #define Z_SERIAL_TX_PIN PC12 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN - #define E0_SERIAL_TX_PIN PC14 - #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + #define E0_SERIAL_TX_PIN PC14 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN // Reduce baud rate to improve software serial reliability - #define TMC_BAUD_RATE 19200 + #define TMC_BAUD_RATE 19200 #endif // // Heaters / Fans // #define HEATER_0_PIN PA8 -#define FAN_PIN PC8 +#define FAN0_PIN PC8 #define HEATER_BED_PIN PC9 // @@ -215,7 +214,7 @@ #define FORCE_SOFT_SPI // SPI MODE3 - #define LED_PIN EXP1_06_PIN // red pwm + #define LED_PIN EXP1_06_PIN // red pwm //#define LED_PIN EXP1_07_PIN // green //#define LED_PIN EXP1_08_PIN // blue @@ -287,4 +286,4 @@ #define ONBOARD_SPI_DEVICE 1 // SPI1 #define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card -#define SDSS SD_SS_PIN +#define SDSS SD_SS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index c73544bf436f..a75825658c9b 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -114,7 +114,7 @@ #define HEATER_0_PIN PC8 // HEATER0 #define HEATER_BED_PIN PC9 // HOT BED -#define FAN_PIN PA7 // FAN (fan2 on board) model cool fan +#define FAN0_PIN PA7 // FAN (fan2 on board) model cool fan #define FAN1_PIN PA8 // FAN (fan0 on board) e0 cool fan #define FAN2_PIN PB9 // FAN (fan1 on board) controller cool fan @@ -134,7 +134,7 @@ #define EXP1_01_PIN PB5 #define EXP1_02_PIN PB6 #define EXP1_03_PIN PA2 -#define EXP1_04_PIN -1 // RESET +#define EXP1_04_PIN -1 // RESET #define EXP1_05_PIN PA3 #define EXP1_06_PIN PB8 #define EXP1_07_PIN PB7 diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D.h b/Marlin/src/pins/stm32f1/pins_CHITU3D.h index 3b66096a270d..32894bb72c97 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D.h @@ -83,8 +83,8 @@ #define HEATER_0_PIN PD12 // HOT-END #define HEATER_BED_PIN PG11 // HOT-BED -#ifndef FAN_PIN - #define FAN_PIN PG14 // MAIN BOARD FAN +#ifndef FAN0_PIN + #define FAN0_PIN PG14 // MAIN BOARD FAN #endif #define FAN_SOFT_PWM_REQUIRED diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h index 89e07d6a21e8..02daab3e63ac 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h @@ -33,4 +33,55 @@ #define FIL_RUNOUT2_PIN PF13 #endif +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PG9 +#endif + #include "pins_CHITU3D_common.h" + +/* + * Circuit diagram https://github.com/MarlinFirmware/Marlin/files/3401484/x5sa-main_board-2.pdf + * + * Details on the 30 pin ribbon pins. From: https://3dtoday.ru/blogs/artem-sr/tronxy-x5sa-pro-ustanovka-bfp-touch-na-board-chitu3d-v6-cxy-v6-191017 + * + * JP2 Ribbon 30 on CXY-V6-191017 + * ---------------------------------------------- + * | 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30| + * | 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29| + * ---------------------- ---------------------- + * + * -------------------------------------------------------------------------------------- + * | Pin | Label | Function & Notes | + * -------------------------------------------------------------------------------------- + * | 1 | Hotend | Hotend driver Q6 HY1403 via MCU Pin127 PG12 | + * | 2 | Hotend | Hotend driver Q6 HY1403 via MCU Pin127 PG12 | + * | 3 | Hotend | Hotend driver Q6 HY1403 via MCU Pin127 PG12 | + * | 4 | Hotend | Hotend driver Q6 HY1403 via MCU Pin127 PG12 | + * | 5 | +24v | Hotend +24v | + * | 6 | +24v | Hotend +24v | + * | 7 | +24v | Hotend +24v | + * | 8 | +24v | Hotend +24v | + * | 9 | F_2 | Extruder Fan2 driver Q8 AO3400A X07S via MCU Pin129 PG14 | + * | 10 | +24v | Extruder cooling Fan2 +24v | + * | 11 | F_1 | Part Fan1 driver Q7 AO3400A X07S via MCU Pin128 PG13 | + * | 12 | +24v | Part cooling Fanl +24v | + * | 13 | 1B | X-MOTOR Winding Drive | + * | 14 | 1A | X-MOTOR Winding Drive | + * | 15 | 2B | X-MOTOR Winding Drive | + * | 16 | 2A | X-MOTOR Winding Drive | + * | 17 | lA | El-Motor Winding Drive | + * | 18 | 1B | El-Motor Winding Drive | + * | 19 | 2B | El-Motor Winding Drive | + * | 20 | 2A | El-Motor Winding Drive | + * | 21 | PROXIMITY | 10kΩ Pullup to +5V and 100nF to GND, then 20kΩ to MCU Pin124 PG9 | + * | 22 | +24v | Proximity sensor +24v | + * | 23 | +5V | Filament sensor +5V XSTOP sensor +5V | + * | 24 | GND | Proximity sensor GND | + * | 25 | FILAMENT1 | 10kΩ Pullup to +5V and 100nF to GND, then 47kΩ to MCU Pin110 PA15| + * | 26 | GND | Filament Sensor GND | + * | 27 | XSTOP | 10kΩ Pullup to +5V and 100nF to GND, then 47kΩ to MCU Pin125 PG10| + * | 28 | GND | XSTOP sensor GND | + * | 29 | GND | Extruder temperature NTC sensor return GND | + * | 30 | ETEMP | 4k7Ω Pullup to +3V3 and 100nF to GND, then 4k7Ω to MCU Pin35 PA1 | + * -------------------------------------------------------------------------------------- + */ diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h index f5dd4a42b0f6..c85c107bd9b1 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h @@ -99,7 +99,7 @@ // Fans // #define CONTROLLER_FAN_PIN PD6 // BOARD FAN -#define FAN_PIN PG13 // FAN +#define FAN0_PIN PG13 // FAN #define FAN2_PIN PG14 // @@ -140,8 +140,6 @@ #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_CS_PIN PD7 #define FSMC_RS_PIN PD11 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h index 53953f9ebccc..7a8f3189aad8 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h @@ -84,7 +84,7 @@ #if HAS_CUTTER //#define HEATER_0_PIN -1 //#define HEATER_BED_PIN -1 - #define FAN_PIN -1 + #define FAN0_PIN -1 #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 #define SPINDLE_LASER_PWM_PIN PC0 // Bed FET #define SPINDLE_DIR_PIN PC0 // FET 4 diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h index a0152a522166..9e422e62b0a3 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h @@ -49,8 +49,8 @@ #endif #if ENABLED(IIC_BL24CXX_EEPROM) - #define IIC_EEPROM_SDA PA11 - #define IIC_EEPROM_SCL PA12 + #define IIC_EEPROM_SDA PA11 + #define IIC_EEPROM_SCL PA12 #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) #elif EITHER(SDCARD_EEPROM_EMULATION, FLASH_EEPROM_EMULATION) #define MARLIN_EEPROM_SIZE 0x800 // 2K @@ -114,7 +114,7 @@ #define HEATER_0_PIN PB14 // HEATER1 #define HEATER_BED_PIN PB13 // HOT BED -#define FAN_PIN PB15 // FAN +#define FAN0_PIN PB15 // FAN #ifndef E0_AUTO_FAN_PIN #define E0_AUTO_FAN_PIN PC13 // FAN #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index f633ee0983c0..e71fec0181f5 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -53,6 +53,7 @@ #if NO_EEPROM_SELECTED #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 //#define SDCARD_EEPROM_EMULATION + #undef NO_EEPROM_SELECTED #endif #if ENABLED(IIC_BL24CXX_EEPROM) @@ -148,8 +149,8 @@ #ifndef HEATER_BED_PIN #define HEATER_BED_PIN PA2 // HOT BED #endif -#ifndef FAN_PIN - #define FAN_PIN PA0 // FAN +#ifndef FAN0_PIN + #define FAN0_PIN PA0 // FAN #endif #define FAN_SOFT_PWM_REQUIRED diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index f3b7e4f308b9..d85758981f3a 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -130,7 +130,7 @@ #define HEATER_0_PIN PA0 // HEATER1 #define HEATER_BED_PIN PA1 // HOT BED -#define FAN_PIN PA2 // FAN +#define FAN0_PIN PA2 // FAN #define FAN_SOFT_PWM_REQUIRED // diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V425.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V425.h index 1c62d19a99e4..2d9b9f38f54f 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V425.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V425.h @@ -72,6 +72,6 @@ // #define HEATER_0_PIN PA0 // HEATER1 #define HEATER_BED_PIN PA1 // HOT BED -#define FAN_PIN PA2 // FAN +#define FAN0_PIN PA2 // FAN #include "pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h index 4f57f8a805df..2f89402607cd 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h @@ -33,7 +33,7 @@ #define HEATER_0_PIN PA1 // HEATER1 #define HEATER_BED_PIN PA2 // HOT BED -#define FAN_PIN PA0 // FAN +#define FAN0_PIN PA0 // FAN #if ENABLED(PROBE_ACTIVATION_SWITCH) #ifndef PROBE_ACTIVATION_SWITCH_PIN diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h index 6a0fa4f41802..25b5d6c0acc7 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h @@ -33,7 +33,7 @@ #define HEATER_0_PIN PB14 // HEATER1 #define HEATER_BED_PIN PB13 // HOT BED -#define FAN_PIN PB15 // FAN +#define FAN0_PIN PB15 // FAN #if ENABLED(PROBE_ACTIVATION_SWITCH) #ifndef PROBE_ACTIVATION_SWITCH_PIN diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h index d3d3685531dc..c90d76d17d9e 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h @@ -133,7 +133,7 @@ #define HEATER_1_PIN PA0 // HEATER1 #define HEATER_BED_PIN PA2 // HOT BED -#define FAN_PIN PB14 // FAN +#define FAN0_PIN PB14 // FAN #define FAN1_PIN PB12 // FAN #define FAN_SOFT_PWM diff --git a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h index 08c9500fc5e1..f5a285170e99 100644 --- a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h @@ -105,15 +105,15 @@ #endif #endif -#ifndef FAN_PIN +#ifndef FAN0_PIN #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN PB5 + #define FAN0_PIN PB5 #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN PD12 + #define FAN0_PIN PD12 #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed - #define FAN_PIN -1 // IO pin. Buffer needed + #define FAN0_PIN -1 // IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN PB5 + #define FAN0_PIN PB5 #endif #endif diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index ff588f948812..4978f84abeaf 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -138,27 +138,29 @@ #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 } #endif - /** - * MKS Robin_Wifi or another ESP8266 module - * - * __ESP(M1)__ -J1- - * GND| 15 | | 08 |+3v3 (22) RXD1 (PA10) - * | 16 | | 07 |MOSI (21) TXD1 (PA9) Active LOW, probably OK to leave floating - * IO2| 17 | | 06 |MISO (19) IO1 (PC7) Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating) - * IO0| 18 | | 05 |CLK (18) IO0 (PA8) Must be HIGH (ESP3D software configures this with a pullup so OK to leave as floating) - * IO1| 19 | | 03 |EN (03) WIFI_EN Must be HIGH for module to run - * | nc | | nc | (01) WIFI_CTRL (PA5) - * RX| 21 | | nc | - * TX| 22 | | 01 |RST - *  ̄ ̄ AE ̄ ̄ - */ - // Module ESP-WIFI - #define ESP_WIFI_MODULE_COM 2 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this - #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 - #define ESP_WIFI_MODULE_RESET_PIN PA5 // WIFI CTRL/RST - #define ESP_WIFI_MODULE_ENABLE_PIN -1 - #define ESP_WIFI_MODULE_TXD_PIN PA9 // MKS or ESP WIFI RX PIN - #define ESP_WIFI_MODULE_RXD_PIN PA10 // MKS or ESP WIFI TX PIN + #if ENABLED(WIFISUPPORT) + /** + * MKS Robin_Wifi or another ESP8266 module + * + * __ESP(M1)__ -J1- + * GND| 15 | | 08 |+3v3 (22) RXD1 (PA10) + * | 16 | | 07 |MOSI (21) TXD1 (PA9) Active LOW, probably OK to leave floating + * IO2| 17 | | 06 |MISO (19) IO1 (PC7) Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating) + * IO0| 18 | | 05 |CLK (18) IO0 (PA8) Must be HIGH (ESP3D software configures this with a pullup so OK to leave as floating) + * IO1| 19 | | 03 |EN (03) WIFI_EN Must be HIGH for module to run + * | nc | | nc | (01) WIFI_CTRL (PA5) + * RX| 21 | | nc | + * TX| 22 | | 01 |RST + *  ̄ ̄ AE ̄ ̄ + */ + // Module ESP-WIFI + #define ESP_WIFI_MODULE_COM 2 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PA5 // WIFI CTRL/RST + #define ESP_WIFI_MODULE_ENABLE_PIN -1 + #define ESP_WIFI_MODULE_TXD_PIN PA9 // MKS or ESP WIFI RX PIN + #define ESP_WIFI_MODULE_RXD_PIN PA10 // MKS or ESP WIFI TX PIN + #endif #endif // @@ -189,7 +191,7 @@ #define HEATER_0_PIN PC3 // HEATER_E0 #define HEATER_BED_PIN PA0 // HEATER_BED-WKUP -#define FAN_PIN PB1 // E_FAN +#define FAN0_PIN PB1 // E_FAN // // Misc. Functions @@ -293,8 +295,6 @@ #define TFT_BACKLIGHT_PIN PD13 #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define FSMC_CS_PIN PD7 // NE4 #define FSMC_RS_PIN PD11 // A0 diff --git a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h index f39850f755f1..c7a6a7639db0 100644 --- a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h @@ -83,16 +83,14 @@ #define E0_CS_PIN PC2 #endif -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI EXP2_06_PIN - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO EXP2_01_PIN - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK EXP2_02_PIN - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI EXP2_06_PIN +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO EXP2_01_PIN +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK EXP2_02_PIN #endif #if HAS_TMC_UART @@ -111,8 +109,8 @@ // #define HEATER_0_PIN PC6 #define HEATER_BED_PIN PC7 -#ifndef FAN_PIN - #define FAN_PIN PC8 +#ifndef FAN0_PIN + #define FAN0_PIN PC8 #endif #define FAN1_PIN PC9 @@ -131,23 +129,23 @@ * ------ ------ * EXP1 EXP2 */ -#define EXP1_01_PIN PC14 -#define EXP1_02_PIN PC13 -#define EXP1_03_PIN PB9 -#define EXP1_04_PIN PB8 -#define EXP1_05_PIN PB7 -#define EXP1_06_PIN PB6 -#define EXP1_07_PIN PB5 -#define EXP1_08_PIN PB4 - -#define EXP2_01_PIN PB14 -#define EXP2_02_PIN PB13 -#define EXP2_03_PIN PB3 -#define EXP2_04_PIN PB12 -#define EXP2_05_PIN PD2 -#define EXP2_06_PIN PB15 -#define EXP2_07_PIN PB11 -#define EXP2_08_PIN -1 // RESET +#define EXP1_01_PIN PC14 +#define EXP1_02_PIN PC13 +#define EXP1_03_PIN PB9 +#define EXP1_04_PIN PB8 +#define EXP1_05_PIN PB7 +#define EXP1_06_PIN PB6 +#define EXP1_07_PIN PB5 +#define EXP1_08_PIN PB4 + +#define EXP2_01_PIN PB14 +#define EXP2_02_PIN PB13 +#define EXP2_03_PIN PB3 +#define EXP2_04_PIN PB12 +#define EXP2_05_PIN PD2 +#define EXP2_06_PIN PB15 +#define EXP2_07_PIN PB11 +#define EXP2_08_PIN -1 // RESET // // LCD / Controller diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h index 9250ee112762..1c62c461f964 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h @@ -134,8 +134,8 @@ // #define HEATER_0_PIN PC7 #define HEATER_BED_PIN PC6 -#ifndef FAN_PIN - #define FAN_PIN PC8 +#ifndef FAN0_PIN + #define FAN0_PIN PC8 #endif // diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h index e59e8aef595f..9bc10a26bc16 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h @@ -104,8 +104,8 @@ // #define HEATER_0_PIN PC6 #define HEATER_BED_PIN PC7 -#ifndef FAN_PIN - #define FAN_PIN PC8 +#ifndef FAN0_PIN + #define FAN0_PIN PC8 #endif // diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h index 5515132c7844..c41e20c2ede8 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h @@ -110,7 +110,7 @@ // // These are FAN PWM pins on EXT0..EXT2 connectors. // -//#define FAN_PIN PB9 // EXT0 port +//#define FAN0_PIN PB9 // EXT0 port #define FAN1_PIN PB8 // EXT1 port #define FAN2_PIN PB7 // EXT2 port @@ -226,10 +226,11 @@ #define SDSS SD_SS_PIN -// -// ESP WiFi can be soldered to J9 connector which is wired to USART2. -// Must define WIFISUPPORT in Configuration.h for the printer. -// -#define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115200 -#define ESP_WIFI_MODULE_RESET_PIN -1 +#if ENABLED(WIFISUPPORT) + // + // ESP WiFi can be soldered to J9 connector which is wired to USART2. + // + #define ESP_WIFI_MODULE_COM 2 + #define ESP_WIFI_MODULE_BAUDRATE 115200 + #define ESP_WIFI_MODULE_RESET_PIN -1 +#endif diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h index dc23680b8c20..7b144f71184d 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h @@ -110,7 +110,7 @@ // // These are FAN PWM pins on EXT0..EXT2 connectors. // -//#define FAN_PIN PB9 // EXT0 port +//#define FAN0_PIN PB9 // EXT0 port #define FAN1_PIN PB8 // EXT1 port #define FAN2_PIN PB7 // EXT2 port @@ -220,10 +220,11 @@ #define SDSS SD_SS_PIN -// -// ESP WiFi can be soldered to J9 connector which is wired to USART2. -// Must define WIFISUPPORT in Configuration.h for the printer. -// -#define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115200 -#define ESP_WIFI_MODULE_RESET_PIN -1 +#if ENABLED(WIFISUPPORT) + // + // ESP WiFi can be soldered to J9 connector which is wired to USART2. + // + #define ESP_WIFI_MODULE_COM 2 + #define ESP_WIFI_MODULE_BAUDRATE 115200 + #define ESP_WIFI_MODULE_RESET_PIN -1 +#endif diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h index 646638dae2f5..633b782e0204 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h @@ -115,7 +115,7 @@ // // These are FAN PWM pins on EXT0..EXT2 connectors. // -//#define FAN_PIN PB9 // EXT0 port +//#define FAN0_PIN PB9 // EXT0 port #define FAN1_PIN PB8 // EXT1 port #define FAN2_PIN PB7 // EXT2 port @@ -231,10 +231,11 @@ #define SDSS SD_SS_PIN -// -// ESP WiFi can be soldered to J9 connector which is wired to USART2. -// Must define WIFISUPPORT in Configuration.h for the printer. -// -#define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115200 -#define ESP_WIFI_MODULE_RESET_PIN -1 +#if ENABLED(WIFISUPPORT) + // + // ESP WiFi can be soldered to J9 connector which is wired to USART2. + // + #define ESP_WIFI_MODULE_COM 2 + #define ESP_WIFI_MODULE_BAUDRATE 115200 + #define ESP_WIFI_MODULE_RESET_PIN -1 +#endif diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h index 968d9cb6bd58..2316d9d3b6c3 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h @@ -110,7 +110,7 @@ // // These are FAN PWM pins on EXT0..EXT2 connectors. // -//#define FAN_PIN PB9 // EXT0 port +//#define FAN0_PIN PB9 // EXT0 port #define FAN1_PIN PB8 // EXT1 port #define FAN2_PIN PB7 // EXT2 port @@ -223,10 +223,11 @@ #define SDSS SD_SS_PIN -// -// ESP WiFi can be soldered to J9 connector which is wired to USART2. -// Must define WIFISUPPORT in Configuration.h for the printer. -// -#define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115200 -#define ESP_WIFI_MODULE_RESET_PIN -1 +#if ENABLED(WIFISUPPORT) + // + // ESP WiFi can be soldered to J9 connector which is wired to USART2. + // + #define ESP_WIFI_MODULE_COM 2 + #define ESP_WIFI_MODULE_BAUDRATE 115200 + #define ESP_WIFI_MODULE_RESET_PIN -1 +#endif diff --git a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h index d3cf3e5cf52c..21ac51e279f5 100644 --- a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h +++ b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h @@ -104,7 +104,7 @@ #define HEATER_0_PIN PA2 #define HEATER_BED_PIN PA3 -#define FAN_PIN PA1 +#define FAN0_PIN PA1 #define FIL_RUNOUT_PIN PC7 @@ -117,8 +117,6 @@ #define FSMC_RS_PIN PG0 #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index ad6b84b05769..b1498d13b9be 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -88,7 +88,7 @@ #define HEATER_0_PIN PD3 // pin 84 (Nozzle Heat Mosfet) #define HEATER_BED_PIN PA8 // pin 67 (Hot Bed Mosfet) -#define FAN_PIN PA15 // pin 77 (4cm Fan) +#define FAN0_PIN PA15 // pin 77 (4cm Fan) #if TERN(MAPLE_STM32F1, ENABLED(FAN_SOFT_PWM), ENABLED(FAST_PWM_FAN)) && FAN_MIN_PWM < 5 // Required to avoid issues with heating or STLink #error "FAN_MIN_PWM must be 5 or higher." // Fan will not start in 1-30 range @@ -116,7 +116,7 @@ #define BOARD_PREINIT() { \ OUT_WRITE_OD(HEATER_0_PIN, 0); \ OUT_WRITE_OD(HEATER_BED_PIN, 0); \ - OUT_WRITE_OD(FAN_PIN, 0); \ + OUT_WRITE_OD(FAN0_PIN, 0); \ } // @@ -138,8 +138,6 @@ #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_CS_PIN PD7 // pin 88 = FSMC_NE1 #define FSMC_RS_PIN PD11 // pin 58 A16 Register. Only one address needed - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h index f157c8e45544..cc26942002cc 100644 --- a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h @@ -64,9 +64,9 @@ // Limit Switches // #define X_MIN_PIN PD6 -#define X_MAX_PIN PG15 // To double check +#define X_MAX_PIN PG15 // To double check #define Y_MIN_PIN PG9 -#define Y_MAX_PIN PG14 // To double check +#define Y_MAX_PIN PG14 // To double check #define Z_MIN_PIN PG10 #define Z_MAX_PIN PG13 @@ -111,7 +111,7 @@ #define HEATER_0_PIN PB0 #define HEATER_BED_PIN PB1 -#define FAN_PIN PA0 // FAN +#define FAN0_PIN PA0 // FAN // // SD Card @@ -143,8 +143,6 @@ #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_CS_PIN PD7 // NE4 #define FSMC_RS_PIN PG0 // A0 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index be5f6c740482..5f290d153d3f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -116,7 +116,7 @@ // // Fan // -#define FAN_PIN PA7 // FAN +#define FAN0_PIN PA7 // FAN // // Thermocouples @@ -176,8 +176,6 @@ #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_CS_PIN PG12 // NE4 #define FSMC_RS_PIN PF0 // A0 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h index 77c2b792157a..6d8889733215 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h @@ -50,18 +50,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB15 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB14 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB13 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 #endif #include "pins_MKS_ROBIN_E3_common.h" diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h index 2ad68a01405c..89fda7ab6799 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h @@ -50,18 +50,17 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers +// Software and hardware actually, they are connected to SPI2 bus. // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB15 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB14 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB13 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 #endif #include "pins_MKS_ROBIN_E3_V1_1_common.h" // ... MKS_ROBIN_E3_common diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index 89525d93ef48..b14b17d0b962 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -112,18 +112,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PD14 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PD1 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PD0 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PD14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PD1 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PD0 #endif #if HAS_TMC_UART @@ -173,7 +171,7 @@ #define HEATER_0_PIN PC3 // HEATER1 #define HEATER_BED_PIN PA0 // HOT BED -#define FAN_PIN PB1 // FAN +#define FAN0_PIN PB1 // FAN // // Misc. Functions diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index 642c97bb1144..c7aacc4bab33 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -119,7 +119,7 @@ // Heaters 0,1 / Fans / Bed // #define HEATER_0_PIN PC9 -#define FAN_PIN PA8 +#define FAN0_PIN PA8 #define HEATER_BED_PIN PC8 // @@ -165,13 +165,13 @@ #define EXP2_05_PIN PB0 #define EXP2_06_PIN PB15 #define EXP2_07_PIN PC10 -#define EXP2_08_PIN -1 // RESET +#define EXP2_08_PIN -1 // RESET // "Ender-3 EXP1" #define EXP3_01_PIN PC1 #define EXP3_02_PIN PC3 #define EXP3_03_PIN PB11 -#define EXP3_04_PIN -1 // RESET +#define EXP3_04_PIN -1 // RESET #define EXP3_05_PIN PB0 #define EXP3_06_PIN PA6 #define EXP3_07_PIN PA5 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h index 7ead6aa28820..e2d4cf564645 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h @@ -68,7 +68,7 @@ // Heaters / Fans // #define HEATER_0_PIN PC9 -#define FAN_PIN PA8 +#define FAN0_PIN PA8 #define HEATER_BED_PIN PC8 // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h index b1aaa53c9487..161ff658a609 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h @@ -82,7 +82,7 @@ // #define HEATER_0_PIN PC9 #define HEATER_1_PIN PC7 -#define FAN_PIN PA8 +#define FAN0_PIN PA8 #define HEATER_BED_PIN PC8 // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index cd4989d73d49..46c2fa806534 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -111,7 +111,7 @@ #define HEATER_0_PIN PC3 #define HEATER_BED_PIN PA0 -#define FAN_PIN PB1 // FAN +#define FAN0_PIN PB1 // FAN // // Misc. Functions @@ -160,8 +160,6 @@ #define FSMC_RS_PIN TFT_RS_PIN // A0 #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #if NEED_TOUCH_PINS #define TOUCH_CS_PIN PC2 // SPI2_NSS 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 8dba94313651..9176ec0ae1cb 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -122,18 +122,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PD14 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PD1 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PD0 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PD14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PD1 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PD0 #endif #if HAS_TMC_UART @@ -182,7 +180,7 @@ #define HEATER_1_PIN PB0 // HEATER2 #define HEATER_BED_PIN PA0 // HOT BED -#define FAN_PIN PB1 // FAN +#define FAN0_PIN PB1 // FAN // // Thermocouples diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h index 858dabb8b986..28dd19938b94 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -105,8 +105,8 @@ #ifndef HEATER_0_PIN #define HEATER_0_PIN PC3 #endif -#ifndef FAN_PIN - #define FAN_PIN PB1 // FAN +#ifndef FAN0_PIN + #define FAN0_PIN PB1 // FAN #endif #ifndef HEATER_BED_PIN #define HEATER_BED_PIN PA0 @@ -196,8 +196,6 @@ #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_CS_PIN PD7 #define FSMC_RS_PIN PD11 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 048570102baf..8a213090b124 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -105,18 +105,16 @@ #define E2_CS_PIN PG9 #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB15 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB14 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB13 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 #endif #if HAS_TMC_UART @@ -167,7 +165,7 @@ #define HEATER_1_PIN PB0 // +HE1- #define HEATER_2_PIN PF9 // +HE2- #define HEATER_BED_PIN PA0 // +HOT-BED- -#define FAN_PIN PB1 // +FAN- +#define FAN0_PIN PB1 // +FAN- /** * Note: MKS Robin Pro board is using SPI2 interface. Make sure your stm32duino library is configured accordingly @@ -233,8 +231,6 @@ #define FSMC_CS_PIN PD7 // NE4 #define FSMC_RS_PIN PD11 // A0 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MORPHEUS.h b/Marlin/src/pins/stm32f1/pins_MORPHEUS.h index 87919c12f488..08e5455b3098 100644 --- a/Marlin/src/pins/stm32f1/pins_MORPHEUS.h +++ b/Marlin/src/pins/stm32f1/pins_MORPHEUS.h @@ -82,7 +82,7 @@ #define HEATER_0_PIN PA2 // HOTEND MOSFET #define HEATER_BED_PIN PA0 // BED MOSFET -#define FAN_PIN PA1 // FAN1 header on board - PRINT FAN +#define FAN0_PIN PA1 // FAN1 header on board - PRINT FAN // // Misc. diff --git a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h index ed602d8d011e..7c8906e59943 100644 --- a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h +++ b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h @@ -88,18 +88,16 @@ #define E0_DIR_PIN PB14 // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB5 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB4 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB3 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB5 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB4 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB3 #endif #if HAS_TMC_UART @@ -142,7 +140,7 @@ // #define HEATER_0_PIN PB12 // "HE" #define HEATER_BED_PIN PB13 // "HB" -#define FAN_PIN PA8 // "FAN0" +#define FAN0_PIN PA8 // "FAN0" #define HEATER_1_PIN PA12 // diff --git a/Marlin/src/pins/stm32f1/pins_SOVOL_V131.h b/Marlin/src/pins/stm32f1/pins_SOVOL_V131.h new file mode 100644 index 000000000000..ba8a563f39c0 --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_SOVOL_V131.h @@ -0,0 +1,236 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * Sovol 1.3.1 (GD32F103RET6) board pin assignments + */ + +#include "env_validate.h" + +#if HOTENDS > 1 || E_STEPPERS > 1 + #error "SOVOL V131 only supports 1 hotend / E-stepper." +#endif + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Sovol V131" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Sovol SV06" +#endif + +//#define BOARD_NO_NATIVE_USB + +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#ifndef DISABLE_DEBUG + #define DISABLE_DEBUG +#endif + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + //#define SDCARD_EEPROM_EMULATION + #undef NO_EEPROM_SELECTED +#endif + +#if ENABLED(IIC_BL24CXX_EEPROM) + #define IIC_EEPROM_SDA PA11 + #define IIC_EEPROM_SCL PA12 + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) +#elif ENABLED(SDCARD_EEPROM_EMULATION) + #define MARLIN_EEPROM_SIZE 0x800 // 2K +#endif + +// +// Servos +// +#ifndef SERVO0_PIN + #ifndef HAS_PIN_27_BOARD + #define SERVO0_PIN PB0 // BLTouch OUT + #else + #define SERVO0_PIN PC6 + #endif +#endif + +// +// Limit Switches +// +#ifndef X_STOP_PIN + #define X_STOP_PIN PA5 +#endif +#ifndef Y_STOP_PIN + #define Y_STOP_PIN PA6 +#endif +#ifndef Z_STOP_PIN + #define Z_STOP_PIN PA7 +#endif + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PB1 // BLTouch IN +#endif + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // "Pulled-high" +#endif + +// +// Steppers +// +#ifndef X_STEP_PIN + #define X_STEP_PIN PC2 +#endif +#ifndef X_DIR_PIN + #define X_DIR_PIN PB9 +#endif +#define X_ENABLE_PIN PC3 // Shared + +#ifndef Y_STEP_PIN + #define Y_STEP_PIN PB8 +#endif +#ifndef Y_DIR_PIN + #define Y_DIR_PIN PB7 +#endif +#define Y_ENABLE_PIN X_ENABLE_PIN + +#ifndef Z_STEP_PIN + #define Z_STEP_PIN PB6 +#endif +#ifndef Z_DIR_PIN + #define Z_DIR_PIN PB5 +#endif +#define Z_ENABLE_PIN X_ENABLE_PIN + +#ifndef E0_STEP_PIN + #define E0_STEP_PIN PB4 +#endif +#ifndef E0_DIR_PIN + #define E0_DIR_PIN PB3 +#endif +#define E0_ENABLE_PIN X_ENABLE_PIN + +#if HAS_TMC_UART + + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + + #define X_SERIAL_TX_PIN PC1 + #define X_SERIAL_RX_PIN PC1 + + #define Y_SERIAL_TX_PIN PC0 + #define Y_SERIAL_RX_PIN PC0 + + #define Z_SERIAL_TX_PIN PA15 + #define Z_SERIAL_RX_PIN PA15 + + #define E0_SERIAL_TX_PIN PC14 + #define E0_SERIAL_RX_PIN PC14 + + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 + +#endif // HAS_TMC_UART + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC5 // TH1 +#define TEMP_BED_PIN PC4 // TB1 + +// +// Heaters / Fans +// +#ifndef HEATER_0_PIN + #define HEATER_0_PIN PA1 // HEATER1 +#endif +#ifndef HEATER_BED_PIN + #define HEATER_BED_PIN PA2 // HOT BED +#endif +#ifndef FAN0_PIN + #define FAN0_PIN PA0 // FAN +#endif +#define FAN_SOFT_PWM_REQUIRED + +// +// SD Card +// +#define SD_DETECT_PIN PC7 +#define SDCARD_CONNECTION ONBOARD +#define ONBOARD_SPI_DEVICE 1 +#define ONBOARD_SD_CS_PIN PA4 // SDSS +#define SDIO_SUPPORT +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + +#if ANY(RET6_12864_LCD, HAS_DWIN_E3V2, IS_DWIN_MARLINUI) + /** + * RET6 12864 LCD + * ------ + * PC6 | 1 2 | PB2 + * PB10 | 3 4 | PB11 + * PB14 5 6 | PB13 + * PB12 | 7 8 | PB15 + * GND | 9 10 | 5V + * ------ + */ + #define EXP3_01_PIN PC6 + #define EXP3_02_PIN PB2 + #define EXP3_03_PIN PB10 + #define EXP3_04_PIN PB11 + #define EXP3_05_PIN PB14 + #define EXP3_06_PIN PB13 + #define EXP3_07_PIN PB12 + #define EXP3_08_PIN PB15 +#endif + +#if ENABLED(CR10_STOCKDISPLAY) + + #if ENABLED(RET6_12864_LCD) + + #define LCD_PINS_RS EXP3_07_PIN + #define LCD_PINS_ENABLE EXP3_08_PIN + #define LCD_PINS_D4 EXP3_06_PIN + + #define BTN_ENC EXP3_02_PIN + #define BTN_EN1 EXP3_03_PIN + #define BTN_EN2 EXP3_05_PIN + + #ifndef HAS_PIN_27_BOARD + #define BEEPER_PIN EXP3_01_PIN + #endif + + #else + + #error "Only the RET6_12864_LCD variant of CR10_STOCKDISPLAY is supported." + + #endif + +#endif diff --git a/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h b/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h index eee7dbf31669..61cb563575be 100644 --- a/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h @@ -86,8 +86,8 @@ //#define HEATER_BED2_PIN -1 // BED2 //#define HEATER_BED3_PIN -1 // BED3 -#ifndef FAN_PIN - #define FAN_PIN PD14 +#ifndef FAN0_PIN + #define FAN0_PIN PD14 #endif #define FAN1_PIN PD13 diff --git a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h index 73f61c1aca70..d2f3645d94ef 100644 --- a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h @@ -117,7 +117,7 @@ // Fans // #define CONTROLLER_FAN_PIN PD6 // FAN -#define FAN_PIN PG13 // FAN +#define FAN0_PIN PG13 // FAN #define FAN1_PIN PG14 // FAN // @@ -153,8 +153,6 @@ #define TFT_RS_PIN FSMC_RS_PIN #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define ANYCUBIC_TFT35 #else diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h index 1347a1467882..fe4fa49f8f40 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h @@ -39,7 +39,7 @@ // Zonestar ZM3E2 V1.0 (STM32F103RCT6) board pin assignments //============================================================================= // PA0 PWR_HOLD | PB0 BEEP | PC0 HEATER_0 -// PA1 FAN_PIN | PB1 KILL | PC1 HEATER_BED +// PA1 FAN0_PIN | PB1 KILL | PC1 HEATER_BED // PA2 TX2 | PB2 LCD_SDA | PC2 TEMP_BED // PA3 RX2 | PB3 E1_EN | PC3 TEMP_E0 // PA4 SD_CS | PB4 Z_STOP | PC4 SD_DETECT @@ -149,7 +149,7 @@ #define HEATER_BED_PIN PC1 // BED #define FAN1_PIN PC6 -#define FAN_PIN PA1 +#define FAN0_PIN PA1 // // Temperature Sensors diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h index 9618b3ad1abb..c6192191e172 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h @@ -249,7 +249,7 @@ #define HEATER_1_PIN PB0 // HEATER1 #endif -#define FAN_PIN PB1 // FAN1 +#define FAN0_PIN PB1 // FAN1 #define FAN1_PIN PB8 // FAN2 // diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h index d1d8a4c68fcf..b8d72061df1d 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h @@ -249,7 +249,7 @@ // // Fans // -#define FAN_PIN PB1 // FAN1 +#define FAN0_PIN PB1 // FAN1 #define FAN1_PIN PB8 // FAN2 // diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 01ca4560fe4a..347ef8451dcf 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -123,7 +123,7 @@ // // Fans // -#define FAN_PIN PE3 // Layer fan +#define FAN0_PIN PE3 // Layer fan #define FAN1_PIN PE1 // Hotend fan #ifndef E0_AUTO_FAN_PIN @@ -206,6 +206,7 @@ #if DISABLED(SDIO_SUPPORT) #define SOFTWARE_SPI #define SDSS PC11 + #define SD_SS_PIN SDSS #define SD_SCK_PIN PC12 #define SD_MISO_PIN PC8 #define SD_MOSI_PIN PD2 diff --git a/Marlin/src/pins/stm32f4/pins_ARMED.h b/Marlin/src/pins/stm32f4/pins_ARMED.h index 2abcc21da5a4..6ae2674488eb 100644 --- a/Marlin/src/pins/stm32f4/pins_ARMED.h +++ b/Marlin/src/pins/stm32f4/pins_ARMED.h @@ -128,7 +128,7 @@ #define HEATER_1_PIN PA2 // Hardware PWM #define HEATER_BED_PIN PA0 // Hardware PWM -#define FAN_PIN PC6 // Hardware PWM, Part cooling fan +#define FAN0_PIN PC6 // Hardware PWM, Part cooling fan #define FAN1_PIN PC7 // Hardware PWM, Extruder fan #define FAN2_PIN PC8 // Hardware PWM, Controller fan diff --git a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h index 7413b9b0645a..4c0b7d54b717 100644 --- a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h +++ b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h @@ -100,8 +100,8 @@ #ifndef HEATER_BED_PIN #define HEATER_BED_PIN PA8 // Hotbed #endif -#ifndef FAN_PIN - #define FAN_PIN PC8 // Fan0 +#ifndef FAN0_PIN + #define FAN0_PIN PC8 // Fan0 #endif #ifndef FAN1_PIN #define FAN1_PIN PC7 // Fan1 diff --git a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h index c49abca9ef85..b42bcf5de3c4 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h +++ b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h @@ -101,7 +101,7 @@ #define HEATER_1_PIN PA3 // Heater1 #define HEATER_BED_PIN PA1 // Hotbed -#define FAN_PIN PE9 // Fan0 +#define FAN0_PIN PE9 // Fan0 #define FAN1_PIN PE11 // Fan1 #define FAN2_PIN PE13 // Fan2 #define FAN3_PIN PE14 // Fan3 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index 2147dd9b4fa7..fdd56b5c9ea3 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -108,18 +108,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB15 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB14 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB13 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 #endif #if HAS_TMC_UART @@ -172,11 +170,11 @@ #define HEATER_0_PIN PE6 // Heater0 #define HEATER_BED_PIN PE5 // Hotbed -#ifndef FAN_PIN +#ifndef FAN0_PIN #ifdef MK3_FAN_PINS - #define FAN_PIN PB8 // Fan1 + #define FAN0_PIN PB8 // Fan1 #else - #define FAN_PIN PB9 // Fan0 + #define FAN0_PIN PB9 // Fan0 #endif #endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h index c29949e814c3..73f943c3fad7 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h @@ -159,7 +159,7 @@ #define HEATER_1_PIN FPC16_PIN // "HE1" #endif -#define FAN_PIN PB5 // "FAN0" +#define FAN0_PIN PB5 // "FAN0" #ifndef CONTROLLER_FAN_PIN #define CONTROLLER_FAN_PIN PB6 // "FAN1" @@ -390,15 +390,16 @@ #error "SD CUSTOM_CABLE is not compatible with BTT E3 RRF." #endif -// -// WIFI -// - -#define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this -#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 -#define ESP_WIFI_MODULE_RESET_PIN PA4 -#define ESP_WIFI_MODULE_ENABLE_PIN PA5 -#define ESP_WIFI_MODULE_GPIO0_PIN PA6 +#if ENABLED(WIFISUPPORT) + // + // WIFI + // + #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PA4 + #define ESP_WIFI_MODULE_ENABLE_PIN PA5 + #define ESP_WIFI_MODULE_GPIO0_PIN PA6 +#endif #if ENABLED(BTT_E3_RRF_IDEX_BOARD) #define FPC2_PIN PB11 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index fe03ec8983ff..a21eaefee829 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -202,18 +202,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PG15 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB6 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB3 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PG15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB6 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB3 #endif #if HAS_TMC_UART @@ -304,9 +302,9 @@ //#define TEMP_0_MOSI_PIN ... // For MAX31865 #define TEMP_1_CS_PIN PH2 // M5 K-TEMP -#define TEMP_1_SCK_PIN TEMP_0_SCK_PIN -#define TEMP_1_MISO_PIN TEMP_0_MISO_PIN -//#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN +#define TEMP_1_SCK_PIN TEMP_0_SCK_PIN +#define TEMP_1_MISO_PIN TEMP_0_MISO_PIN +//#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN // // Heaters / Fans @@ -325,7 +323,7 @@ #define HEATER_BED_PIN PA2 // Hotbed -#define FAN_PIN PE5 // Fan0 +#define FAN0_PIN PE5 // Fan0 #define FAN1_PIN PE6 // Fan1 #define FAN2_PIN PC8 // Fan2 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 b3d97ae059e4..78766b5c98b0 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -27,13 +27,17 @@ #define USES_DIAG_JUMPERS // Onboard I2C EEPROM -#define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4K (AT24C32) -#define I2C_SCL_PIN PB8 -#define I2C_SDA_PIN PB9 +#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) + #undef NO_EEPROM_SELECTED + #define I2C_EEPROM + #define MARLIN_EEPROM_SIZE 0x1000 // 4K (AT24C32) + #define SOFT_I2C_EEPROM // Force the use of Software I2C + #define I2C_SCL_PIN PB8 + #define I2C_SDA_PIN PB9 +#endif // Avoid conflict with TIMER_TONE -#define STEP_TIMER 10 +#define STEP_TIMER 8 // // Servos @@ -70,13 +74,13 @@ #if HAS_EXTRA_ENDSTOPS #define _ENDSTOP_IS_ANY(ES) X2_USE_ENDSTOP == ES || Y2_USE_ENDSTOP == ES || Z2_USE_ENDSTOP == ES || Z3_USE_ENDSTOP == ES || Z4_USE_ENDSTOP == ES #if _ENDSTOP_IS_ANY(_XMIN_) || _ENDSTOP_IS_ANY(_XMAX_) - #define NEEDS_X_MINMAX 1 + #define NEEDS_X_MINMAX #endif #if _ENDSTOP_IS_ANY(_YMIN_) || _ENDSTOP_IS_ANY(_YMAX_) - #define NEEDS_Y_MINMAX 1 + #define NEEDS_Y_MINMAX #endif #if _ENDSTOP_IS_ANY(_ZMIN_) || _ENDSTOP_IS_ANY(_ZMAX_) - #define NEEDS_Z_MINMAX 1 + #define NEEDS_Z_MINMAX #endif #undef _ENDSTOP_IS_ANY #endif @@ -109,7 +113,7 @@ #else #define Y_MIN_PIN E1_DIAG_PIN // E1DET #endif -#elif NEEDS_Y_MINMAX +#elif ENABLED(NEEDS_Y_MINMAX) #ifndef Y_MIN_PIN #define Y_MIN_PIN Y_DIAG_PIN // Y-STOP #endif @@ -127,7 +131,7 @@ #else #define Z_MIN_PIN E2_DIAG_PIN // PWRDET #endif -#elif NEEDS_Z_MINMAX +#elif ENABLED(NEEDS_Z_MINMAX) #ifndef Z_MIN_PIN #define Z_MIN_PIN Z_DIAG_PIN // Z-STOP #endif @@ -138,10 +142,6 @@ #define Z_STOP_PIN Z_DIAG_PIN // Z-STOP #endif -#undef NEEDS_X_MINMAX -#undef NEEDS_Y_MINMAX -#undef NEEDS_Z_MINMAX - // // Filament Runout Sensor // @@ -241,7 +241,7 @@ #define HEATER_2_PIN PB10 // Heater2 #define HEATER_3_PIN PB11 // Heater3 -#define FAN_PIN PA8 // Fan0 +#define FAN0_PIN PA8 // Fan0 #define FAN1_PIN PE5 // Fan1 #define FAN2_PIN PD12 // Fan2 #define FAN3_PIN PD13 // Fan3 @@ -260,18 +260,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PA7 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PA6 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PA5 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PA7 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PA6 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PA5 #endif #if HAS_TMC_UART @@ -544,26 +542,28 @@ #define NEOPIXEL_PIN PB0 #endif -// -// WIFI -// +#if ENABLED(WIFISUPPORT) + // + // WIFI + // -/** - * ------- - * GND | 9 | | 8 | 3.3V - * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) - * 3.3V | 11 | | 6 | PB14 (ESP-MISO) - * (ESP-IO0) PD7 | 12 | | 5 | PB13 (ESP-CLK) - * (ESP-IO4) PD10 | 13 | | 4 | -- - * -- | 14 | | 3 | PE15 (ESP-EN) - * (ESP-RX) PD8 | 15 | | 2 | -- - * (ESP-TX) PD9 | 16 | | 1 | PE14 (ESP-RST) - * ------- - * WIFI - */ -#define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this -#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 -#define ESP_WIFI_MODULE_RESET_PIN PG7 -#define ESP_WIFI_MODULE_ENABLE_PIN PG8 -#define ESP_WIFI_MODULE_GPIO0_PIN PD7 -#define ESP_WIFI_MODULE_GPIO4_PIN PD10 + /** + * ------- + * GND | 9 | | 8 | 3.3V + * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) + * 3.3V | 11 | | 6 | PB14 (ESP-MISO) + * (ESP-IO0) PD7 | 12 | | 5 | PB13 (ESP-CLK) + * (ESP-IO4) PD10 | 13 | | 4 | -- + * -- | 14 | | 3 | PE15 (ESP-EN) + * (ESP-RX) PD8 | 15 | | 2 | -- + * (ESP-TX) PD9 | 16 | | 1 | PE14 (ESP-RST) + * ------- + * WIFI + */ + #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PG7 + #define ESP_WIFI_MODULE_ENABLE_PIN PG8 + #define ESP_WIFI_MODULE_GPIO0_PIN PD7 + #define ESP_WIFI_MODULE_GPIO4_PIN PD10 +#endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h index 31551f6ff6f4..d3a04b9d0715 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h @@ -146,7 +146,7 @@ // #define HEATER_0_PIN PA15 // "HE" #define HEATER_BED_PIN PB3 // "HB" -#define FAN_PIN PC9 // "FAN0" +#define FAN0_PIN PC9 // "FAN0" #define FAN1_PIN PA8 // "FAN1" #define FAN2_PIN PC8 // "FAN2" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index 78a137b35d4d..0cdd34aaeec1 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -172,18 +172,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PC12 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PC11 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PC10 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PC12 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PC11 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PC10 #endif #if HAS_TMC_UART @@ -291,7 +289,7 @@ // // Fans // -#define FAN_PIN PC8 // Fan0 +#define FAN0_PIN PC8 // Fan0 #define FAN1_PIN PE5 // Fan1 #ifndef E0_AUTO_FAN_PIN @@ -487,7 +485,7 @@ #define DOGLCD_A0 EXP1_06_PIN #define DOGLCD_SCK EXP1_04_PIN #define DOGLCD_MOSI EXP1_02_PIN - #define LCD_BACKLIGHT_PIN -1 + #define LCD_BACKLIGHT_PIN -1 #else @@ -547,22 +545,24 @@ #endif #endif -// -// WIFI -// +#if ENABLED(WIFISUPPORT) + // + // WIFI + // -/** - * ------ - * RX | 8 7 | 3.3V GPIO0 PF14 ... Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating) - * GPIO0 | 6 5 | Reset GPIO2 PF15 ... must be high (ESP3D software configures this with a pullup so OK to leave as floating) - * GPIO2 | 4 3 | Enable Reset PG0 ... active low, probably OK to leave floating - * GND | 2 1 | TX Enable PG1 ... Must be high for module to run - * ------ - * W1 - */ -#define ESP_WIFI_MODULE_COM 6 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this -#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 -#define ESP_WIFI_MODULE_RESET_PIN PG0 -#define ESP_WIFI_MODULE_ENABLE_PIN PG1 -#define ESP_WIFI_MODULE_GPIO0_PIN PF14 -#define ESP_WIFI_MODULE_GPIO2_PIN PF15 + /** + * ------ + * RX | 8 7 | 3.3V GPIO0 PF14 ... Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating) + * GPIO0 | 6 5 | Reset GPIO2 PF15 ... must be high (ESP3D software configures this with a pullup so OK to leave as floating) + * GPIO2 | 4 3 | Enable Reset PG0 ... active low, probably OK to leave floating + * GND | 2 1 | TX Enable PG1 ... Must be high for module to run + * ------ + * W1 + */ + #define ESP_WIFI_MODULE_COM 6 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PG0 + #define ESP_WIFI_MODULE_ENABLE_PIN PG1 + #define ESP_WIFI_MODULE_GPIO0_PIN PF14 + #define ESP_WIFI_MODULE_GPIO2_PIN PF15 +#endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index 7ac9156f405b..95b20c105d22 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -251,8 +251,8 @@ #ifndef HEATER_BED_PIN #define HEATER_BED_PIN PD7 // Hotbed #endif -#ifndef FAN_PIN - #define FAN_PIN PB7 // Fan0 +#ifndef FAN0_PIN + #define FAN0_PIN PB7 // Fan0 #endif #if HAS_CUTTER @@ -272,18 +272,16 @@ #endif // SPINDLE_FEATURE || LASER_FEATURE // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PE14 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PA14 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PE15 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PE14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PA14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PE15 #endif #if HAS_TMC_UART @@ -556,25 +554,27 @@ #define NEOPIXEL_PIN PE6 #endif -// -// WIFI -// +#if ENABLED(WIFISUPPORT) + // + // WIFI + // -/** - * ------- - * GND | 9 | | 8 | 3.3V - * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) - * 3.3V | 11 | | 6 | PB14 (ESP-MISO) - * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) - * (ESP-IO4) PB11 | 13 | | 4 | -- - * -- | 14 | | 3 | 3.3V (ESP-EN) - * (ESP-RX) PD8 | 15 | | 2 | -- - * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) - * ------- - * WIFI - */ -#define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this -#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 -#define ESP_WIFI_MODULE_RESET_PIN PC14 -#define ESP_WIFI_MODULE_GPIO0_PIN PB10 -#define ESP_WIFI_MODULE_GPIO4_PIN PB11 + /** + * ------- + * GND | 9 | | 8 | 3.3V + * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) + * 3.3V | 11 | | 6 | PB14 (ESP-MISO) + * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) + * (ESP-IO4) PB11 | 13 | | 4 | -- + * -- | 14 | | 3 | 3.3V (ESP-EN) + * (ESP-RX) PD8 | 15 | | 2 | -- + * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) + * ------- + * WIFI + */ + #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PC14 + #define ESP_WIFI_MODULE_GPIO0_PIN PB10 + #define ESP_WIFI_MODULE_GPIO4_PIN PB11 +#endif diff --git a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h index 8d5e094122f4..24419cfd1bd2 100644 --- a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h +++ b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h @@ -166,8 +166,8 @@ #define HEATER_5_PIN PE3 #define HEATER_BED_PIN PE2 -#ifndef FAN_PIN - #define FAN_PIN PF8 +#ifndef FAN0_PIN + #define FAN0_PIN PF8 #endif #define FAN1_PIN PF9 #define FAN2_PIN PA2 @@ -235,18 +235,16 @@ #endif // -// Trinamic Software SPI +// Trinamic SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_SCK - #define TMC_SW_SCK EXP2_02_PIN - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO EXP2_01_PIN - #endif - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI EXP2_06_PIN - #endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK EXP2_02_PIN +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO EXP2_01_PIN +#endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI EXP2_06_PIN #endif // diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h b/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h index 32ec518bf849..a7b7c079c3f7 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h @@ -43,22 +43,24 @@ #define FLASH_ADDRESS_START 0x8004000 #endif +#define SERVO0_PIN PB1 // BL-TOUCH/PWM + // -// Z Probe +// Limit Switches // -#if ENABLED(BLTOUCH) - #error "You need to set jumper to 5v for Bltouch, then comment out this line to proceed." - #define SERVO0_PIN PA0 -#elif !defined(Z_MIN_PROBE_PIN) - #define Z_MIN_PROBE_PIN PA0 -#endif +#define X_STOP_PIN PB4 // X-MIN +#define Y_STOP_PIN PC8 // Y-MIN +#define Z_STOP_PIN PA0 // Z-MIN // -// Limit Switches +// Z Probe // -#define X_STOP_PIN PB4 -#define Y_STOP_PIN PC8 -#define Z_STOP_PIN PB1 +#if ENABLED(BLTOUCH) + #error "You need to set jumper to 5V for BLTouch, then comment out this line to proceed." +#endif +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PB1 // BL-TOUCH/PWM repurposed +#endif // // Filament runout @@ -110,8 +112,8 @@ // #define HEATER_0_PIN PC6 #define HEATER_BED_PIN PC7 -#ifndef FAN_PIN - #define FAN_PIN PA14 +#ifndef FAN0_PIN + #define FAN0_PIN PA14 #endif #define FAN1_PIN PA13 #define FAN2_PIN PA1 diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index fca181c1f46a..49aab671c598 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -182,8 +182,8 @@ #define HEATER_BED_PIN PC8 #endif -#ifndef FAN_PIN - #define FAN_PIN PB0 +#ifndef FAN0_PIN + #define FAN0_PIN PB0 #endif #ifndef FAN1_PIN #define FAN1_PIN PB1 diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h index a9ce1383d8ca..a6035c2c6f01 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h @@ -53,19 +53,17 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // #define TMC_USE_SW_SPI -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PE14 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PE13 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PE12 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PE14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PE13 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PE12 #endif #include "pins_FYSETC_S6.h" diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h index 009bfb248dfe..368f464f86ca 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h @@ -101,19 +101,17 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // #define TMC_USE_SW_SPI -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PE14 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PE13 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PE12 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PE14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PE13 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PE12 #endif #if HOTENDS > 3 || E_STEPPERS > 3 diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_V2_2.h b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_V2_2.h index 50a19fa3d3c3..6ef86117e7f7 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_V2_2.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_V2_2.h @@ -28,7 +28,7 @@ #define TEMP_4_PIN PB1 #define TEMP_BED_PIN PB0 -#define FAN_PIN PA13 +#define FAN0_PIN PA13 #define FAN1_PIN PA14 #include "pins_FYSETC_SPIDER.h" diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 6c6f8d25ea39..547161367906 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -154,10 +154,10 @@ #ifndef EX_SERIAL_RX_PIN #define EX_SERIAL_RX_PIN EX_SERIAL_TX_PIN #endif - //#define Z2_SERIAL_RX_PIN EX_SERIAL_RX_PIN - //#define Z2_SERIAL_TX_PIN EX_SERIAL_TX_PIN - //#define E2_SERIAL_RX_PIN EX_SERIAL_RX_PIN - //#define E2_SERIAL_TX_PIN EX_SERIAL_TX_PIN + //#define Z2_SERIAL_RX_PIN EX_SERIAL_RX_PIN + //#define Z2_SERIAL_TX_PIN EX_SERIAL_TX_PIN + //#define E2_SERIAL_RX_PIN EX_SERIAL_RX_PIN + //#define E2_SERIAL_TX_PIN EX_SERIAL_TX_PIN // Reduce baud rate to improve software serial reliability #define TMC_BAUD_RATE 19200 #endif @@ -182,8 +182,8 @@ #define HEATER_1_PIN PA0 #define HEATER_BED_PIN PA2 -#ifndef FAN_PIN - #define FAN_PIN PF7 +#ifndef FAN0_PIN + #define FAN0_PIN PF7 #endif #define FAN1_PIN PF6 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 376c2f3f2734..180235019ad2 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -122,7 +122,7 @@ #define HEATER_1_PIN PA1 #define HEATER_BED_PIN PA3 -#define FAN_PIN PA15 // heater 0 fan 1 +#define FAN0_PIN PA15 // heater 0 fan 1 #define FAN1_PIN PB10 // heater 1 fan 2 #define FAN2_PIN PF5 // heater 0 fan 2 and heater 1 fan 1 (two sockets, switched together) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 6325697655ee..20985f263cd0 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -98,8 +98,8 @@ #define HEATER_1_PIN -1 #define HEATER_BED_PIN PA2 -//#ifndef FAN_PIN -// #define FAN_PIN PC15 +//#ifndef FAN0_PIN +// #define FAN0_PIN PC15 //#endif #define FAN1_PIN PC15 #define FAN2_PIN PA0 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h index 50fe790dc34d..7d6ea8e03947 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h @@ -39,7 +39,7 @@ // // Misc. Functions // -#define PW_DET PC5 // Y+ +#define PW_DET PC5 // Y+ #define PW_OFF PB12 // Z+ #define MT_DET_1_PIN PW_DET #define MT_DET_2_PIN PW_OFF diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h index 1896cd5441b3..1a7272222119 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h @@ -126,22 +126,23 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // This board only supports SW SPI for stepper drivers // #if HAS_TMC_SPI #define TMC_USE_SW_SPI #endif -#if ENABLED(TMC_USE_SW_SPI) - #if !defined(TMC_SW_MOSI) || TMC_SW_MOSI == -1 - #define TMC_SW_MOSI PE14 - #endif - #if !defined(TMC_SW_MISO) || TMC_SW_MISO == -1 - #define TMC_SW_MISO PE13 - #endif - #if !defined(TMC_SW_SCK) || TMC_SW_SCK == -1 - #define TMC_SW_SCK PE12 - #endif +#if !defined(TMC_SPI_MOSI) || TMC_SPI_MOSI == -1 + #undef TMC_SPI_MOSI + #define TMC_SPI_MOSI PE14 +#endif +#if !defined(TMC_SPI_MISO) || TMC_SPI_MISO == -1 + #undef TMC_SPI_MISO + #define TMC_SPI_MISO PE13 +#endif +#if !defined(TMC_SPI_SCK) || TMC_SPI_SCK == -1 + #undef TMC_SPI_SCK + #define TMC_SPI_SCK PE12 #endif #if HAS_TMC_UART @@ -193,7 +194,7 @@ #define HEATER_2_PIN PA3 // HE2 #define HEATER_BED_PIN PB10 // H-BED -#define FAN_PIN PA2 // FAN0 +#define FAN0_PIN PA2 // FAN0 #define FAN1_PIN PA1 // FAN1 #define FAN2_PIN PA0 // FAN2 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h index 2274d0c0dff3..15314c9ca65d 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h @@ -90,7 +90,7 @@ #define HEATER_0_PIN PF3 // Heater0 #define HEATER_1_PIN PF2 // Heater1 #define HEATER_BED_PIN PF4 // Hotbed -#define FAN_PIN PA7 // Fan0 +#define FAN0_PIN PA7 // Fan0 // // Misc. Functions diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index 32d8a47488b9..96e19c987f78 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -51,22 +51,23 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // This board only supports SW SPI for stepper drivers // #if HAS_TMC_SPI #define TMC_USE_SW_SPI #endif -#if ENABLED(TMC_USE_SW_SPI) - #if !defined(TMC_SW_MOSI) || TMC_SW_MOSI == -1 - #define TMC_SW_MOSI PD14 - #endif - #if !defined(TMC_SW_MISO) || TMC_SW_MISO == -1 - #define TMC_SW_MISO PD1 - #endif - #if !defined(TMC_SW_SCK) || TMC_SW_SCK == -1 - #define TMC_SW_SCK PD0 - #endif +#if !defined(TMC_SPI_MOSI) || TMC_SPI_MOSI == -1 + #undef TMC_SPI_MOSI + #define TMC_SPI_MOSI PD14 +#endif +#if !defined(TMC_SPI_MISO) || TMC_SPI_MISO == -1 + #undef TMC_SPI_MISO + #define TMC_SPI_MISO PD1 +#endif +#if !defined(TMC_SPI_SCK) || TMC_SPI_SCK == -1 + #undef TMC_SPI_SCK + #define TMC_SPI_SCK PD0 #endif #include "pins_MKS_ROBIN_NANO_V3_common.h" 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 42b252d320e7..a687cb9c9da5 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 @@ -133,7 +133,7 @@ #define HEATER_1_PIN PB0 // HEATER2 #define HEATER_BED_PIN PA0 // HOT BED -#define FAN_PIN PC14 // FAN +#define FAN0_PIN PC14 // FAN #define FAN1_PIN PB1 // FAN1 // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 14b3d6616830..8fdb41780574 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -113,18 +113,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PD14 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PD1 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PD0 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PD14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PD1 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PD0 #endif #if HAS_TMC_UART @@ -179,7 +177,7 @@ #define HEATER_1_PIN PB0 // HEATER2 #define HEATER_BED_PIN PA0 // HOT BED -#define FAN_PIN PB1 // FAN +#define FAN0_PIN PB1 // FAN // // Thermocouples @@ -238,23 +236,23 @@ * ------ ------ * EXP1 EXP2 */ -#define EXP1_01_PIN PC5 -#define EXP1_02_PIN PE13 -#define EXP1_03_PIN PD13 -#define EXP1_04_PIN PC6 -#define EXP1_05_PIN PE14 -#define EXP1_06_PIN PE15 -#define EXP1_07_PIN PD11 -#define EXP1_08_PIN PD10 - -#define EXP2_01_PIN PA6 -#define EXP2_02_PIN PA5 -#define EXP2_03_PIN PE8 -#define EXP2_04_PIN PE10 -#define EXP2_05_PIN PE11 -#define EXP2_06_PIN PA7 -#define EXP2_07_PIN PE12 -#define EXP2_08_PIN -1 // RESET +#define EXP1_01_PIN PC5 +#define EXP1_02_PIN PE13 +#define EXP1_03_PIN PD13 +#define EXP1_04_PIN PC6 +#define EXP1_05_PIN PE14 +#define EXP1_06_PIN PE15 +#define EXP1_07_PIN PD11 +#define EXP1_08_PIN PD10 + +#define EXP2_01_PIN PA6 +#define EXP2_02_PIN PA5 +#define EXP2_03_PIN PE8 +#define EXP2_04_PIN PE10 +#define EXP2_05_PIN PE11 +#define EXP2_06_PIN PA7 +#define EXP2_07_PIN PE12 +#define EXP2_08_PIN -1 // RESET // // LCD SD diff --git a/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h b/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h index d00b21c30b24..b03fc5419e01 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h @@ -59,13 +59,13 @@ #if HAS_EXTRA_ENDSTOPS #define _ENDSTOP_IS_ANY(ES) X2_USE_ENDSTOP == ES || Y2_USE_ENDSTOP == ES || Z2_USE_ENDSTOP == ES || Z3_USE_ENDSTOP == ES || Z4_USE_ENDSTOP == ES #if _ENDSTOP_IS_ANY(_XMIN_) || _ENDSTOP_IS_ANY(_XMAX_) - #define NEEDS_X_MINMAX 1 + #define NEEDS_X_MINMAX #endif #if _ENDSTOP_IS_ANY(_YMIN_) || _ENDSTOP_IS_ANY(_YMAX_) - #define NEEDS_Y_MINMAX 1 + #define NEEDS_Y_MINMAX #endif #if _ENDSTOP_IS_ANY(_ZMIN_) || _ENDSTOP_IS_ANY(_ZMAX_) - #define NEEDS_Z_MINMAX 1 + #define NEEDS_Z_MINMAX #endif #undef _ENDSTOP_IS_ANY #endif @@ -88,7 +88,7 @@ #ifdef Y_STALL_SENSITIVITY #define Y_STOP_PIN Y_DIAG_PIN // Y- -#elif NEEDS_Y_MINMAX +#elif ENABLED(NEEDS_Y_MINMAX) #ifndef Y_MIN_PIN #define Y_MIN_PIN Y_DIAG_PIN // Y- #endif @@ -101,7 +101,7 @@ #ifdef Z_STALL_SENSITIVITY #define Z_STOP_PIN Z_DIAG_PIN // Z- -#elif NEEDS_Z_MINMAX +#elif ENABLED(NEEDS_Z_MINMAX) #ifndef Z_MIN_PIN #define Z_MIN_PIN Z_DIAG_PIN // Z- #endif @@ -118,10 +118,6 @@ #endif #endif -#undef NEEDS_X_MINMAX -#undef NEEDS_Y_MINMAX -#undef NEEDS_Z_MINMAX - // // Steppers // @@ -190,19 +186,19 @@ #define HEATER_1_PIN PB0 // Heater1 #define HEATER_2_PIN PA3 // Heater2 -#define FAN_PIN PA2 // Fan0 +#define FAN0_PIN PA2 // Fan0 #define FAN1_PIN PA1 // Fan1 #define FAN2_PIN PA0 // Fan2 // -// Software SPI pins for TMC2130 stepper drivers -// This board doesn't support hardware SPI there +// Default pins for TMC software SPI +// This board only supports SW SPI for stepper drivers // #if HAS_TMC_SPI #define TMC_USE_SW_SPI - #define TMC_SW_MOSI PE14 - #define TMC_SW_MISO PE13 - #define TMC_SW_SCK PE12 + #define TMC_SPI_MOSI PE14 + #define TMC_SPI_MISO PE13 + #define TMC_SPI_SCK PE12 #endif // diff --git a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h index 06bf09402c06..eb6edb765ee8 100644 --- a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h +++ b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h @@ -151,7 +151,7 @@ // // Heaters / Fans // -#define FAN_PIN PE2 +#define FAN0_PIN PE2 #define FAN1_PIN PE3 #define FAN2_PIN PE4 #define FAN3_PIN PE5 @@ -171,9 +171,9 @@ #define MOSI_PIN PB5 #define SCK_PIN PB3 -#define TMC_SW_MISO MISO_PIN -#define TMC_SW_MOSI MOSI_PIN -#define TMC_SW_SCK SCK_PIN +#define TMC_SPI_MISO MISO_PIN +#define TMC_SPI_MOSI MOSI_PIN +#define TMC_SPI_SCK SCK_PIN // // I2C diff --git a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h index d16d7b200bd6..b44061a491ab 100644 --- a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h +++ b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h @@ -148,7 +148,7 @@ // // Heaters / Fans // -#define FAN_PIN PE2 +#define FAN0_PIN PE2 #define FAN1_PIN PE3 #define FAN2_PIN PE4 #define FAN3_PIN PE5 @@ -168,9 +168,9 @@ #define MOSI_PIN PB5 #define SCK_PIN PB3 -#define TMC_SW_MISO MISO_PIN -#define TMC_SW_MOSI MOSI_PIN -#define TMC_SW_SCK SCK_PIN +#define TMC_SPI_MISO MISO_PIN +#define TMC_SPI_MOSI MOSI_PIN +#define TMC_SPI_SCK SCK_PIN // // I2C diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h index 12871becbb40..ed4ba34266ec 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h @@ -91,16 +91,14 @@ #define E2_ENABLE_PIN PD0 #define E2_CS_PIN PD1 -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PA7 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PA6 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PA5 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PA7 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PA6 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PA5 #endif // @@ -120,7 +118,7 @@ #define HEATER_2_PIN PC8 #define HEATER_BED_PIN PA1 -#define FAN_PIN PC9 +#define FAN0_PIN PC9 #define FAN1_PIN PA8 // diff --git a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h index 4fb57985b993..b2fec3b8341d 100644 --- a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h +++ b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h @@ -162,8 +162,8 @@ // #define HEATER_BED_PIN PC9 #define HEATER_0_PIN PC8 -#ifndef FAN_PIN - #define FAN_PIN PC6 +#ifndef FAN0_PIN + #define FAN0_PIN PC6 #endif #define FAN1_PIN PC7 diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h index e3b9f7ef6e55..8d2584fe10b9 100644 --- a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h @@ -72,10 +72,10 @@ //#define SPI_FLASH #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x200000 // 2MB - #define W25QXX_CS_PIN PG15 // SPI2 - #define W25QXX_MOSI_PIN PB5 - #define W25QXX_MISO_PIN PB4 - #define W25QXX_SCK_PIN PB3 + #define SPI_FLASH_CS_PIN PG15 // SPI2 + #define SPI_FLASH_MOSI_PIN PB5 + #define SPI_FLASH_MISO_PIN PB4 + #define SPI_FLASH_SCK_PIN PB3 #endif // @@ -152,7 +152,7 @@ #define HEATER_BED_PIN PE2 // HOT BED //#define HEATER_BED_INVERTING true -#define FAN_PIN PG0 // FAN0 +#define FAN0_PIN PG0 // FAN0 #define FAN1_PIN PB6 // FAN1 #define FAN2_PIN PG9 // FAN2 #define FAN3_PIN PF10 // FAN3 @@ -200,8 +200,6 @@ #define TFT_BACKLIGHT_PIN PG8 #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 #define TFT_CS_PIN PG12 #define TFT_RS_PIN PG2 diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h index 21ab9d0e7019..eba63c5a5be6 100644 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h @@ -129,8 +129,8 @@ #define HEATER_1_PIN PD14 #define HEATER_BED_PIN PD12 -#ifndef FAN_PIN - #define FAN_PIN PD13 +#ifndef FAN0_PIN + #define FAN0_PIN PD13 #endif #define FAN1_PIN PB5 // PA0 #define FAN2_PIN PB4 // PA1 diff --git a/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h b/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h index 48f986e2ca70..6f5c179d1c57 100644 --- a/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h +++ b/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h @@ -154,8 +154,8 @@ #define HEATER_0_PIN PA15 // PWM Capable, TIM2_CH1 #define HEATER_BED_PIN PB3 // PWM Capable, TIM2_CH2 -#ifndef FAN_PIN - #define FAN_PIN PB10 // PWM Capable, TIM2_CH3 +#ifndef FAN0_PIN + #define FAN0_PIN PB10 // PWM Capable, TIM2_CH3 #endif #define FAN1_PIN PB11 // PWM Capable, TIM2_CH4 diff --git a/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h b/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h index c4feba692fd8..f13eba8ef341 100644 --- a/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h +++ b/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h @@ -95,8 +95,8 @@ #define HEATER_0_PIN 33 #define HEATER_BED_PIN 31 -#ifndef FAN_PIN - #define FAN_PIN 30 // "FAN1" +#ifndef FAN0_PIN + #define FAN0_PIN 30 // "FAN1" #endif #define FAN1_PIN 32 // "FAN2" diff --git a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h index cdd85a6d751c..c79f8ab0843d 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h @@ -44,7 +44,7 @@ #define FLASH_EEPROM_EMULATION #endif #define EEPROM_PAGE_SIZE (0x800UL) // 2K - #define EEPROM_START_ADDRESS (0x0801F800UL) + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 1UL) #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE #endif @@ -81,15 +81,15 @@ // Steppers // #define X_ENABLE_PIN -1 -#define X_STEP_PIN PA10 // Unused. Assigned so Marlin will compile +#define X_STEP_PIN PA10 // Unused. Assigned so Marlin will compile #define X_DIR_PIN -1 #define Y_ENABLE_PIN -1 -#define Y_STEP_PIN PA10 // Unused. Assigned so Marlin will compile +#define Y_STEP_PIN PA10 // Unused. Assigned so Marlin will compile #define Y_DIR_PIN -1 #define Z_ENABLE_PIN -1 -#define Z_STEP_PIN PA10 // Unused. Assigned so Marlin will compile +#define Z_STEP_PIN PA10 // Unused. Assigned so Marlin will compile #define Z_DIR_PIN -1 #define E0_ENABLE_PIN PD2 @@ -135,7 +135,7 @@ // Heaters / Fans // #define HEATER_0_PIN PA2 // "HE" -#define FAN_PIN PA0 // "FAN0" +#define FAN0_PIN PA0 // "FAN0" #define FAN1_PIN PA1 // "FAN1" // diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h index 54c2c4c77b2d..57e257a7ba14 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h @@ -143,18 +143,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PC12 // Shared with SPI header, Pin 5 (SPI3) - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PC11 // Shared with SPI header, Pin 6 (SPI3) - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PC10 // Shared with SPI header, Pin 4 (SPI3) - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PC12 // Shared with SPI header, Pin 5 (SPI3) +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PC11 // Shared with SPI header, Pin 6 (SPI3) +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PC10 // Shared with SPI header, Pin 4 (SPI3) #endif #if HAS_TMC_UART @@ -191,7 +189,7 @@ #define HEATER_1_PIN PB10 // "HE1" #define HEATER_BED_PIN PB2 // "HB" -#define FAN_PIN PA8 // "FAN0" +#define FAN0_PIN PA8 // "FAN0" #define FAN1_PIN PB15 // "FAN1" #define FAN2_PIN PB14 // "FAN2" diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h index 876475f88355..276c95114392 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h @@ -57,7 +57,7 @@ // #if ENABLED(PROBE_ENABLE_DISABLE) #ifndef PROBE_ENABLE_PIN - #define PROBE_ENABLE_PIN SERVO0_PIN + #define PROBE_ENABLE_PIN SERVO0_PIN #endif #endif @@ -112,18 +112,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB15 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB14 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB13 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 #endif #if HAS_TMC_UART @@ -155,7 +153,7 @@ #define HEATER_0_PIN PC8 // "HE" #define HEATER_BED_PIN PD8 // "HB" -#define FAN_PIN PD2 // "FAN0" +#define FAN0_PIN PD2 // "FAN0" #define FAN1_PIN PD3 // "FAN1" #define FAN2_PIN PD4 // "FAN2" diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h index f4ce5a16d3b0..737330d35107 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h @@ -79,8 +79,8 @@ // Z Probe (when not Z_STOP_PIN) // #ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN PC13 // PROBE - //#define Z_MIN_PROBE_PIN PC15 // IND-DET (with adjustable pullup set via jumper) + #define Z_MIN_PROBE_PIN PC13 // PROBE + //#define Z_MIN_PROBE_PIN PC15 // IND-DET (with adjustable pullup set via jumper) #endif // @@ -129,18 +129,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PB15 // Shared with SPI header, Pin 5 (SPI2) - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PB14 // Shared with SPI header, Pin 6 (SPI2) - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PB13 // Shared with SPI header, Pin 4 (SPI2) - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 // Shared with SPI header, Pin 5 (SPI2) +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 // Shared with SPI header, Pin 6 (SPI2) +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 // Shared with SPI header, Pin 4 (SPI2) #endif #if HAS_TMC_UART @@ -177,7 +175,7 @@ #define HEATER_1_PIN PA7 // "HE1" #define HEATER_BED_PIN PA5 // "HB" -#define FAN_PIN PA4 // "FAN0" +#define FAN0_PIN PA4 // "FAN0" #define FAN1_PIN PA3 // "FAN1" // diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h index 0d4a74b6f95c..2c778f873239 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h @@ -81,10 +81,10 @@ #if HAS_EXTRA_ENDSTOPS #define _ENDSTOP_IS_ANY(ES) X2_USE_ENDSTOP == ES || Y2_USE_ENDSTOP == ES || Z2_USE_ENDSTOP == ES || Z3_USE_ENDSTOP == ES || Z4_USE_ENDSTOP == ES #if _ENDSTOP_IS_ANY(_XMIN_) || _ENDSTOP_IS_ANY(_XMAX_) - #define NEEDS_X_MINMAX 1 + #define NEEDS_X_MINMAX #endif #if _ENDSTOP_IS_ANY(_YMIN_) || _ENDSTOP_IS_ANY(_YMAX_) - #define NEEDS_Y_MINMAX 1 + #define NEEDS_Y_MINMAX #endif #undef _ENDSTOP_IS_ANY #endif @@ -117,7 +117,7 @@ #else #define Y_MIN_PIN E1_DIAG_PIN // MIN6 #endif -#elif NEEDS_Y_MINMAX +#elif ENABLED(NEEDS_Y_MINMAX) #ifndef Y_MIN_PIN #define Y_MIN_PIN Y_DIAG_PIN // MIN2 #endif @@ -130,9 +130,6 @@ #define Z_STOP_PIN Z_DIAG_PIN // MIN3 -#undef NEEDS_X_MINMAX -#undef NEEDS_Y_MINMAX - // // Filament Runout Sensors // @@ -182,18 +179,16 @@ #endif // -// Software SPI pins for TMC2130 stepper drivers +// Default pins for TMC software SPI // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PA7 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PA6 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PA5 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PA7 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PA6 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PA5 #endif #if HAS_TMC_UART @@ -234,7 +229,7 @@ #define HEATER_2_PIN PB6 // HE2 #define HEATER_3_PIN PE1 // HE3 -#define FAN_PIN PE6 // FAN0 +#define FAN0_PIN PE6 // FAN0 #define FAN1_PIN PE0 // FAN1 #define FAN2_PIN PC12 // FAN2 #define FAN3_PIN PE5 // FAN3 diff --git a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h index f71b7b40ebd1..9be2357043c1 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h @@ -136,7 +136,7 @@ // #define HEATER_0_PIN PC8 // "HE" #define HEATER_BED_PIN PC9 // "HB" -#define FAN_PIN PC6 // "FAN0" +#define FAN0_PIN PC6 // "FAN0" #define FAN1_PIN PC7 // "FAN1" #define FAN2_PIN PB15 // "FAN2" diff --git a/Marlin/src/pins/stm32h7/env_validate.h b/Marlin/src/pins/stm32h7/env_validate.h new file mode 100644 index 000000000000..0c515e5df6be --- /dev/null +++ b/Marlin/src/pins/stm32h7/env_validate.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 NOT_TARGET(STM32H7) + #error "Oops! Select an STM32H7 board in 'Tools > Board.'" +#endif diff --git a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h new file mode 100644 index 000000000000..cc2dab0e16e5 --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h @@ -0,0 +1,545 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "env_validate.h" + +#define BOARD_INFO_NAME "OCTOPUS MAX EZ V1.0" + +#define USES_DIAG_JUMPERS + +// Onboard I2C EEPROM +#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) + #undef NO_EEPROM_SELECTED + #define I2C_EEPROM + #define SOFT_I2C_EEPROM // Force the use of Software I2C + #define I2C_SCL_PIN PB10 + #define I2C_SDA_PIN PB11 + #define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#endif + +// Avoid conflict with TIMER_TONE +#define STEP_TIMER 8 + +// +// Servos +// +#define SERVO0_PIN PB14 + +// +// Misc. Functions +// +#define LED_PIN PA14 + +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PF0 // M1-STOP +#define Y_DIAG_PIN PF2 // M2-STOP +#define Z_DIAG_PIN PF4 // M3-STOP +#define Z2_DIAG_PIN PF3 // M4-STOP +#define E0_DIAG_PIN PF1 // M5-STOP +#define E1_DIAG_PIN PC15 // M6-STOP +#define E2_DIAG_PIN PF12 // PWRDET + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PB15 +#endif + +// +// Check for additional used endstop pins +// +#if HAS_EXTRA_ENDSTOPS + #define _ENDSTOP_IS_ANY(ES) X2_USE_ENDSTOP == ES || Y2_USE_ENDSTOP == ES || Z2_USE_ENDSTOP == ES || Z3_USE_ENDSTOP == ES || Z4_USE_ENDSTOP == ES + #if _ENDSTOP_IS_ANY(_XMIN_) || _ENDSTOP_IS_ANY(_XMAX_) + #define NEEDS_X_MINMAX + #endif + #if _ENDSTOP_IS_ANY(_YMIN_) || _ENDSTOP_IS_ANY(_YMAX_) + #define NEEDS_Y_MINMAX + #endif + #if _ENDSTOP_IS_ANY(_ZMIN_) || _ENDSTOP_IS_ANY(_ZMAX_) + #define NEEDS_Z_MINMAX + #endif + #undef _ENDSTOP_IS_ANY +#endif + +// +// Limit Switches +// +#ifdef X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN + #if X_HOME_TO_MIN + #define X_MAX_PIN E0_DIAG_PIN // E0DET + #else + #define X_MIN_PIN E0_DIAG_PIN // E0DET + #endif +#elif EITHER(DUAL_X_CARRIAGE, NEEDS_X_MINMAX) + #ifndef X_MIN_PIN + #define X_MIN_PIN X_DIAG_PIN // X-STOP + #endif + #ifndef X_MAX_PIN + #define X_MAX_PIN E0_DIAG_PIN // E0DET + #endif +#else + #define X_STOP_PIN X_DIAG_PIN // X-STOP +#endif + +#ifdef Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN + #if Y_HOME_TO_MIN + #define Y_MAX_PIN E1_DIAG_PIN // E1DET + #else + #define Y_MIN_PIN E1_DIAG_PIN // E1DET + #endif +#elif ENABLED(NEEDS_Y_MINMAX) + #ifndef Y_MIN_PIN + #define Y_MIN_PIN Y_DIAG_PIN // Y-STOP + #endif + #ifndef Y_MAX_PIN + #define Y_MAX_PIN E1_DIAG_PIN // E1DET + #endif +#else + #define Y_STOP_PIN Y_DIAG_PIN // Y-STOP +#endif + +#ifdef Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN + #if Z_HOME_TO_MIN + #define Z_MAX_PIN E2_DIAG_PIN // PWRDET + #else + #define Z_MIN_PIN E2_DIAG_PIN // PWRDET + #endif +#elif ENABLED(NEEDS_Z_MINMAX) + #ifndef Z_MIN_PIN + #define Z_MIN_PIN Z_DIAG_PIN // Z-STOP + #endif + #ifndef Z_MAX_PIN + #define Z_MAX_PIN E2_DIAG_PIN // PWRDET + #endif +#else + #define Z_STOP_PIN Z_DIAG_PIN // Z-STOP +#endif + +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN PF1 // E0DET +#define FIL_RUNOUT2_PIN PF15 // E1DET + +// +// Power Supply Control +// +#ifndef PS_ON_PIN + #define PS_ON_PIN PF13 // PS-ON +#endif + +// +// Power Loss Detection +// +#ifndef POWER_LOSS_PIN + #define POWER_LOSS_PIN PF12 // PWRDET +#endif + +// +// Steppers +// +#define X_STEP_PIN PC13 // MOTOR 1 +#define X_DIR_PIN PC14 +#define X_ENABLE_PIN PE6 +#ifndef X_CS_PIN + #define X_CS_PIN PG14 +#endif + +#define Y_STEP_PIN PE4 // MOTOR 2 +#define Y_DIR_PIN PE5 +#define Y_ENABLE_PIN PE3 +#ifndef Y_CS_PIN + #define Y_CS_PIN PG13 +#endif + +#define Z_STEP_PIN PE1 // MOTOR 3 +#define Z_DIR_PIN PE0 +#define Z_ENABLE_PIN PE2 +#ifndef Z_CS_PIN + #define Z_CS_PIN PG12 +#endif + +#define Z2_STEP_PIN PB8 // MOTOR 4 +#define Z2_DIR_PIN PB9 +#define Z2_ENABLE_PIN PB7 +#ifndef Z2_CS_PIN + #define Z2_CS_PIN PG11 +#endif + +#define E0_STEP_PIN PB5 // MOTOR 5 +#define E0_DIR_PIN PB4 +#define E0_ENABLE_PIN PB6 +#ifndef E0_CS_PIN + #define E0_CS_PIN PG10 +#endif + +#define E1_STEP_PIN PG15 // MOTOR 6 +#define E1_DIR_PIN PB3 +#define E1_ENABLE_PIN PD5 +#ifndef E1_CS_PIN + #define E1_CS_PIN PG9 +#endif + +#define E2_STEP_PIN PD3 // MOTOR 7 +#define E2_DIR_PIN PD2 +#define E2_ENABLE_PIN PD4 +#ifndef E2_CS_PIN + #define E2_CS_PIN PD7 +#endif + +#define E3_STEP_PIN PA10 // MOTOR 8 +#define E3_DIR_PIN PA9 +#define E3_ENABLE_PIN PA15 +#ifndef E3_CS_PIN + #define E3_CS_PIN PD6 +#endif + +#define E4_STEP_PIN PA8 // MOTOR 9 +#define E4_DIR_PIN PC7 +#define E4_ENABLE_PIN PC9 +#ifndef E4_CS_PIN + #define E4_CS_PIN PG8 +#endif + +#define E5_STEP_PIN PG6 // MOTOR 10 +#define E5_DIR_PIN PC6 +#define E5_ENABLE_PIN PC8 +#ifndef E5_CS_PIN + #define E5_CS_PIN PG7 +#endif + +// +// Temperature Sensors +// +#define TEMP_BED_PIN PB1 // TB +#define TEMP_0_PIN PB0 // TH0 +#define TEMP_1_PIN PC5 // TH1 +#define TEMP_2_PIN PC4 // TH2 +#define TEMP_3_PIN PA7 // TH3 + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PF5 // Hotbed +#define HEATER_0_PIN PF6 // Heater0 +#define HEATER_1_PIN PA0 // Heater1 +#define HEATER_2_PIN PF9 // Heater2 +#define HEATER_3_PIN PF7 // Heater3 + +#define FAN0_PIN PA6 // Fan0 +#define FAN1_PIN PA5 // Fan1 +#define FAN2_PIN PA4 // Fan2 +#define FAN3_PIN PA3 // Fan3 +#define FAN4_PIN PA1 // 4 wire Fan4 +#define FAN5_PIN PF8 // 4 wire Fan5 +#define FAN6_PIN PA2 // 4 wire Fan6 + +// +// SD Support +// +#ifndef SDCARD_CONNECTION + #if HAS_WIRED_LCD + #define SDCARD_CONNECTION LCD + #else + #define SDCARD_CONNECTION ONBOARD + #endif +#endif + +// +// Default pins for TMC software SPI +// +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PE14 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PE13 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PE12 +#endif + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + #define X_SERIAL_TX_PIN PG14 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PG13 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PG12 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + + #define Z2_SERIAL_TX_PIN PG11 + #define Z2_SERIAL_RX_PIN Z2_SERIAL_TX_PIN + + #define E0_SERIAL_TX_PIN PG10 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + #define E1_SERIAL_TX_PIN PG9 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + + #define E2_SERIAL_TX_PIN PD7 + #define E2_SERIAL_RX_PIN E2_SERIAL_TX_PIN + + #define E3_SERIAL_TX_PIN PD6 + #define E3_SERIAL_RX_PIN E3_SERIAL_TX_PIN + + #define E4_SERIAL_TX_PIN PG8 + #define E4_SERIAL_RX_PIN E3_SERIAL_TX_PIN + + #define E5_SERIAL_TX_PIN PG7 + #define E5_SERIAL_RX_PIN E3_SERIAL_TX_PIN + + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 +#endif + +/** + * ---- + * (MISO) PE13 | 1 | + * (SCK) PE12 | 2 | + * (BTN_EN1) PG5 | 3 | + * (SD_SS) PE11 | 4 | + * (BTN_EN2) PG4 | 5 | + * (MOSI) PE14 | 6 | + * (SD_DETECT) PG3 | 7 | + * RESET | 8 | + * (BEEPER) PG2 | 9 | + * (BTN_ENC) PD15 | 10 | + * (LCD_EN) PD14 | 11 | + * (LCD_RS) PD13 | 12 | + * (LCD_D4) PD12 | 13 | + * (LCD_D5) PD11 | 14 | + * (LCD_D6) PD10 | 15 | + * (LCD_D7) PE15 | 16 | + * GND | 17 | + * 5V | 18 | + * ---- + * LCD + */ + +#define EXP1_01_PIN PG2 +#define EXP1_02_PIN PD15 +#define EXP1_03_PIN PD14 +#define EXP1_04_PIN PD13 +#define EXP1_05_PIN PD12 +#define EXP1_06_PIN PD11 +#define EXP1_07_PIN PD10 +#define EXP1_08_PIN PE15 + +#define EXP2_01_PIN PE13 +#define EXP2_02_PIN PE12 +#define EXP2_03_PIN PG5 +#define EXP2_04_PIN PE11 +#define EXP2_05_PIN PG4 +#define EXP2_06_PIN PE14 +#define EXP2_07_PIN PG3 +#define EXP2_08_PIN -1 + +// +// Onboard SD card +// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 +// +#if SD_CONNECTION_IS(ONBOARD) + #ifndef SD_DETECT_STATE + #define SD_DETECT_STATE HIGH + #elif SD_DETECT_STATE == LOW + #error "BOARD_BTT_OCTOPUS_MAX_EZ onboard SD requires SD_DETECT_STATE set to HIGH." + #endif + #define SDSS PB12 + #define SD_SS_PIN SDSS + #define SD_SCK_PIN PE12 + #define SD_MISO_PIN PE13 + #define SD_MOSI_PIN PE14 + #define SD_DETECT_PIN PB13 + #define SOFTWARE_SPI +#elif SD_CONNECTION_IS(LCD) + #define SDSS EXP2_04_PIN + #define SD_SS_PIN SDSS + #define SD_SCK_PIN EXP2_02_PIN + #define SD_MISO_PIN EXP2_01_PIN + #define SD_MOSI_PIN EXP2_06_PIN + #define SD_DETECT_PIN EXP2_07_PIN + #define SOFTWARE_SPI +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board" +#endif + +// +// LCDs and Controllers +// +#if IS_TFTGLCD_PANEL + + #if ENABLED(TFTGLCD_PANEL_SPI) + #define TFTGLCD_CS EXP2_03_PIN + #endif + +#elif HAS_WIRED_LCD + + #define BEEPER_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN + + #if ENABLED(CR10_STOCKDISPLAY) + + #define LCD_PINS_RS EXP1_07_PIN + + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN + + #else + + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #define LCD_PINS_ENABLE EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_SCK EXP2_02_PIN + #define DOGLCD_MOSI EXP2_06_PIN + + #define SOFTWARE_SPI + #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems + // results in LCD soft SPI mode 3, SD soft SPI mode 0 + //#define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. + #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN EXP1_06_PIN + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN EXP1_07_PIN + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN EXP1_08_PIN + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN EXP1_06_PIN + #endif + #endif // !FYSETC_MINI_12864 + + #if IS_ULTIPANEL + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_PIN + + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #endif + + #endif + + #endif +#endif // HAS_WIRED_LCD + +// Alter timing for graphical display +#if IS_U8GLIB_ST7920 + #define BOARD_ST7920_DELAY_1 120 + #define BOARD_ST7920_DELAY_2 80 + #define BOARD_ST7920_DELAY_3 580 +#endif + +#if HAS_SPI_TFT + #define TFT_CS_PIN EXP2_04_PIN + #define TFT_A0_PIN EXP2_07_PIN + #define TFT_SCK_PIN EXP2_02_PIN + #define TFT_MISO_PIN EXP2_01_PIN + #define TFT_MOSI_PIN EXP2_06_PIN + + #define TOUCH_INT_PIN EXP1_07_PIN + #define TOUCH_MISO_PIN EXP1_06_PIN + #define TOUCH_MOSI_PIN EXP1_03_PIN + #define TOUCH_SCK_PIN EXP1_05_PIN + #define TOUCH_CS_PIN EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + #define BTN_ENC EXP1_02_PIN +#endif + +// +// NeoPixel LED +// +#ifndef NEOPIXEL_PIN + #define NEOPIXEL_PIN PE10 +#endif + +#ifndef NEOPIXEL2_PIN + #define NEOPIXEL2_PIN PE9 +#endif + +#if ENABLED(WIFISUPPORT) + // + // WIFI + // + + /** + * ------- + * GND | 9 | | 8 | 3.3V + * (ESP-CS) PG1 | 10 | | 7 | PB15 (ESP-MOSI) + * 3.3V | 11 | | 6 | PB14 (ESP-MISO) + * (ESP-IO0) PG0 | 12 | | 5 | PB13 (ESP-CLK) + * (ESP-IO4) PF15 | 13 | | 4 | -- + * -- | 14 | | 3 | 3.3V (ESP-EN) + * (ESP-RX) PE7 | 15 | | 2 | -- + * (ESP-TX) PE8 | 16 | | 1 | PB2 (ESP-RST) + * ------- + * WIFI + */ + #define ESP_WIFI_MODULE_COM 7 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PB2 + #define ESP_WIFI_MODULE_GPIO0_PIN PG0 + #define ESP_WIFI_MODULE_GPIO4_PIN PF15 +#endif 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 1ee7846c9315..7f5f5269d142 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 @@ -21,9 +21,7 @@ */ #pragma once -#if NOT_TARGET(STM32H7) - #error "Oops! Select an STM32H7 board in 'Tools > Board.'" -#endif +#include "env_validate.h" #define DEFAULT_MACHINE_NAME "Biqu BX" @@ -93,18 +91,16 @@ #define E1_CS_PIN PC8 // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PC6 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PG3 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PC7 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PC6 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PG3 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PC7 #endif #if HAS_TMC_UART @@ -162,7 +158,7 @@ #define HEATER_1_PIN PC5 #define HEATER_BED_PIN PA4 -#define FAN_PIN PA5 // "FAN0" +#define FAN0_PIN PA5 // "FAN0" #define FAN1_PIN PA6 // "FAN1" #define FAN2_PIN PA7 // "FAN2" diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h index eaceafe29ee3..97ac32479e11 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -21,9 +21,7 @@ */ #pragma once -#if NOT_TARGET(STM32H7) - #error "Oops! Select an STM32H7 board in 'Tools > Board.'" -#endif +#include "env_validate.h" // If you have the BigTreeTech driver expansion module, enable BTT_MOTOR_EXPANSION // https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT @@ -241,8 +239,8 @@ #ifndef HEATER_BED_PIN #define HEATER_BED_PIN PD7 // Hotbed #endif -#ifndef FAN_PIN - #define FAN_PIN PB7 // Fan0 +#ifndef FAN0_PIN + #define FAN0_PIN PB7 // Fan0 #endif #if HAS_CUTTER @@ -262,18 +260,16 @@ #endif // SPINDLE_FEATURE || LASER_FEATURE // -// Software SPI pins for TMC2130 stepper drivers +// SPI pins for TMC2130 stepper drivers // -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI PE13 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO PE15 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK PE14 - #endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PE13 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PE15 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PE14 #endif #if HAS_TMC_UART @@ -545,25 +541,27 @@ #define NEOPIXEL_PIN PE6 #endif -// -// WIFI -// +#if ENABLED(WIFISUPPORT) + // + // WIFI + // -/** - * ------- - * GND | 9 | | 8 | 3.3V - * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) - * 3.3V | 11 | | 6 | PB14 (ESP-MISO) - * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) - * (ESP-IO4) PB11 | 13 | | 4 | -- - * -- | 14 | | 3 | 3.3V (ESP-EN) - * (ESP-RX) PD8 | 15 | | 2 | -- - * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) - * ------- - * WIFI - */ -#define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this -#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 -#define ESP_WIFI_MODULE_RESET_PIN PC14 -#define ESP_WIFI_MODULE_GPIO0_PIN PB10 -#define ESP_WIFI_MODULE_GPIO4_PIN PB11 + /** + * ------- + * GND | 9 | | 8 | 3.3V + * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) + * 3.3V | 11 | | 6 | PB14 (ESP-MISO) + * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) + * (ESP-IO4) PB11 | 13 | | 4 | -- + * -- | 14 | | 3 | 3.3V (ESP-EN) + * (ESP-RX) PD8 | 15 | | 2 | -- + * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) + * ------- + * WIFI + */ + #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PC14 + #define ESP_WIFI_MODULE_GPIO0_PIN PB10 + #define ESP_WIFI_MODULE_GPIO4_PIN PB11 +#endif diff --git a/Marlin/src/pins/teensy2/pins_5DPRINT.h b/Marlin/src/pins/teensy2/pins_5DPRINT.h index 6e1f9c021746..798f98dae509 100644 --- a/Marlin/src/pins/teensy2/pins_5DPRINT.h +++ b/Marlin/src/pins/teensy2/pins_5DPRINT.h @@ -64,6 +64,8 @@ /** * 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 * * https://bitbucket.org/makible/5dprint-d8-controller-board */ @@ -131,8 +133,8 @@ #define HEATER_0_PIN 15 // C5 #define HEATER_BED_PIN 14 // C4 -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 PWM3A #endif // diff --git a/Marlin/src/pins/teensy2/pins_BRAINWAVE.h b/Marlin/src/pins/teensy2/pins_BRAINWAVE.h index cdcc249c00d2..900eae6dd49e 100644 --- a/Marlin/src/pins/teensy2/pins_BRAINWAVE.h +++ b/Marlin/src/pins/teensy2/pins_BRAINWAVE.h @@ -23,9 +23,13 @@ /** * Brainwave 1.0 pin assignments (AT90USB646) + * https://www.reprap.org/wiki/Brainwave * * 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 */ /** @@ -116,8 +120,8 @@ #define HEATER_0_PIN 32 // A4 Extruder #define HEATER_BED_PIN 18 // E6 Bed -#ifndef FAN_PIN - #define FAN_PIN 31 // A3 Fan +#ifndef FAN0_PIN + #define FAN0_PIN 31 // A3 Fan #endif // diff --git a/Marlin/src/pins/teensy2/pins_BRAINWAVE_PRO.h b/Marlin/src/pins/teensy2/pins_BRAINWAVE_PRO.h index 319130ef968d..a1ef48e524e6 100644 --- a/Marlin/src/pins/teensy2/pins_BRAINWAVE_PRO.h +++ b/Marlin/src/pins/teensy2/pins_BRAINWAVE_PRO.h @@ -26,6 +26,8 @@ * * Requires hardware bundle for Arduino: * https://github.com/unrepentantgeek/brainwave-arduino + * + * Not to be confused with the regular Brainwave controller (https://www.reprap.org/wiki/Brainwave) */ /** @@ -124,8 +126,8 @@ // #define HEATER_0_PIN 27 // B7 #define HEATER_BED_PIN 26 // B6 Bed -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 Fan, PWM3A +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 Fan, PWM3A #endif // diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h index ddf0d53ea60a..f80576b50969 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h @@ -25,6 +25,15 @@ * Rev B 2 JUN 2017 * * 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 */ /** @@ -109,8 +118,8 @@ #define HEATER_2_PIN 45 // F7 #define HEATER_BED_PIN 14 // C4 PWM3C -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 PWM3A #endif // diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h index 18673980870f..06496abdcd00 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h @@ -25,6 +25,19 @@ * Rev B 2 JUN 2017 * * 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 */ /** @@ -190,8 +203,8 @@ #endif #endif -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 PWM3A #endif // diff --git a/Marlin/src/pins/teensy2/pins_SAV_MKI.h b/Marlin/src/pins/teensy2/pins_SAV_MKI.h index cdba535090e4..5044af75d353 100644 --- a/Marlin/src/pins/teensy2/pins_SAV_MKI.h +++ b/Marlin/src/pins/teensy2/pins_SAV_MKI.h @@ -25,6 +25,9 @@ * Rev B 2 JUN 2017 * * 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 */ /** @@ -113,8 +116,8 @@ #define HEATER_0_PIN 15 // C5 PWM3B - Extruder #define HEATER_BED_PIN 14 // C4 PWM3C - Bed -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 PWM3A #endif // diff --git a/Marlin/src/pins/teensy2/pins_TEENSY2.h b/Marlin/src/pins/teensy2/pins_TEENSY2.h index efb409bf3259..b31c17386943 100644 --- a/Marlin/src/pins/teensy2/pins_TEENSY2.h +++ b/Marlin/src/pins/teensy2/pins_TEENSY2.h @@ -109,6 +109,7 @@ #include "env_validate.h" +// https://reprap.org/wiki/Teensy_Breadboard #define BOARD_INFO_NAME "Teensy++2.0" // @@ -148,8 +149,8 @@ // #define HEATER_0_PIN 15 // C5 PWM3B Extruder #define HEATER_BED_PIN 14 // C4 PWM3C -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A Fan +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 PWM3A Fan #endif // diff --git a/Marlin/src/pins/teensy2/pins_TEENSYLU.h b/Marlin/src/pins/teensy2/pins_TEENSYLU.h index ab722478fd93..81bb56349fb1 100644 --- a/Marlin/src/pins/teensy2/pins_TEENSYLU.h +++ b/Marlin/src/pins/teensy2/pins_TEENSYLU.h @@ -24,6 +24,10 @@ * Rev C 2 JUN 2017 * * 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 + * (*) Other versions are discouraged by creator. */ /** @@ -129,8 +133,8 @@ #define HEATER_0_PIN 15 // C5 PWM3B - Extruder #define HEATER_BED_PIN 14 // C4 PWM3C -#ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A +#ifndef FAN0_PIN + #define FAN0_PIN 16 // C6 PWM3A #endif // diff --git a/Marlin/src/pins/teensy3/pins_TEENSY31_32.h b/Marlin/src/pins/teensy3/pins_TEENSY31_32.h index 0edb5cb19dbd..ee5466b54da4 100644 --- a/Marlin/src/pins/teensy3/pins_TEENSY31_32.h +++ b/Marlin/src/pins/teensy3/pins_TEENSY31_32.h @@ -71,8 +71,8 @@ #define HEATER_0_PIN 20 //#define HEATER_1_PIN 36 #define HEATER_BED_PIN 21 -#ifndef FAN_PIN - #define FAN_PIN 22 +#ifndef FAN0_PIN + #define FAN0_PIN 22 #endif // diff --git a/Marlin/src/pins/teensy3/pins_TEENSY35_36.h b/Marlin/src/pins/teensy3/pins_TEENSY35_36.h index 71c348536a7f..289a8acb1c37 100644 --- a/Marlin/src/pins/teensy3/pins_TEENSY35_36.h +++ b/Marlin/src/pins/teensy3/pins_TEENSY35_36.h @@ -57,7 +57,7 @@ * 3.3V | | GND * Z_STOP_PIN 24 | 40 * * 53 | A22 DAC1 * AUX2 25 | 41 * * 52 | A21 DAC0 - * AUX2 FAN_PIN SCL2 TX1 26 | 42 * * 51 | 39 A20 MISO0 SDSS + * AUX2 FAN0_PIN SCL2 TX1 26 | 42 * * 51 | 39 A20 MISO0 SDSS * AUX2 Z-PROBE PWR SCK0 RX1 27 | * * * * * | 38 A19 PWM SDA1 * AUX2 SOL1_PIN MOSI0 28 | 43 * * 50 | 37 A18 PWM SCL1 * D10 CONTROLLER_FAN_PIN CAN0TX PWM 29 | 44 * * 49 | 36 A17 PWM @@ -109,8 +109,8 @@ #define HEATER_0_PIN 30 #define HEATER_1_PIN 36 #define HEATER_BED_PIN 31 -#ifndef FAN_PIN - #define FAN_PIN 2 +#ifndef FAN0_PIN + #define FAN0_PIN 2 #endif #define TEMP_0_PIN 2 // Extruder / Analog pin numbering: 2 => A2 diff --git a/Marlin/src/pins/teensy4/pins_TEENSY41.h b/Marlin/src/pins/teensy4/pins_TEENSY41.h index 21a1ff675f24..263d9e8f8b08 100644 --- a/Marlin/src/pins/teensy4/pins_TEENSY41.h +++ b/Marlin/src/pins/teensy4/pins_TEENSY41.h @@ -53,10 +53,10 @@ * 3.3V | | GND * Z_STOP_PIN PWM 24 | | 41 A17 * E0_ENABLE_PIN PWM 25 | | 40 A16 - * FAN_PIN MOSI1 26 | | 39 A15 MISO1 X_STOP_PIN + * FAN0_PIN MOSI1 26 | | 39 A15 MISO1 X_STOP_PIN * Z-PROBE PWR SCK1 27 | * * * * * | 38 A14 Y_STOP_PIN * SOL1_PIN RX7 PWM 28 | | 37 PWM HEATER_0_PIN - * FAN_PIN TX7 PWM 29 | | 36 PWM HEATER_BED_PIN + * FAN0_PIN TX7 PWM 29 | | 36 PWM HEATER_BED_PIN * X_CS_PIN 30 | | 35 TX8 E1_ENABLE_PIN * y_CS_PIN 31 | SDCARD | 34 RX8 E1_DIR_PIN * Z_CS_PIN 32 |_______________| 33 PWM E1_STEP_PIN @@ -107,8 +107,8 @@ #define HEATER_0_PIN 37 #define HEATER_1_PIN 18 #define HEATER_BED_PIN 36 -#ifndef FAN_PIN - #define FAN_PIN 29 +#ifndef FAN0_PIN + #define FAN0_PIN 29 #endif // diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp index e3f95623acbc..818f0dcb3737 100644 --- a/Marlin/src/sd/SdBaseFile.cpp +++ b/Marlin/src/sd/SdBaseFile.cpp @@ -703,7 +703,10 @@ bool SdBaseFile::open(SdBaseFile *dirFile, const uint8_t dname[11] // Get VFat dir entry pvFat = (vfat_t *) p; // Get checksum from the last entry of the sequence - if (pvFat->sequenceNumber & 0x40) lfnChecksum = pvFat->checksum; + if (pvFat->sequenceNumber & 0x40) { + lfnChecksum = pvFat->checksum; + ZERO(lfnName); + } // Get LFN sequence number lfnSequenceNumber = pvFat->sequenceNumber & 0x1F; if WITHIN(lfnSequenceNumber, 1, reqEntriesNum) { @@ -711,6 +714,7 @@ bool SdBaseFile::open(SdBaseFile *dirFile, const uint8_t dname[11] if (lfnChecksum == pvFat->checksum) { // Set chunk of LFN from VFAT entry into lfnName getLFNName(pvFat, (char *)lfnName, lfnSequenceNumber); + TERN_(UTF_FILENAME_SUPPORT, convertUtf16ToUtf8((char *)lfnName)); // LFN found? if (!strncasecmp((char*)dlname, (char*)lfnName, lfnNameLength)) lfnFileFound = true; } @@ -999,7 +1003,8 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, uint8_t oflag) { bool SdBaseFile::isDirLFN(const dir_t* dir) { if (DIR_IS_LONG_NAME(dir)) { vfat_t *VFAT = (vfat_t*)dir; - // Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0 + // Sanity-check the VFAT entry. The first cluster is always set to zero. + // The sequence number should be higher than 0 and lower than maximum allowed by VFAT spec if ((VFAT->firstClusterLow == 0) && WITHIN((VFAT->sequenceNumber & 0x1F), 1, MAX_VFAT_ENTRIES)) return true; } return false; @@ -1013,8 +1018,7 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, uint8_t oflag) { * \return false if the dirname is a short file name 8.3 (SFN) */ bool SdBaseFile::isDirNameLFN(const char *dirname) { - uint8_t length = strlen(dirname); - uint8_t idx = length; + uint8_t length = strlen(dirname), idx = length; bool dotFound = false; if (idx > 12) return true; // LFN due to filename length > 12 ("filename.ext") // Check dot(s) position @@ -1133,13 +1137,13 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, uint8_t oflag) { * Get the LFN filename block from a dir. Get the block in lname at startOffset */ void SdBaseFile::getLFNName(vfat_t *pFatDir, char *lname, uint8_t sequenceNumber) { - uint8_t startOffset = (sequenceNumber - 1) * FILENAME_LENGTH; + const uint8_t startOffset = (sequenceNumber - 1) * FILENAME_LENGTH; LOOP_L_N(i, FILENAME_LENGTH) { const uint16_t utf16_ch = (i >= 11) ? pFatDir->name3[i - 11] : (i >= 5) ? pFatDir->name2[i - 5] : pFatDir->name1[i]; #if ENABLED(UTF_FILENAME_SUPPORT) // We can't reconvert to UTF-8 here as UTF-8 is variable-size encoding, but joining LFN blocks // needs static bytes addressing. So here just store full UTF-16LE words to re-convert later. - uint16_t idx = (startOffset + i) * 2; // This is fixed as FAT LFN always contain UTF-16LE encoding + const uint16_t idx = (startOffset + i) * 2; // This is fixed as FAT LFN always contain UTF-16LE encoding lname[idx] = utf16_ch & 0xFF; lname[idx + 1] = (utf16_ch >> 8) & 0xFF; #else @@ -1153,8 +1157,8 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, uint8_t oflag) { * Set the LFN filename block lname to a dir. Put the block based on sequence number */ void SdBaseFile::setLFNName(vfat_t *pFatDir, char *lname, uint8_t sequenceNumber) { - uint8_t startOffset = (sequenceNumber - 1) * FILENAME_LENGTH; - uint8_t nameLength = strlen(lname); + const uint8_t startOffset = (sequenceNumber - 1) * FILENAME_LENGTH, + nameLength = strlen(lname); LOOP_L_N(i, FILENAME_LENGTH) { uint16_t ch = 0; if ((startOffset + i) < nameLength) @@ -1425,7 +1429,7 @@ int16_t SdBaseFile::read(void *buf, uint16_t nbyte) { * readDir() called before a directory has been opened, this is not * a directory file or an I/O error occurred. */ -int8_t SdBaseFile::readDir(dir_t *dir, char *longFilename) { +int8_t SdBaseFile::readDir(dir_t *dir, char * const longFilename) { int16_t n; // if not a directory file or miss-positioned return an error if (!isDir() || (0x1F & curPosition_)) return -1; @@ -1460,7 +1464,7 @@ int8_t SdBaseFile::readDir(dir_t *dir, char *longFilename) { // Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0 if (VFAT->firstClusterLow == 0) { const uint8_t seq = VFAT->sequenceNumber & 0x1F; - if (WITHIN(seq, 1, MAX_VFAT_ENTRIES)) { + if (WITHIN(seq, 1, VFAT_ENTRIES_LIMIT)) { if (seq == 1) { checksum = VFAT->checksum; checksum_error = 0; @@ -1507,44 +1511,55 @@ int8_t SdBaseFile::readDir(dir_t *dir, char *longFilename) { // Post-process normal file or subdirectory longname, if any if (DIR_IS_FILE_OR_SUBDIR(dir)) { #if ENABLED(UTF_FILENAME_SUPPORT) - #if LONG_FILENAME_CHARSIZE > 2 - // Add warning for developers for currently not supported 3-byte cases (Conversion series of 2-byte - // codepoints to 3-byte in-place will break the rest of filename) - #error "Currently filename re-encoding is done in-place. It may break the remaining chars to use 3-byte codepoints." - #endif - // Is there a long filename to decode? if (longFilename) { - // Reset n to the start of the long name - n = 0; - for (uint16_t idx = 0; idx < (LONG_FILENAME_LENGTH) / 2; idx += 2) { // idx is fixed since FAT LFN always contains UTF-16LE encoding - const uint16_t utf16_ch = longFilename[idx] | (longFilename[idx + 1] << 8); - if (0xD800 == (utf16_ch & 0xF800)) // Surrogate pair - encode as '_' - longFilename[n++] = '_'; - else if (0 == (utf16_ch & 0xFF80)) // Encode as 1-byte UTF-8 char - longFilename[n++] = utf16_ch & 0x007F; - else if (0 == (utf16_ch & 0xF800)) { // Encode as 2-byte UTF-8 char - longFilename[n++] = 0xC0 | ((utf16_ch >> 6) & 0x1F); - longFilename[n++] = 0x80 | ( utf16_ch & 0x3F); - } - else { - #if LONG_FILENAME_CHARSIZE > 2 // Encode as 3-byte UTF-8 char - longFilename[n++] = 0xE0 | ((utf16_ch >> 12) & 0x0F); - longFilename[n++] = 0xC0 | ((utf16_ch >> 6) & 0x3F); - longFilename[n++] = 0xC0 | ( utf16_ch & 0x3F); - #else // Encode as '_' - longFilename[n++] = '_'; - #endif - } - if (0 == utf16_ch) break; // End of filename - } // idx - } // longFilename + n = convertUtf16ToUtf8(longFilename); + } #endif return n; } // DIR_IS_FILE_OR_SUBDIR } } +#if ENABLED(UTF_FILENAME_SUPPORT) + + uint8_t SdBaseFile::convertUtf16ToUtf8(char * const longFilename) { + #if LONG_FILENAME_CHARSIZE > 2 + // Add warning for developers for unsupported 3-byte cases. + // (Converting 2-byte codepoints to 3-byte in-place would break the rest of filename.) + #error "Currently filename re-encoding is done in-place. It may break the remaining chars to use 3-byte codepoints." + #endif + + int16_t n; + // Reset n to the start of the long name + n = 0; + for (uint16_t idx = 0; idx < (LONG_FILENAME_LENGTH); idx += 2) { // idx is fixed since FAT LFN always contains UTF-16LE encoding + const uint16_t utf16_ch = longFilename[idx] | (longFilename[idx + 1] << 8); + if (0xD800 == (utf16_ch & 0xF800)) // Surrogate pair - encode as '_' + longFilename[n++] = '_'; + else if (0 == (utf16_ch & 0xFF80)) // Encode as 1-byte UTF-8 char + longFilename[n++] = utf16_ch & 0x007F; + else if (0 == (utf16_ch & 0xF800)) { // Encode as 2-byte UTF-8 char + longFilename[n++] = 0xC0 | ((utf16_ch >> 6) & 0x1F); + longFilename[n++] = 0x80 | ( utf16_ch & 0x3F); + } + else { + #if LONG_FILENAME_CHARSIZE > 2 // Encode as 3-byte UTF-8 char + longFilename[n++] = 0xE0 | ((utf16_ch >> 12) & 0x0F); + longFilename[n++] = 0xC0 | ((utf16_ch >> 6) & 0x3F); + longFilename[n++] = 0xC0 | ( utf16_ch & 0x3F); + #else // Encode as '_' + longFilename[n++] = '_'; + #endif + } + if (0 == utf16_ch) break; // End of filename + } // idx + + return n; + } + +#endif // UTF_FILENAME_SUPPORT + // Read next directory entry into the cache // Assumes file is correctly positioned dir_t* SdBaseFile::readDirCache() { @@ -1613,7 +1628,7 @@ bool SdBaseFile::remove() { // Check if the entry has a LFN bool lastEntry = false; // loop back to search for any LFN entries related to this file - LOOP_S_LE_N(sequenceNumber, 1, MAX_VFAT_ENTRIES) { + LOOP_S_LE_N(sequenceNumber, 1, VFAT_ENTRIES_LIMIT) { dirIndex_ = (dirIndex_ - 1) & 0xF; if (dirBlock_ == 0) break; if (dirIndex_ == 0xF) dirBlock_--; diff --git a/Marlin/src/sd/SdBaseFile.h b/Marlin/src/sd/SdBaseFile.h index dd8e2aff4bd4..19225170f9ce 100644 --- a/Marlin/src/sd/SdBaseFile.h +++ b/Marlin/src/sd/SdBaseFile.h @@ -298,7 +298,7 @@ class SdBaseFile { bool printName(); int16_t read(); int16_t read(void *buf, uint16_t nbyte); - int8_t readDir(dir_t *dir, char *longFilename); + int8_t readDir(dir_t *dir, char * const longFilename); static bool remove(SdBaseFile *dirFile, const char *path); bool remove(); @@ -392,14 +392,16 @@ class SdBaseFile { bool openCachedEntry(uint8_t cacheIndex, uint8_t oflags); dir_t* readDirCache(); + #if ENABLED(UTF_FILENAME_SUPPORT) + uint8_t convertUtf16ToUtf8(char * const longFilename); + #endif + // Long Filename create/write support #if ENABLED(LONG_FILENAME_WRITE_SUPPORT) static bool isDirLFN(const dir_t* dir); static bool isDirNameLFN(const char *dirname); static bool parsePath(const char *str, uint8_t *name, uint8_t *lname, const char **ptr); - /** - * Return the number of entries needed in the FAT for this LFN - */ + // Return the number of entries needed in the FAT for this LFN static inline uint8_t getLFNEntriesNum(const char *lname) { return (strlen(lname) + 12) / 13; } static void getLFNName(vfat_t *vFatDir, char *lname, uint8_t startOffset); static void setLFNName(vfat_t *vFatDir, char *lname, uint8_t lfnSequenceNumber); diff --git a/Marlin/src/sd/SdFatConfig.h b/Marlin/src/sd/SdFatConfig.h index dfba64129526..0979a592a3bc 100644 --- a/Marlin/src/sd/SdFatConfig.h +++ b/Marlin/src/sd/SdFatConfig.h @@ -109,4 +109,4 @@ #define LONG_FILENAME_CHARSIZE TERN(UTF_FILENAME_SUPPORT, 2, 1) // Total bytes needed to store a single long filename -#define LONG_FILENAME_LENGTH (FILENAME_LENGTH * LONG_FILENAME_CHARSIZE * MAX_VFAT_ENTRIES + 1) +#define LONG_FILENAME_LENGTH (FILENAME_LENGTH * LONG_FILENAME_CHARSIZE * VFAT_ENTRIES_LIMIT + 1) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index fb2721a2b282..3a377d694d27 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -81,10 +81,11 @@ IF_DISABLED(NO_SD_AUTOSTART, uint8_t CardReader::autofile_index); // = 0 MediaFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH]; uint8_t CardReader::workDirDepth; +int16_t CardReader::nrItems = -1; #if ENABLED(SDCARD_SORT_ALPHA) - uint16_t CardReader::sort_count; + int16_t CardReader::sort_count; #if ENABLED(SDSORT_GCODE) bool CardReader::sort_alpha; int CardReader::sort_folders; @@ -100,7 +101,6 @@ uint8_t CardReader::workDirDepth; #if ENABLED(SDSORT_USES_RAM) #if ENABLED(SDSORT_CACHE_NAMES) - uint16_t CardReader::nrFiles; // Cached total file count #if ENABLED(SDSORT_DYNAMIC_RAM) char **CardReader::sortshort, **CardReader::sortnames; #else @@ -228,25 +228,20 @@ bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, // // Get the number of (compliant) items in the folder // -int CardReader::countItems(MediaFile dir) { +int16_t CardReader::countVisibleItems(MediaFile dir) { dir_t p; - int c = 0; - while (dir.readDir(&p, longFilename) > 0) - c += is_visible_entity(p); - - #if ALL(SDCARD_SORT_ALPHA, SDSORT_USES_RAM, SDSORT_CACHE_NAMES) - nrFiles = c; - #endif - + int16_t c = 0; + dir.rewind(); + while (dir.readDir(&p, longFilename) > 0) c += is_visible_entity(p); return c; } // // Get file/folder info for an item by index // -void CardReader::selectByIndex(MediaFile dir, const uint8_t index) { +void CardReader::selectByIndex(MediaFile dir, const int16_t index) { dir_t p; - for (uint8_t cnt = 0; dir.readDir(&p, longFilename) > 0;) { + for (int16_t cnt = 0; dir.readDir(&p, longFilename) > 0;) { if (is_visible_entity(p)) { if (cnt == index) { createFilename(filename, p); @@ -420,6 +415,40 @@ void CardReader::ls(const uint8_t lsflags) { SERIAL_EOL(); } + void CardReader::getLongPath(char * const pathLong, char * const pathShort) { + + int i, pathLen = strlen(pathShort); + char bufShort[FILENAME_LENGTH] = { '\0' }; + strcpy_P(bufShort, pathShort); + + // Zero out slashes to make segments + for (i = 0; i < pathLen; i++) if (bufShort[i] == '/') bufShort[i] = '\0'; + + SdFile diveDir = root; // start from the root for segment 1 + for (i = 0; i < pathLen;) { + + if (bufShort[i] == '\0') i++; // move past a single nul + + char *segment = &bufShort[i]; // The segment after most slashes + + // If a segment is empty (extra-slash) then exit + if (!*segment) break; + + //SERIAL_ECHOLNPGM("Looking for segment: ", segment); + + // Find the item, setting the long filename + diveDir.rewind(); + selectByName(diveDir, segment); + diveDir.close(); + + if (longFilename[0]) { + strncpy_P(pathLong, longFilename, 63); + pathLong[63] = '\0'; + break; + } + } + } + #endif // LONG_FILENAME_HOST_SUPPORT // @@ -446,6 +475,7 @@ void CardReader::printSelectedFilename() { void CardReader::mount() { flag.mounted = false; + nrItems = -1; if (root.isOpen()) root.close(); if (!driver->init(SD_SPI_SPEED, SDSS) @@ -544,9 +574,7 @@ void CardReader::release() { flag.mounted = false; flag.workDirIsRoot = true; - #if ALL(SDCARD_SORT_ALPHA, SDSORT_USES_RAM, SDSORT_CACHE_NAMES) - nrFiles = 0; - #endif + nrItems = -1; SERIAL_ECHO_MSG(STR_SD_CARD_RELEASED); } @@ -875,7 +903,7 @@ void CardReader::closefile(const bool store_location/*=false*/) { // // Get info for a file in the working directory by index // -void CardReader::selectFileByIndex(const uint16_t nr) { +void CardReader::selectFileByIndex(const int16_t nr) { #if ENABLED(SDSORT_CACHE_NAMES) if (nr < sort_count) { strcpy(filename, sortshort[nr]); @@ -894,7 +922,7 @@ void CardReader::selectFileByIndex(const uint16_t nr) { // void CardReader::selectFileByName(const char * const match) { #if ENABLED(SDSORT_CACHE_NAMES) - for (uint16_t nr = 0; nr < sort_count; nr++) + for (int16_t nr = 0; nr < sort_count; nr++) if (strcasecmp(match, sortshort[nr]) == 0) { strcpy(filename, sortshort[nr]); strcpy(longFilename, sortnames[nr]); @@ -907,11 +935,6 @@ void CardReader::selectFileByName(const char * const match) { selectByName(workDir, match); } -uint16_t CardReader::countFilesInWorkDir() { - workDir.rewind(); - return countItems(workDir); -} - /** * Dive to the given DOS 8.3 file path, with optional echo of the dive paths. * @@ -1024,6 +1047,7 @@ void CardReader::cd(const char * relpath) { flag.workDirIsRoot = false; if (workDirDepth < MAX_DIR_DEPTH) workDirParents[workDirDepth++] = workDir; + nrItems = -1; TERN_(SDCARD_SORT_ALPHA, presort()); } else @@ -1032,6 +1056,7 @@ void CardReader::cd(const char * relpath) { int8_t CardReader::cdup() { if (workDirDepth > 0) { // At least 1 dir has been saved + nrItems = -1; workDir = --workDirDepth ? workDirParents[workDirDepth - 1] : root; // Use parent, or root if none TERN_(SDCARD_SORT_ALPHA, presort()); } @@ -1043,6 +1068,7 @@ void CardReader::cdroot() { workDir = root; flag.workDirIsRoot = true; workDirDepth = 0; + nrItems = -1; TERN_(SDCARD_SORT_ALPHA, presort()); } @@ -1051,9 +1077,8 @@ void CardReader::cdroot() { /** * Get the name of a file in the working directory by sort-index */ - void CardReader::getfilename_sorted(const uint16_t nr) { - selectFileByIndex(TERN1(SDSORT_GCODE, sort_alpha) && (nr < sort_count) - ? sort_order[nr] : nr); + void CardReader::selectFileByIndexSorted(const int16_t nr) { + selectFileByIndex(TERN1(SDSORT_GCODE, sort_alpha) && (nr < sort_count) ? sort_order[nr] : nr); } #if ENABLED(SDSORT_USES_RAM) @@ -1094,20 +1119,20 @@ void CardReader::cdroot() { * - Most RAM: Buffer the directory and return filenames from RAM */ void CardReader::presort() { - // Throw away old sort index flush_presort(); + int16_t fileCnt = get_num_items(); + // Sorting may be turned off if (TERN0(SDSORT_GCODE, !sort_alpha)) return; // If there are files, sort up to the limit - uint16_t fileCnt = countFilesInWorkDir(); if (fileCnt > 0) { // Never sort more than the max allowed // If you use folders to organize, 20 may be enough - NOMORE(fileCnt, uint16_t(SDSORT_LIMIT)); + NOMORE(fileCnt, int16_t(SDSORT_LIMIT)); // Sort order is always needed. May be static or dynamic. TERN_(SDSORT_DYNAMIC_RAM, sort_order = new uint8_t[fileCnt]); @@ -1147,7 +1172,7 @@ void CardReader::cdroot() { if (fileCnt > 1) { // Init sort order. - for (uint16_t i = 0; i < fileCnt; i++) { + for (int16_t i = 0; i < fileCnt; i++) { sort_order[i] = i; // If using RAM then read all filenames now. #if ENABLED(SDSORT_USES_RAM) @@ -1166,9 +1191,9 @@ void CardReader::cdroot() { } // Bubble Sort - for (uint16_t i = fileCnt; --i;) { + for (int16_t i = fileCnt; --i;) { bool didSwap = false; - uint8_t o1 = sort_order[0]; + int16_t o1 = sort_order[0]; #if DISABLED(SDSORT_USES_RAM) selectFileByIndex(o1); // Pre-fetch the first entry and save it strcpy(name1, longest_filename()); // so the loop only needs one fetch @@ -1177,8 +1202,8 @@ void CardReader::cdroot() { #endif #endif - for (uint16_t j = 0; j < i; ++j) { - const uint16_t o2 = sort_order[j + 1]; + for (int16_t j = 0; j < i; ++j) { + const int16_t o2 = sort_order[j + 1]; // Compare names from the array or just the two buffered names #if ENABLED(SDSORT_USES_RAM) @@ -1236,7 +1261,7 @@ void CardReader::cdroot() { // Using RAM but not keeping names around #if ENABLED(SDSORT_USES_RAM) && DISABLED(SDSORT_CACHE_NAMES) #if ENABLED(SDSORT_DYNAMIC_RAM) - for (uint16_t i = 0; i < fileCnt; ++i) free(sortnames[i]); + for (int16_t i = 0; i < fileCnt; ++i) free(sortnames[i]); TERN_(HAS_FOLDER_SORTING, delete [] isDir); #endif #endif @@ -1279,15 +1304,10 @@ void CardReader::cdroot() { #endif // SDCARD_SORT_ALPHA -uint16_t CardReader::get_num_Files() { +int16_t CardReader::get_num_items() { if (!isMounted()) return 0; - return ( - #if ALL(SDCARD_SORT_ALPHA, SDSORT_USES_RAM, SDSORT_CACHE_NAMES) - nrFiles // no need to access the SD card for filenames - #else - countFilesInWorkDir() - #endif - ); + if (nrItems < 0) nrItems = countVisibleItems(workDir); + return nrItems; } // diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 86acb1b8628c..d5eca9c915c1 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -36,12 +36,6 @@ extern const char M23_STR[], M24_STR[]; #endif #endif -#if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA) - #define SD_ORDER(N,C) ((C) - 1 - (N)) -#else - #define SD_ORDER(N,C) N -#endif - #define MAX_DIR_DEPTH 10 // Maximum folder depth #define MAXDIRNAMELENGTH 8 // DOS folder name size #define MAXPATHNAMELENGTH (1 + (MAXDIRNAMELENGTH + 1) * (MAX_DIR_DEPTH) + 1 + FILENAME_LENGTH) // "/" + N * ("ADIRNAME/") + "filename.ext" @@ -110,8 +104,6 @@ class CardReader { #endif #endif - // // // Methods // // // - CardReader(); static void changeMedia(DiskIODriver *_driver) { driver = _driver; } @@ -146,17 +138,17 @@ class CardReader { static char* longest_filename() { return longFilename[0] ? longFilename : filename; } #if ENABLED(LONG_FILENAME_HOST_SUPPORT) static void printLongPath(char * const path); // Used by M33 + static void getLongPath(char * const pathLong, char * const pathShort); // Used by anycubic_vyper #endif // Working Directory for SD card menu static void cdroot(); static void cd(const char *relpath); static int8_t cdup(); - static uint16_t countFilesInWorkDir(); - static uint16_t get_num_Files(); + static int16_t get_num_items(); // Select a file - static void selectFileByIndex(const uint16_t nr); + static void selectFileByIndex(const int16_t nr); static void selectFileByName(const char * const match); // (working directory only) // Print job @@ -199,14 +191,16 @@ class CardReader { #if ENABLED(SDCARD_SORT_ALPHA) static void presort(); - static void getfilename_sorted(const uint16_t nr); + static void selectFileByIndexSorted(const int16_t nr); #if ENABLED(SDSORT_GCODE) FORCE_INLINE static void setSortOn(bool b) { sort_alpha = b; presort(); } FORCE_INLINE static void setSortFolders(int i) { sort_folders = i; presort(); } //FORCE_INLINE static void setSortReverse(bool b) { sort_reverse = b; } #endif #else - FORCE_INLINE static void getfilename_sorted(const uint16_t nr) { selectFileByIndex(nr); } + FORCE_INLINE static void selectFileByIndexSorted(const int16_t nr) { + selectFileByIndex(TERN(SDCARD_RATHERRECENTFIRST, get_num_items() - 1 - nr, (nr))); + } #endif static void ls(const uint8_t lsflags); @@ -264,12 +258,13 @@ class CardReader { // static MediaFile root, workDir, workDirParents[MAX_DIR_DEPTH]; static uint8_t workDirDepth; + static int16_t nrItems; // Cache the total count // // Alphabetical file and folder sorting // #if ENABLED(SDCARD_SORT_ALPHA) - static uint16_t sort_count; // Count of sorted items in the current directory + static int16_t sort_count; // Count of sorted items in the current directory #if ENABLED(SDSORT_GCODE) static bool sort_alpha; // Flag to enable / disable the feature static int sort_folders; // Folder sorting before/none/after @@ -296,7 +291,6 @@ class CardReader { // If using dynamic ram for names, allocate on the heap. #if ENABLED(SDSORT_CACHE_NAMES) - static uint16_t nrFiles; // Cache the total count #if ENABLED(SDSORT_DYNAMIC_RAM) static char **sortshort, **sortnames; #else @@ -341,8 +335,8 @@ class CardReader { // Directory items // static bool is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, const bool onlyBin=false)); - static int countItems(MediaFile dir); - static void selectByIndex(MediaFile dir, const uint8_t index); + static int16_t countVisibleItems(MediaFile dir); + static void selectByIndex(MediaFile dir, const int16_t index); static void selectByName(MediaFile dir, const char * const match); static void printListing( MediaFile parent, const char * const prepend, const uint8_t lsflags diff --git a/README.md b/README.md index 05afe9ec2758..ac496aac21cd 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ To build and upload Marlin you will use one of these tools: - The free [Visual Studio Code](https://code.visualstudio.com/download) using the [Auto Build Marlin](https://marlinfw.org/docs/basics/auto_build_marlin.html) extension. - The free [Arduino IDE](https://www.arduino.cc/en/main/software) : See [Building Marlin with Arduino](https://marlinfw.org/docs/basics/install_arduino.html) +- You can also use VSCode with devcontainer : See [Installing Marlin (VSCode devcontainer)](http://marlinfw.org/docs/basics/install_devcontainer_vscode.html). 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. diff --git a/buildroot/share/PlatformIO/boards/marlin_BTT_SKR_SE_BX.json b/buildroot/share/PlatformIO/boards/marlin_BTT_SKR_SE_BX.json index 65735d433b17..3ed21e393b9c 100644 --- a/buildroot/share/PlatformIO/boards/marlin_BTT_SKR_SE_BX.json +++ b/buildroot/share/PlatformIO/boards/marlin_BTT_SKR_SE_BX.json @@ -3,7 +3,7 @@ "core": "stm32", "cpu": "cortex-m7", "extra_flags": "-DSTM32H743xx", - "f_cpu": "400000000L", + "f_cpu": "480000000L", "mcu": "stm32h743iit6", "variant": "MARLIN_BTT_SKR_SE_BX" }, diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H723Vx.json b/buildroot/share/PlatformIO/boards/marlin_STM32H723Vx.json new file mode 100644 index 000000000000..a2154d448a9e --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H723Vx.json @@ -0,0 +1,61 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m7", + "extra_flags": "-DSTM32H7xx -DSTM32H723xx", + "f_cpu": "550000000L", + "mcu": "stm32h723vet6", + "product_line": "STM32H723xx", + "variant": "MARLIN_H723Vx" + }, + "connectivity": [ + "can", + "ethernet" + ], + "debug": { + "jlink_device": "STM32H723VE", + "openocd_target": "stm32h7x", + "svd_path": "STM32H7x3.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32h7x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32H723VE (564k RAM. 512k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 577536, + "maximum_size": 524288, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink", + "cmsis-dap" + ], + "offset_address": "0x8020000", + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723ze.html", + "vendor": "ST" +} diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H723Zx.json b/buildroot/share/PlatformIO/boards/marlin_STM32H723Zx.json new file mode 100644 index 000000000000..8525793c4e01 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H723Zx.json @@ -0,0 +1,61 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m7", + "extra_flags": "-DSTM32H7xx -DSTM32H723xx", + "f_cpu": "550000000L", + "mcu": "stm32h723zet6", + "product_line": "STM32H723xx", + "variant": "MARLIN_H723Zx" + }, + "connectivity": [ + "can", + "ethernet" + ], + "debug": { + "jlink_device": "STM32H723ZE", + "openocd_target": "stm32h7x", + "svd_path": "STM32H7x3.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32h7x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32H723ZE (564k RAM. 512k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 577536, + "maximum_size": 524288, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink", + "cmsis-dap" + ], + "offset_address": "0x8020000", + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723ze.html", + "vendor": "ST" +} diff --git a/buildroot/share/PlatformIO/ldscripts/sovol.ld b/buildroot/share/PlatformIO/ldscripts/sovol.ld new file mode 100644 index 000000000000..785345543c0c --- /dev/null +++ b/buildroot/share/PlatformIO/ldscripts/sovol.ld @@ -0,0 +1,14 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40 + rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K +} + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", rom); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.h b/buildroot/share/PlatformIO/scripts/common-dependencies.h index da2d380a82b6..344669c49bdf 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.h +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.h @@ -54,7 +54,7 @@ #define HAS_MENU_BACKLASH #endif #if ENABLED(LCD_BED_TRAMMING) - #define HAS_MENU_BED_CORNERS + #define HAS_MENU_BED_TRAMMING #endif #if ENABLED(CANCEL_OBJECTS) #define HAS_MENU_CANCELOBJECT @@ -99,7 +99,7 @@ #define HAS_MENU_TOUCH_SCREEN #endif #if ENABLED(ASSISTED_TRAMMING_WIZARD) - #define HAS_MENU_TRAMMING + #define HAS_MENU_TRAMMING_WIZARD #endif #if ENABLED(AUTO_BED_LEVELING_UBL) #define HAS_MENU_UBL diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index 7a07f02d4605..3fc43ed6d89a 100644 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -88,6 +88,7 @@ def fetch_example(url): if not url.startswith('http'): brch = "bugfix-2.1.x" if '@' in url: url, brch = map(str.strip, url.split('@')) + if url == 'examples/default': url = 'default' url = f"https://raw.githubusercontent.com/MarlinFirmware/Configurations/{brch}/config/{url}" url = url.replace("%", "%25").replace(" ", "%20") @@ -103,7 +104,7 @@ def fetch_example(url): import os # Reset configurations to default - os.system("git reset --hard HEAD") + os.system("git checkout HEAD Marlin/*.h") # Try to fetch the remote files gotfile = False @@ -191,7 +192,7 @@ def apply_config_ini(cp): # For 'examples/' fetch an example set from GitHub. # For https?:// do a direct fetch of the URL. - if ckey.startswith('examples/') or ckey.startswith('http:'): + if ckey.startswith('examples/') or ckey.startswith('http'): fetch_example(ckey) ckey = 'base' diff --git a/buildroot/share/PlatformIO/scripts/marlin.py b/buildroot/share/PlatformIO/scripts/marlin.py index 169dd9d3c3a5..8d8dbb5b63d4 100644 --- a/buildroot/share/PlatformIO/scripts/marlin.py +++ b/buildroot/share/PlatformIO/scripts/marlin.py @@ -16,7 +16,8 @@ def copytree(src, dst, symlinks=False, ignore=None): shutil.copy2(item, dst / item.name) def replace_define(field, value): - for define in env['CPPDEFINES']: + envdefs = env['CPPDEFINES'].copy() + for define in envdefs: if define[0] == field: env['CPPDEFINES'].remove(define) env['CPPDEFINES'].append((field, value)) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BTT_EBB42_V1_1/variant_MARLIN_BTT_EBB42_V1_1.h b/buildroot/share/PlatformIO/variants/MARLIN_BTT_EBB42_V1_1/variant_MARLIN_BTT_EBB42_V1_1.h index ff75bc1e4839..9373e2fa3ba5 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BTT_EBB42_V1_1/variant_MARLIN_BTT_EBB42_V1_1.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BTT_EBB42_V1_1/variant_MARLIN_BTT_EBB42_V1_1.h @@ -155,6 +155,8 @@ #define SERIAL_UART_INSTANCE 4 #endif +#define FLASH_BANK_NUMBER FLASH_BANK_1 + // Default pin used for generic 'Serial' instance // Mandatory for Firmata #ifndef PIN_SERIAL_RX diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h index a090113fa377..041c43b55fad 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h @@ -95,7 +95,7 @@ extern "C" { // Timer Definitions #define TIMER_TONE TIM2 // TIMER_TONE must be defined in this file -#define TIMER_SERVO TIM5 // TIMER_SERVO must be defined in this file +#define TIMER_SERVO TIM3 // TIMER_SERVO must be defined in this file #define TIMER_SERIAL TIM11 // TIMER_SERIAL must be defined in this file // UART Definitions diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/PeripheralPins.c index 5c7c301f8218..4c0a7e4fa1bc 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/PeripheralPins.c @@ -191,7 +191,7 @@ WEAK const PinMap PinMap_PWM[] = { {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 FAN2_PIN //{PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 //{PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 - {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N FAN_PIN + {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N FAN0_PIN {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 FAN1_PIN {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N HEATER_BED_PIN //{PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PeripheralPins.c new file mode 100644 index 000000000000..e484edd1ad44 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PeripheralPins.c @@ -0,0 +1,590 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +/* + * Automatically generated from STM32H723VEHx.xml, STM32H723VETx.xml + * STM32H723VGHx.xml, STM32H723VGTx.xml + * STM32H730VBHx.xml, STM32H730VBTx.xml + * STM32H733VGHx.xml, STM32H733VGTx.xml + * CubeMX DB release 6.0.60 + */ +#if !defined(CUSTOM_PERIPHERAL_PINS) +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Notes: + * - The pins mentioned Px_y_ALTz are alternative possibilities which use other + * HW peripheral instances. You can use them the same way as any other "normal" + * pin (i.e. analogWrite(PA7_ALT1, 128);). + * + * - Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14 + {PA_2_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_INP14 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15 + {PA_3_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_INP15 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18 + {PA_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INP18 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19 + {PA_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC2_INP19 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INP3 + {PA_6_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INP3 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_INP7 + {PA_7_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_INP7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_INP9 + {PB_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_INP9 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INP5 + {PB_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INP5 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INP10 + {PC_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INP10 + {PC_0_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_INP10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INP11 + {PC_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_INP11 + {PC_1_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_INP11 + {PC_2_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_INP0 + {PC_3_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_INP1 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INP4 + {PC_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INP4 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_INP8 + {PC_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_INP8 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +WEAK const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_7_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PC_9_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PC_10, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {PD_13, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PA_8_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_6_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_11, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {PD_12, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +//*** TIM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_TIM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_1_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + {PA_2_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + {PA_3_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_5_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PA_6_ALT1, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_7_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_7_ALT3, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_0_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_1_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_6_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_7_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PB_8_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PB_9_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_14_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_14_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 1, 0)}, // TIM12_CH1 + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_15_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_15_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 2, 0)}, // TIM12_CH2 + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_6_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_7_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_8_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_9_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 + {PC_12, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 1, 0)}, // TIM15_CH1 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_4, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PE_5, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PE_6, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {NC, NP, 0} +}; +#endif + +//*** UART *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_9_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_12, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PA_15, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_4, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_6, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_6_ALT1, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_6_ALT2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_9, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_13, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_14, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_10_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_15, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_1, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_3, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_USART10)}, + {PE_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PA_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_10_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PB_3, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_5, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_7, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_7_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_8, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_15, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_11_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_0, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_2, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PE_7, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_12_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_8, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_4, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_12, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_13, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PD_15, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_9, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_11_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_9, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_0, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PD_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_10, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_7_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_2, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_1, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PD_6, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)}, + {PD_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PE_6, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_14, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_6_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PE_5, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_13, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_5_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_3_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PC_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PD_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_2, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_12, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_0, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_11, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_15_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI6)}, + {PB_4, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_4, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_11, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +//*** FDCAN *** + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_RD[] = { + {PA_11, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_5, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_8, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_12, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_0, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PD_12, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_TD[] = { + {PA_12, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_6, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_9, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_13, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_1, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PD_13, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +#if defined(HAL_ETH_MODULE_ENABLED) || defined(HAL_ETH_LEGACY_MODULE_ENABLED) +WEAK const PinMap PinMap_Ethernet[] = { + {PA_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS + {PA_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK + {PA_1_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_CLK + {PA_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO + {PA_3, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL + {PA_7, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV + {PA_7_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_DV + {PA_9, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {PB_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2 + {PB_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3 + {PB_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {PB_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PB_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER + {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PC_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC + {PC_2_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2 + {PC_3_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK + {PC_4, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0 + {PC_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1 + {PE_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {NC, NP, 0} +}; +#endif + +//*** OCTOSPI *** + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA0[] = { + {PA_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PD_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA1[] = { + {PB_0, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PC_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PD_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA2[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PA_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PB_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PE_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA3[] = { + {PA_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PA_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PD_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA4[] = { + {PC_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PD_4, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PE_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA5[] = { + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PD_5, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PE_8, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA6[] = { + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PD_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PE_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA7[] = { + {PD_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {PE_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SCLK[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {PB_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SSEL[] = { + {PB_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PB_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PC_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PE_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED) +WEAK const PinMap PinMap_USB_OTG_HS[] = { +#ifdef USE_USB_HS_IN_FS + {PA_8, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_SOF + {PA_9, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PA_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ID + {PA_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DM + {PA_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DP +#else + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D0 + {PA_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_CK + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D4 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_NXT +#endif /* USE_USB_HS_IN_FS */ + {NC, NP, 0} +}; +#endif + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + {PA_0, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CMD + {PB_3, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D2 + {PB_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D3 + {PB_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CKIN + {PB_8_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D4 + {PB_8_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D4 + {PB_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CDIR + {PB_9_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D5 + {PB_9_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D5 + {PB_13, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PB_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D0 + {PB_15, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D1 + {PC_1, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CK + {PC_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_SDMMC2)}, // SDMMC2_CKIN + {PC_6, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D0DIR + {PC_6_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D6 + {PC_6_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D6 + {PC_7, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D123DIR + {PC_7_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D7 + {PC_7_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D7 + {PC_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PC_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D1 + {PC_10, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D2 + {PC_11, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D3 + {PC_12, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CK + {PD_2, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CMD + {PD_6, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CK + {PD_7, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CMD + {NC, NP, 0} +}; +#endif + +#endif /* !CUSTOM_PERIPHERAL_PINS */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PinNamesVar.h new file mode 100644 index 000000000000..3bd0ed8fcd64 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PinNamesVar.h @@ -0,0 +1,108 @@ +/* Dual pad pin name */ +PC_2_C = PC_2 | PDUAL, +PC_3_C = PC_3 | PDUAL, + +/* Alternate pin name */ +PA_0_ALT1 = PA_0 | ALT1, +PA_1_ALT1 = PA_1 | ALT1, +PA_1_ALT2 = PA_1 | ALT2, +PA_2_ALT1 = PA_2 | ALT1, +PA_2_ALT2 = PA_2 | ALT2, +PA_3_ALT1 = PA_3 | ALT1, +PA_3_ALT2 = PA_3 | ALT2, +PA_4_ALT1 = PA_4 | ALT1, +PA_4_ALT2 = PA_4 | ALT2, +PA_5_ALT1 = PA_5 | ALT1, +PA_6_ALT1 = PA_6 | ALT1, +PA_7_ALT1 = PA_7 | ALT1, +PA_7_ALT2 = PA_7 | ALT2, +PA_7_ALT3 = PA_7 | ALT3, +PA_8_ALT1 = PA_8 | ALT1, +PA_9_ALT1 = PA_9 | ALT1, +PA_10_ALT1 = PA_10 | ALT1, +PA_11_ALT1 = PA_11 | ALT1, +PA_12_ALT1 = PA_12 | ALT1, +PA_15_ALT1 = PA_15 | ALT1, +PA_15_ALT2 = PA_15 | ALT2, +PB_0_ALT1 = PB_0 | ALT1, +PB_0_ALT2 = PB_0 | ALT2, +PB_1_ALT1 = PB_1 | ALT1, +PB_1_ALT2 = PB_1 | ALT2, +PB_3_ALT1 = PB_3 | ALT1, +PB_3_ALT2 = PB_3 | ALT2, +PB_4_ALT1 = PB_4 | ALT1, +PB_4_ALT2 = PB_4 | ALT2, +PB_5_ALT1 = PB_5 | ALT1, +PB_5_ALT2 = PB_5 | ALT2, +PB_6_ALT1 = PB_6 | ALT1, +PB_6_ALT2 = PB_6 | ALT2, +PB_7_ALT1 = PB_7 | ALT1, +PB_8_ALT1 = PB_8 | ALT1, +PB_8_ALT2 = PB_8 | ALT2, +PB_9_ALT1 = PB_9 | ALT1, +PB_9_ALT2 = PB_9 | ALT2, +PB_14_ALT1 = PB_14 | ALT1, +PB_14_ALT2 = PB_14 | ALT2, +PB_15_ALT1 = PB_15 | ALT1, +PB_15_ALT2 = PB_15 | ALT2, +PC_0_ALT1 = PC_0 | ALT1, +PC_0_ALT2 = PC_0 | ALT2, +PC_1_ALT1 = PC_1 | ALT1, +PC_1_ALT2 = PC_1 | ALT2, +PC_4_ALT1 = PC_4 | ALT1, +PC_5_ALT1 = PC_5 | ALT1, +PC_6_ALT1 = PC_6 | ALT1, +PC_6_ALT2 = PC_6 | ALT2, +PC_7_ALT1 = PC_7 | ALT1, +PC_7_ALT2 = PC_7 | ALT2, +PC_8_ALT1 = PC_8 | ALT1, +PC_9_ALT1 = PC_9 | ALT1, +PC_10_ALT1 = PC_10 | ALT1, +PC_11_ALT1 = PC_11 | ALT1, + +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PC_1, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif + +/* USB */ +#ifdef USBCON + USB_OTG_HS_DM = PA_11, + USB_OTG_HS_DP = PA_12, + USB_OTG_HS_ID = PA_10, + USB_OTG_HS_SOF = PA_8, + USB_OTG_HS_ULPI_CK = PA_5, + USB_OTG_HS_ULPI_D0 = PA_3, + USB_OTG_HS_ULPI_D1 = PB_0, + USB_OTG_HS_ULPI_D2 = PB_1, + USB_OTG_HS_ULPI_D3 = PB_10, + USB_OTG_HS_ULPI_D4 = PB_11, + USB_OTG_HS_ULPI_D5 = PB_12, + USB_OTG_HS_ULPI_D6 = PB_13, + USB_OTG_HS_ULPI_D7 = PB_5, + USB_OTG_HS_ULPI_DIR = PC_2_C, + USB_OTG_HS_ULPI_NXT = PC_3_C, + USB_OTG_HS_ULPI_STP = PC_0, + USB_OTG_HS_VBUS = PA_9, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/ldscript.ld new file mode 100644 index 000000000000..63228610336b --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/ldscript.ld @@ -0,0 +1,174 @@ +/* +****************************************************************************** +** +** File : LinkerScript.ld +** +** Author : STM32CubeIDE +** +** Abstract : Linker script for STM32H7 series +** 512Kbytes FLASH and 560Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +** Copyright (c) 2022 STMicroelectronics. +** All rights reserved. +** +** This software is licensed under terms that can be found in the LICENSE file +** in the root directory of this software component. +** If no LICENSE file comes with this software, it is provided AS-IS. +** +**************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K + DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET + RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K + RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K + RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM_D1 AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM_D1 + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM_D1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.cpp new file mode 100644 index 000000000000..bfeb0f9abc62 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.cpp @@ -0,0 +1,273 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#ifdef STM32H723xx +#include "pins_arduino.h" + +// Digital PinName array +const PinName digitalPin[] = { + PA_0, // D0/A0 + PA_1, // D1/A1 + PA_2, // D2/A2 + PA_3, // D3/A3 + PA_4, // D4/A4 + PA_5, // D5/A5 + PA_6, // D6/A6 + PA_7, // D7/A7 + PA_8, // D8 + PA_9, // D9 + PA_10, // D10 + PA_11, // D11 + PA_12, // D12 + PA_13, // D13 + PA_14, // D14 + PA_15, // D15 + PB_0, // D16/A8 + PB_1, // D17/A9 + PB_2, // D18 + PB_3, // D19 + PB_4, // D20 + PB_5, // D21 + PB_6, // D22 + PB_7, // D23 + PB_8, // D24 + PB_9, // D25 + PB_10, // D26 + PB_11, // D27 + PB_12, // D28 + PB_13, // D29 + PB_14, // D30 + PB_15, // D31 + PC_0, // D32/A10 + PC_1, // D33/A11 + PC_4, // D34/A12 + PC_5, // D35/A13 + PC_6, // D36 + PC_7, // D37 + PC_8, // D38 + PC_9, // D39 + PC_10, // D40 + PC_11, // D41 + PC_12, // D42 + PC_13, // D43 + PC_14, // D44 + PC_15, // D45 + PD_0, // D46 + PD_1, // D47 + PD_2, // D48 + PD_3, // D49 + PD_4, // D50 + PD_5, // D51 + PD_6, // D52 + PD_7, // D53 + PD_8, // D54 + PD_9, // D55 + PD_10, // D56 + PD_11, // D57 + PD_12, // D58 + PD_13, // D59 + PD_14, // D60 + PD_15, // D61 + PE_0, // D62 + PE_1, // D63 + PE_2, // D64 + PE_3, // D65 + PE_4, // D66 + PE_5, // D67 + PE_6, // D68 + PE_7, // D69 + PE_8, // D70 + PE_9, // D71 + PE_10, // D72 + PE_11, // D73 + PE_12, // D74 + PE_13, // D75 + PE_14, // D76 + PE_15, // D77 + PH_0, // D78 + PH_1, // D79 + PC_2_C, // D80/A14 + PC_3_C // D81/A15 +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, PA0 + 1, // A1, PA1 + 2, // A2, PA2 + 3, // A3, PA3 + 4, // A4, PA4 + 5, // A5, PA5 + 6, // A6, PA6 + 7, // A7, PA7 + 16, // A8, PB0 + 17, // A9, PB1 + 32, // A10, PC0 + 33, // A11, PC1 + 34, // A12, PC4 + 35, // A13, PC5 + 80, // A14, PC2_C + 81 // A15, PC3_C +}; + +void MPU_Config(void) +{ + MPU_Region_InitTypeDef MPU_InitStruct = {0}; + + /* Disables the MPU */ + HAL_MPU_Disable(); + + /** Initializes and configures the Region and the memory to be protected + */ + MPU_InitStruct.Enable = MPU_REGION_ENABLE; + MPU_InitStruct.Number = MPU_REGION_NUMBER0; + MPU_InitStruct.BaseAddress = 0x0; + MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; + MPU_InitStruct.SubRegionDisable = 0x87; + MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; + MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; + MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; + MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; + MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; + MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; + + HAL_MPU_ConfigRegion(&MPU_InitStruct); + /* Enables the MPU */ + HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); + +} + +/* + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {}; + + MPU_Config(); + + /** Supply configuration update enable + */ + HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); + /** Configure the main internal regulator output voltage + */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); + + while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; // 48Mhz for USB + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 5; // 25Mhz / 5 = 5Mhz + RCC_OscInitStruct.PLL.PLLN = 110; // 25Mhz / 5 * 110 = 550Mhz + RCC_OscInitStruct.PLL.PLLP = 1; // 550Mhz / 1 = 550Mhz + RCC_OscInitStruct.PLL.PLLQ = 10; // 550Mhz / 10 = 55Mhz + RCC_OscInitStruct.PLL.PLLR = 10; // unused + RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2; + RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; + RCC_OscInitStruct.PLL.PLLFRACN = 0; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 + |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; + RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; + RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) + { + Error_Handler(); + } + + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB + | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_ADC + | RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USART16 + | RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_I2C123 + | RCC_PERIPHCLK_I2C4 | RCC_PERIPHCLK_SPI123 + | RCC_PERIPHCLK_SPI45 | RCC_PERIPHCLK_SPI6; + + /* HSI48 used for USB 48 Mhz */ + /* PLL1 qclk also used for FMC, SDMMC, RNG, SAI */ + /* PLL2 pclk is needed for adc max 80 Mhz (p,q,r same) */ + /* PLL2 pclk also used for LP timers 2,3,4,5, SPI 1,2,3 */ + /* PLL2 qclk is needed for uart, can, spi4,5,6 80 Mhz */ + /* PLL3 r clk is needed for i2c 80 Mhz (p,q,r same) */ + PeriphClkInitStruct.PLL2.PLL2M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL2.PLL2N = 96; // N MUL 96 + PeriphClkInitStruct.PLL2.PLL2P = 2; // P div 2 + PeriphClkInitStruct.PLL2.PLL2Q = 2; // Q div 2 + PeriphClkInitStruct.PLL2.PLL2R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0; + PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM; + PeriphClkInitStruct.PLL2.PLL2FRACN = 0; + PeriphClkInitStruct.PLL3.PLL3M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL3.PLL3N = 96; // N MUL 96 + PeriphClkInitStruct.PLL3.PLL3P = 2; // P div 2 + PeriphClkInitStruct.PLL3.PLL3Q = 2; // Q div 2 + PeriphClkInitStruct.PLL3.PLL3R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_0; + PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOMEDIUM; + PeriphClkInitStruct.PLL3.PLL3FRACN = 0; + // ADC from PLL2 pclk + PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2; + // USB from HSI48 + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + // SDMMC from PLL1 qclk + PeriphClkInitStruct.SdmmcClockSelection = 0; + //PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL; + // LPUART from PLL2 qclk + PeriphClkInitStruct.Lpuart1ClockSelection = 0; + //PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart234578ClockSelection = 0; + //PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_PLL2; + // I2C123 from PLL3 rclk + PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_PLL3; + // I2C4 from PLL3 rclk + PeriphClkInitStruct.I2c4ClockSelection = 0; + //PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PLL3; + // SPI123 from PLL2 pclk + PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2; + // SPI45 from PLL2 qclk + PeriphClkInitStruct.Spi45ClockSelection = 0; + //PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_PLL2; + // SPI6 from PLL2 qclk + PeriphClkInitStruct.Spi6ClockSelection = 0; + //PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_PLL2; + + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { + Error_Handler(); + } +} + +#endif /* ARDUINO_GENERIC_* */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.h b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.h new file mode 100644 index 000000000000..8b67905680a9 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.h @@ -0,0 +1,269 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#pragma once + +/*---------------------------------------------------------------------------- + * STM32 pins number + *----------------------------------------------------------------------------*/ +#define PA0 PIN_A0 +#define PA1 PIN_A1 +#define PA2 PIN_A2 +#define PA3 PIN_A3 +#define PA4 PIN_A4 +#define PA5 PIN_A5 +#define PA6 PIN_A6 +#define PA7 PIN_A7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 PIN_A8 +#define PB1 PIN_A9 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 PIN_A10 +#define PC1 PIN_A11 +#define PC4 PIN_A12 +#define PC5 PIN_A13 +#define PC6 36 +#define PC7 37 +#define PC8 38 +#define PC9 39 +#define PC10 40 +#define PC11 41 +#define PC12 42 +#define PC13 43 +#define PC14 44 +#define PC15 45 +#define PD0 46 +#define PD1 47 +#define PD2 48 +#define PD3 49 +#define PD4 50 +#define PD5 51 +#define PD6 52 +#define PD7 53 +#define PD8 54 +#define PD9 55 +#define PD10 56 +#define PD11 57 +#define PD12 58 +#define PD13 59 +#define PD14 60 +#define PD15 61 +#define PE0 62 +#define PE1 63 +#define PE2 64 +#define PE3 65 +#define PE4 66 +#define PE5 67 +#define PE6 68 +#define PE7 69 +#define PE8 70 +#define PE9 71 +#define PE10 72 +#define PE11 73 +#define PE12 74 +#define PE13 75 +#define PE14 76 +#define PE15 77 +#define PH0 78 +#define PH1 79 +#define PC2_C PIN_A14 +#define PC3_C PIN_A15 +#define PC2 PC2_C +#define PC3 PC3_C + +// Alternate pins number +#define PA0_ALT1 (PA0 | ALT1) +#define PA1_ALT1 (PA1 | ALT1) +#define PA1_ALT2 (PA1 | ALT2) +#define PA2_ALT1 (PA2 | ALT1) +#define PA2_ALT2 (PA2 | ALT2) +#define PA3_ALT1 (PA3 | ALT1) +#define PA3_ALT2 (PA3 | ALT2) +#define PA4_ALT1 (PA4 | ALT1) +#define PA4_ALT2 (PA4 | ALT2) +#define PA5_ALT1 (PA5 | ALT1) +#define PA6_ALT1 (PA6 | ALT1) +#define PA7_ALT1 (PA7 | ALT1) +#define PA7_ALT2 (PA7 | ALT2) +#define PA7_ALT3 (PA7 | ALT3) +#define PA8_ALT1 (PA8 | ALT1) +#define PA9_ALT1 (PA9 | ALT1) +#define PA10_ALT1 (PA10 | ALT1) +#define PA11_ALT1 (PA11 | ALT1) +#define PA12_ALT1 (PA12 | ALT1) +#define PA15_ALT1 (PA15 | ALT1) +#define PA15_ALT2 (PA15 | ALT2) +#define PB0_ALT1 (PB0 | ALT1) +#define PB0_ALT2 (PB0 | ALT2) +#define PB1_ALT1 (PB1 | ALT1) +#define PB1_ALT2 (PB1 | ALT2) +#define PB3_ALT1 (PB3 | ALT1) +#define PB3_ALT2 (PB3 | ALT2) +#define PB4_ALT1 (PB4 | ALT1) +#define PB4_ALT2 (PB4 | ALT2) +#define PB5_ALT1 (PB5 | ALT1) +#define PB5_ALT2 (PB5 | ALT2) +#define PB6_ALT1 (PB6 | ALT1) +#define PB6_ALT2 (PB6 | ALT2) +#define PB7_ALT1 (PB7 | ALT1) +#define PB8_ALT1 (PB8 | ALT1) +#define PB8_ALT2 (PB8 | ALT2) +#define PB9_ALT1 (PB9 | ALT1) +#define PB9_ALT2 (PB9 | ALT2) +#define PB14_ALT1 (PB14 | ALT1) +#define PB14_ALT2 (PB14 | ALT2) +#define PB15_ALT1 (PB15 | ALT1) +#define PB15_ALT2 (PB15 | ALT2) +#define PC0_ALT1 (PC0 | ALT1) +#define PC0_ALT2 (PC0 | ALT2) +#define PC1_ALT1 (PC1 | ALT1) +#define PC1_ALT2 (PC1 | ALT2) +#define PC4_ALT1 (PC4 | ALT1) +#define PC5_ALT1 (PC5 | ALT1) +#define PC6_ALT1 (PC6 | ALT1) +#define PC6_ALT2 (PC6 | ALT2) +#define PC7_ALT1 (PC7 | ALT1) +#define PC7_ALT2 (PC7 | ALT2) +#define PC8_ALT1 (PC8 | ALT1) +#define PC9_ALT1 (PC9 | ALT1) +#define PC10_ALT1 (PC10 | ALT1) +#define PC11_ALT1 (PC11 | ALT1) + +#define NUM_DIGITAL_PINS 82 +#define NUM_DUALPAD_PINS 2 +#define NUM_ANALOG_INPUTS 16 + +// On-board LED pin number +#ifndef LED_BUILTIN + #define LED_BUILTIN PNUM_NOT_DEFINED +#endif + +// On-board user button +#ifndef USER_BTN + #define USER_BTN PNUM_NOT_DEFINED +#endif + +// SPI definitions +#ifndef PIN_SPI_SS + #define PIN_SPI_SS PA4 +#endif +#ifndef PIN_SPI_SS1 + #define PIN_SPI_SS1 PA15 +#endif +#ifndef PIN_SPI_SS2 + #define PIN_SPI_SS2 PNUM_NOT_DEFINED +#endif +#ifndef PIN_SPI_SS3 + #define PIN_SPI_SS3 PNUM_NOT_DEFINED +#endif +#ifndef PIN_SPI_MOSI + #define PIN_SPI_MOSI PA7 +#endif +#ifndef PIN_SPI_MISO + #define PIN_SPI_MISO PA6 +#endif +#ifndef PIN_SPI_SCK + #define PIN_SPI_SCK PA5 +#endif + +// I2C definitions +#ifndef PIN_WIRE_SDA + #define PIN_WIRE_SDA PB7 +#endif +#ifndef PIN_WIRE_SCL + #define PIN_WIRE_SCL PB6 +#endif + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +#ifndef TIMER_TONE + #define TIMER_TONE TIM6 +#endif +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM7 +#endif + +// UART Definitions +#ifndef SERIAL_UART_INSTANCE + #define SERIAL_UART_INSTANCE 4 +#endif + +// Default pin used for generic 'Serial' instance +// Mandatory for Firmata +#ifndef PIN_SERIAL_RX + #define PIN_SERIAL_RX PA1 +#endif +#ifndef PIN_SERIAL_TX + #define PIN_SERIAL_TX PA0 +#endif + +// Extra HAL modules +#if !defined(HAL_DAC_MODULE_DISABLED) + #define HAL_DAC_MODULE_ENABLED +#endif +#if !defined(HAL_ETH_MODULE_DISABLED) + #define HAL_ETH_MODULE_ENABLED +#endif +#if !defined(HAL_OSPI_MODULE_DISABLED) + #define HAL_OSPI_MODULE_ENABLED +#endif +#if !defined(HAL_SD_MODULE_DISABLED) + #define HAL_SD_MODULE_ENABLED +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #ifndef SERIAL_PORT_MONITOR + #define SERIAL_PORT_MONITOR Serial + #endif + #ifndef SERIAL_PORT_HARDWARE + #define SERIAL_PORT_HARDWARE Serial + #endif +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PeripheralPins.c new file mode 100644 index 000000000000..70048173e787 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PeripheralPins.c @@ -0,0 +1,688 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +/* + * Automatically generated from STM32H723ZETx.xml, STM32H723ZGTx.xml + * STM32H733ZGTx.xml + * CubeMX DB release 6.0.30 + */ +#if !defined(CUSTOM_PERIPHERAL_PINS) +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Notes: + * - The pins mentioned Px_y_ALTz are alternative possibilities which use other + * HW peripheral instances. You can use them the same way as any other "normal" + * pin (i.e. analogWrite(PA7_ALT1, 128);). + * + * - Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14 + {PA_2_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_INP14 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15 + {PA_3_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_INP15 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18 + {PA_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INP18 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19 + {PA_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC2_INP19 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INP3 + {PA_6_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INP3 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_INP7 + {PA_7_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_INP7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_INP9 + {PB_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_INP9 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INP5 + {PB_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INP5 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INP10 + {PC_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INP10 + {PC_0_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_INP10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INP11 + {PC_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_INP11 + {PC_1_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_INP11 + {PC_2_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_INP0 + {PC_3_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_INP1 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INP4 + {PC_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INP4 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_INP8 + {PC_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_INP8 + {PF_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC3_INP5 + {PF_4, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC3_INP9 + {PF_5, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC3_INP4 + {PF_6, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC3_INP8 + {PF_7, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_INP3 + {PF_8, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC3_INP7 + {PF_9, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INP2 + {PF_10, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_INP6 + {PF_11, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INP2 + {PF_12, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_INP6 + {PF_13, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_INP2 + {PF_14, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_INP6 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +WEAK const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_7_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PC_9_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PC_10, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {PD_13, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {PF_0, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PF_0_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PF_15, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PA_8_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_6_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_11, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {PD_12, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {PF_1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PF_1_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PF_14, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +//*** TIM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_TIM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_1_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + {PA_2_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + {PA_3_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_5_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PA_6_ALT1, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_7_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_7_ALT3, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_0_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_1_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_6_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_7_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PB_8_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PB_9_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_14_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_14_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 1, 0)}, // TIM12_CH1 + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_15_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_15_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 2, 0)}, // TIM12_CH2 + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_6_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_7_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_8_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_9_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 + {PC_12, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 1, 0)}, // TIM15_CH1 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_4, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PE_5, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PE_6, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PF_0, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 1, 0)}, // TIM23_CH1 + {PF_1, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 2, 0)}, // TIM23_CH2 + {PF_2, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 3, 0)}, // TIM23_CH3 + {PF_3, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 4, 0)}, // TIM23_CH4 + {PF_6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1 + {PF_6_ALT1, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 1, 0)}, // TIM23_CH1 + {PF_7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1 + {PF_7_ALT1, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 2, 0)}, // TIM23_CH2 + {PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PF_8_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N + {PF_8_ALT2, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 3, 0)}, // TIM23_CH3 + {PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PF_9_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N + {PF_9_ALT2, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 4, 0)}, // TIM23_CH4 + {PF_11, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 1, 0)}, // TIM24_CH1 + {PF_12, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 2, 0)}, // TIM24_CH2 + {PF_13, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 3, 0)}, // TIM24_CH3 + {PF_14, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 4, 0)}, // TIM24_CH4 + {PG_12, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 1, 0)}, // TIM23_CH1 + {PG_13, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 2, 0)}, // TIM23_CH2 + {PG_14, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 3, 0)}, // TIM23_CH3 + {NC, NP, 0} +}; +#endif + +//*** UART *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_9_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_12, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PA_15, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_4, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_6, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_6_ALT1, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_6_ALT2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_9, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_13, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_14, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_10_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_15, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_1, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_3, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_USART10)}, + {PE_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_7, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_1, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PG_12, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PG_14, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PA_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_10_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PB_3, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_5, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_7, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_7_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_8, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_15, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_11_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_0, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_2, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PE_7, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_6, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_0, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PG_9, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_11, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_12_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_8, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_4, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_12, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_13, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PD_15, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_9, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_8, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_14, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_11_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_9, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_0, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PD_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_10, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_9, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_13, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PG_13_ALT1, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_15, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_7_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_2, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_1, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PD_6, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)}, + {PD_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PE_6, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_14, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_9, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PF_11, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_14, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_6_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PE_5, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_13, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_8, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_9, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PG_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_5_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_3_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PC_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PD_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_2, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_12, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_7, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_11, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PG_13, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_0, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_11, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_15_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI6)}, + {PB_4, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_4, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_11, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_6, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_8, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PG_10, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {NC, NP, 0} +}; +#endif + +//*** FDCAN *** + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_RD[] = { + {PA_11, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_5, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_8, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_12, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_0, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PD_12, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {PF_6, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {PG_10, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_TD[] = { + {PA_12, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_6, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_9, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_13, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_1, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PD_13, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {PF_7, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {PG_9, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +#ifdef HAL_ETH_MODULE_ENABLED +WEAK const PinMap PinMap_Ethernet[] = { + {PA_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS + {PA_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK + {PA_1_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_CLK + {PA_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO + {PA_3, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL + {PA_7, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV + {PA_7_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_DV + {PA_9, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {PB_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2 + {PB_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3 + {PB_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {PB_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PB_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER + {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PC_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC + {PC_2_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2 + {PC_3_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK + {PC_4, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0 + {PC_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1 + {PE_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PG_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PG_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PG_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PG_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PG_14, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {NC, NP, 0} +}; +#endif + +//*** OCTOSPI *** + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA0[] = { + {PA_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PD_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PF_0, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO0 + {PF_8, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA1[] = { + {PB_0, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PC_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PD_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PF_1, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO1 + {PF_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA2[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PA_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PB_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PE_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PF_2, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO2 + {PF_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA3[] = { + {PA_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PA_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PD_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PF_3, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO3 + {PF_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA4[] = { + {PC_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PD_4, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PE_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PG_0, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO4 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA5[] = { + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PD_5, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PE_8, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PG_1, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO5 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA6[] = { + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PD_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PE_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PG_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PG_10, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO6 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA7[] = { + {PD_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {PE_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {PG_11, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO7 + {PG_14, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SCLK[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {PB_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {PF_4, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_CLK + {PF_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SSEL[] = { + {PB_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PB_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PC_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PE_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PG_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PG_12, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPIM_P2)}, // OCTOSPIM_P2_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED) +WEAK const PinMap PinMap_USB_OTG_HS[] = { +#ifdef USE_USB_HS_IN_FS + {PA_8, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_SOF + {PA_9, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PA_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ID + {PA_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DM + {PA_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DP +#else + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D0 + {PA_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_CK + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D4 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_NXT +#endif /* USE_USB_HS_IN_FS */ + {NC, NP, 0} +}; +#endif + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + {PA_0, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CMD + {PB_3, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D2 + {PB_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D3 + {PB_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CKIN + {PB_8_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D4 + {PB_8_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D4 + {PB_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CDIR + {PB_9_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D5 + {PB_9_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D5 + {PB_13, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PB_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D0 + {PB_15, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D1 + {PC_1, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CK + {PC_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_SDMMC2)}, // SDMMC2_CKIN + {PC_6, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D0DIR + {PC_6_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D6 + {PC_6_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D6 + {PC_7, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D123DIR + {PC_7_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D7 + {PC_7_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D7 + {PC_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PC_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D1 + {PC_10, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D2 + {PC_11, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D3 + {PC_12, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CK + {PD_2, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CMD + {PD_6, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CK + {PD_7, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CMD + {PG_9, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_SDMMC2)}, // SDMMC2_D0 + {PG_10, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_SDMMC2)}, // SDMMC2_D1 + {PG_11, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D2 + {PG_12, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D3 + {PG_13, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D6 + {PG_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D7 + {NC, NP, 0} +}; +#endif + +#endif /* !CUSTOM_PERIPHERAL_PINS */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PinNamesVar.h new file mode 100644 index 000000000000..ad9d80a62518 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PinNamesVar.h @@ -0,0 +1,117 @@ +/* Dual pad pin name */ +PC_2_C = PC_2 | PDUAL, +PC_3_C = PC_3 | PDUAL, + +/* Alternate pin name */ +PA_0_ALT1 = PA_0 | ALT1, +PA_1_ALT1 = PA_1 | ALT1, +PA_1_ALT2 = PA_1 | ALT2, +PA_2_ALT1 = PA_2 | ALT1, +PA_2_ALT2 = PA_2 | ALT2, +PA_3_ALT1 = PA_3 | ALT1, +PA_3_ALT2 = PA_3 | ALT2, +PA_4_ALT1 = PA_4 | ALT1, +PA_4_ALT2 = PA_4 | ALT2, +PA_5_ALT1 = PA_5 | ALT1, +PA_6_ALT1 = PA_6 | ALT1, +PA_7_ALT1 = PA_7 | ALT1, +PA_7_ALT2 = PA_7 | ALT2, +PA_7_ALT3 = PA_7 | ALT3, +PA_8_ALT1 = PA_8 | ALT1, +PA_9_ALT1 = PA_9 | ALT1, +PA_10_ALT1 = PA_10 | ALT1, +PA_11_ALT1 = PA_11 | ALT1, +PA_12_ALT1 = PA_12 | ALT1, +PA_15_ALT1 = PA_15 | ALT1, +PA_15_ALT2 = PA_15 | ALT2, +PB_0_ALT1 = PB_0 | ALT1, +PB_0_ALT2 = PB_0 | ALT2, +PB_1_ALT1 = PB_1 | ALT1, +PB_1_ALT2 = PB_1 | ALT2, +PB_3_ALT1 = PB_3 | ALT1, +PB_3_ALT2 = PB_3 | ALT2, +PB_4_ALT1 = PB_4 | ALT1, +PB_4_ALT2 = PB_4 | ALT2, +PB_5_ALT1 = PB_5 | ALT1, +PB_5_ALT2 = PB_5 | ALT2, +PB_6_ALT1 = PB_6 | ALT1, +PB_6_ALT2 = PB_6 | ALT2, +PB_7_ALT1 = PB_7 | ALT1, +PB_8_ALT1 = PB_8 | ALT1, +PB_8_ALT2 = PB_8 | ALT2, +PB_9_ALT1 = PB_9 | ALT1, +PB_9_ALT2 = PB_9 | ALT2, +PB_14_ALT1 = PB_14 | ALT1, +PB_14_ALT2 = PB_14 | ALT2, +PB_15_ALT1 = PB_15 | ALT1, +PB_15_ALT2 = PB_15 | ALT2, +PC_0_ALT1 = PC_0 | ALT1, +PC_0_ALT2 = PC_0 | ALT2, +PC_1_ALT1 = PC_1 | ALT1, +PC_1_ALT2 = PC_1 | ALT2, +PC_4_ALT1 = PC_4 | ALT1, +PC_5_ALT1 = PC_5 | ALT1, +PC_6_ALT1 = PC_6 | ALT1, +PC_6_ALT2 = PC_6 | ALT2, +PC_7_ALT1 = PC_7 | ALT1, +PC_7_ALT2 = PC_7 | ALT2, +PC_8_ALT1 = PC_8 | ALT1, +PC_9_ALT1 = PC_9 | ALT1, +PC_10_ALT1 = PC_10 | ALT1, +PC_11_ALT1 = PC_11 | ALT1, +PF_0_ALT1 = PF_0 | ALT1, +PF_1_ALT1 = PF_1 | ALT1, +PF_6_ALT1 = PF_6 | ALT1, +PF_7_ALT1 = PF_7 | ALT1, +PF_8_ALT1 = PF_8 | ALT1, +PF_8_ALT2 = PF_8 | ALT2, +PF_9_ALT1 = PF_9 | ALT1, +PF_9_ALT2 = PF_9 | ALT2, +PG_13_ALT1 = PG_13 | ALT1, + +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PC_1, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif + +/* USB */ +#ifdef USBCON + USB_OTG_HS_DM = PA_11, + USB_OTG_HS_DP = PA_12, + USB_OTG_HS_ID = PA_10, + USB_OTG_HS_SOF = PA_8, + USB_OTG_HS_ULPI_CK = PA_5, + USB_OTG_HS_ULPI_D0 = PA_3, + USB_OTG_HS_ULPI_D1 = PB_0, + USB_OTG_HS_ULPI_D2 = PB_1, + USB_OTG_HS_ULPI_D3 = PB_10, + USB_OTG_HS_ULPI_D4 = PB_11, + USB_OTG_HS_ULPI_D5 = PB_12, + USB_OTG_HS_ULPI_D6 = PB_13, + USB_OTG_HS_ULPI_D7 = PB_5, + USB_OTG_HS_ULPI_DIR = PC_2_C, + USB_OTG_HS_ULPI_NXT = PC_3_C, + USB_OTG_HS_ULPI_STP = PC_0, + USB_OTG_HS_VBUS = PA_9, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/ldscript.ld new file mode 100644 index 000000000000..63228610336b --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/ldscript.ld @@ -0,0 +1,174 @@ +/* +****************************************************************************** +** +** File : LinkerScript.ld +** +** Author : STM32CubeIDE +** +** Abstract : Linker script for STM32H7 series +** 512Kbytes FLASH and 560Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +** Copyright (c) 2022 STMicroelectronics. +** All rights reserved. +** +** This software is licensed under terms that can be found in the LICENSE file +** in the root directory of this software component. +** If no LICENSE file comes with this software, it is provided AS-IS. +** +**************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K + DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET + RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K + RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K + RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM_D1 AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM_D1 + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM_D1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.cpp new file mode 100644 index 000000000000..4506cf5ce6b5 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.cpp @@ -0,0 +1,317 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#if defined(STM32H723xx) +#include "pins_arduino.h" + +// Digital PinName array +const PinName digitalPin[] = { + PA_0, // D0/A0 + PA_1, // D1/A1 + PA_2, // D2/A2 + PA_3, // D3/A3 + PA_4, // D4/A4 + PA_5, // D5/A5 + PA_6, // D6/A6 + PA_7, // D7/A7 + PA_8, // D8 + PA_9, // D9 + PA_10, // D10 + PA_11, // D11 + PA_12, // D12 + PA_13, // D13 + PA_14, // D14 + PA_15, // D15 + PB_0, // D16/A8 + PB_1, // D17/A9 + PB_2, // D18 + PB_3, // D19 + PB_4, // D20 + PB_5, // D21 + PB_6, // D22 + PB_7, // D23 + PB_8, // D24 + PB_9, // D25 + PB_10, // D26 + PB_11, // D27 + PB_12, // D28 + PB_13, // D29 + PB_14, // D30 + PB_15, // D31 + PC_0, // D32/A10 + PC_1, // D33/A11 + PC_4, // D34/A12 + PC_5, // D35/A13 + PC_6, // D36 + PC_7, // D37 + PC_8, // D38 + PC_9, // D39 + PC_10, // D40 + PC_11, // D41 + PC_12, // D42 + PC_13, // D43 + PC_14, // D44 + PC_15, // D45 + PD_0, // D46 + PD_1, // D47 + PD_2, // D48 + PD_3, // D49 + PD_4, // D50 + PD_5, // D51 + PD_6, // D52 + PD_7, // D53 + PD_8, // D54 + PD_9, // D55 + PD_10, // D56 + PD_11, // D57 + PD_12, // D58 + PD_13, // D59 + PD_14, // D60 + PD_15, // D61 + PE_0, // D62 + PE_1, // D63 + PE_2, // D64 + PE_3, // D65 + PE_4, // D66 + PE_5, // D67 + PE_6, // D68 + PE_7, // D69 + PE_8, // D70 + PE_9, // D71 + PE_10, // D72 + PE_11, // D73 + PE_12, // D74 + PE_13, // D75 + PE_14, // D76 + PE_15, // D77 + PF_0, // D78 + PF_1, // D79 + PF_2, // D80 + PF_3, // D81/A14 + PF_4, // D82/A15 + PF_5, // D83/A16 + PF_6, // D84/A17 + PF_7, // D85/A18 + PF_8, // D86/A19 + PF_9, // D87/A20 + PF_10, // D88/A21 + PF_11, // D89/A22 + PF_12, // D90/A23 + PF_13, // D91/A24 + PF_14, // D92/A25 + PF_15, // D93 + PG_0, // D94 + PG_1, // D95 + PG_2, // D96 + PG_3, // D97 + PG_4, // D98 + PG_5, // D99 + PG_6, // D100 + PG_7, // D101 + PG_8, // D102 + PG_9, // D103 + PG_10, // D104 + PG_11, // D105 + PG_12, // D106 + PG_13, // D107 + PG_14, // D108 + PG_15, // D109 + PH_0, // D110 + PH_1, // D111 + PC_2_C, // D112/A26 + PC_3_C // D113/A27 +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, PA0 + 1, // A1, PA1 + 2, // A2, PA2 + 3, // A3, PA3 + 4, // A4, PA4 + 5, // A5, PA5 + 6, // A6, PA6 + 7, // A7, PA7 + 16, // A8, PB0 + 17, // A9, PB1 + 32, // A10, PC0 + 33, // A11, PC1 + 34, // A12, PC4 + 35, // A13, PC5 + 81, // A14, PF3 + 82, // A15, PF4 + 83, // A16, PF5 + 84, // A17, PF6 + 85, // A18, PF7 + 86, // A19, PF8 + 87, // A20, PF9 + 88, // A21, PF10 + 89, // A22, PF11 + 90, // A23, PF12 + 91, // A24, PF13 + 92, // A25, PF14 + 112, // A26, PC2_C + 113 // A27, PC3_C +}; + +void MPU_Config(void) +{ + MPU_Region_InitTypeDef MPU_InitStruct = {0}; + + /* Disables the MPU */ + HAL_MPU_Disable(); + + /** Initializes and configures the Region and the memory to be protected + */ + MPU_InitStruct.Enable = MPU_REGION_ENABLE; + MPU_InitStruct.Number = MPU_REGION_NUMBER0; + MPU_InitStruct.BaseAddress = 0x0; + MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; + MPU_InitStruct.SubRegionDisable = 0x87; + MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; + MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; + MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; + MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; + MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; + MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; + + HAL_MPU_ConfigRegion(&MPU_InitStruct); + /* Enables the MPU */ + HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); + +} + +/* + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {}; + + MPU_Config(); + + /** Supply configuration update enable + */ + HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); + /** Configure the main internal regulator output voltage + */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); + + while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; // 48Mhz for USB + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 5; // 25Mhz / 5 = 5Mhz + RCC_OscInitStruct.PLL.PLLN = 110; // 25Mhz / 5 * 110 = 550Mhz + RCC_OscInitStruct.PLL.PLLP = 1; // 550Mhz / 1 = 550Mhz + RCC_OscInitStruct.PLL.PLLQ = 10; // 550Mhz / 10 = 55Mhz + RCC_OscInitStruct.PLL.PLLR = 10; // unused + RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2; + RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; + RCC_OscInitStruct.PLL.PLLFRACN = 0; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 + |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; + RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; + RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) + { + Error_Handler(); + } + + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB + | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_ADC + | RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USART16 + | RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_I2C123 + | RCC_PERIPHCLK_I2C4 | RCC_PERIPHCLK_SPI123 + | RCC_PERIPHCLK_SPI45 | RCC_PERIPHCLK_SPI6; + + /* HSI48 used for USB 48 Mhz */ + /* PLL1 qclk also used for FMC, SDMMC, RNG, SAI */ + /* PLL2 pclk is needed for adc max 80 Mhz (p,q,r same) */ + /* PLL2 pclk also used for LP timers 2,3,4,5, SPI 1,2,3 */ + /* PLL2 qclk is needed for uart, can, spi4,5,6 80 Mhz */ + /* PLL3 r clk is needed for i2c 80 Mhz (p,q,r same) */ + PeriphClkInitStruct.PLL2.PLL2M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL2.PLL2N = 96; // N MUL 96 + PeriphClkInitStruct.PLL2.PLL2P = 2; // P div 2 + PeriphClkInitStruct.PLL2.PLL2Q = 2; // Q div 2 + PeriphClkInitStruct.PLL2.PLL2R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0; + PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM; + PeriphClkInitStruct.PLL2.PLL2FRACN = 0; + PeriphClkInitStruct.PLL3.PLL3M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL3.PLL3N = 96; // N MUL 96 + PeriphClkInitStruct.PLL3.PLL3P = 2; // P div 2 + PeriphClkInitStruct.PLL3.PLL3Q = 2; // Q div 2 + PeriphClkInitStruct.PLL3.PLL3R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_0; + PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOMEDIUM; + PeriphClkInitStruct.PLL3.PLL3FRACN = 0; + // ADC from PLL2 pclk + PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2; + // USB from HSI48 + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + // SDMMC from PLL1 qclk + PeriphClkInitStruct.SdmmcClockSelection = 0; + //PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL; + // LPUART from PLL2 qclk + PeriphClkInitStruct.Lpuart1ClockSelection = 0; + //PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart234578ClockSelection = 0; + //PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_PLL2; + // I2C123 from PLL3 rclk + PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_PLL3; + // I2C4 from PLL3 rclk + PeriphClkInitStruct.I2c4ClockSelection = 0; + //PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PLL3; + // SPI123 from PLL2 pclk + PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2; + // SPI45 from PLL2 qclk + PeriphClkInitStruct.Spi45ClockSelection = 0; + //PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_PLL2; + // SPI6 from PLL2 qclk + PeriphClkInitStruct.Spi6ClockSelection = 0; + //PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_PLL2; + + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { + Error_Handler(); + } +} + +#endif /* ARDUINO_GENERIC_* */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.h b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.h new file mode 100644 index 000000000000..d443f5c1fd3d --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.h @@ -0,0 +1,308 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#pragma once + +/*---------------------------------------------------------------------------- + * STM32 pins number + *----------------------------------------------------------------------------*/ +#define PA0 PIN_A0 +#define PA1 PIN_A1 +#define PA2 PIN_A2 +#define PA3 PIN_A3 +#define PA4 PIN_A4 +#define PA5 PIN_A5 +#define PA6 PIN_A6 +#define PA7 PIN_A7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 PIN_A8 +#define PB1 PIN_A9 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 PIN_A10 +#define PC1 PIN_A11 +#define PC4 PIN_A12 +#define PC5 PIN_A13 +#define PC6 36 +#define PC7 37 +#define PC8 38 +#define PC9 39 +#define PC10 40 +#define PC11 41 +#define PC12 42 +#define PC13 43 +#define PC14 44 +#define PC15 45 +#define PD0 46 +#define PD1 47 +#define PD2 48 +#define PD3 49 +#define PD4 50 +#define PD5 51 +#define PD6 52 +#define PD7 53 +#define PD8 54 +#define PD9 55 +#define PD10 56 +#define PD11 57 +#define PD12 58 +#define PD13 59 +#define PD14 60 +#define PD15 61 +#define PE0 62 +#define PE1 63 +#define PE2 64 +#define PE3 65 +#define PE4 66 +#define PE5 67 +#define PE6 68 +#define PE7 69 +#define PE8 70 +#define PE9 71 +#define PE10 72 +#define PE11 73 +#define PE12 74 +#define PE13 75 +#define PE14 76 +#define PE15 77 +#define PF0 78 +#define PF1 79 +#define PF2 80 +#define PF3 PIN_A14 +#define PF4 PIN_A15 +#define PF5 PIN_A16 +#define PF6 PIN_A17 +#define PF7 PIN_A18 +#define PF8 PIN_A19 +#define PF9 PIN_A20 +#define PF10 PIN_A21 +#define PF11 PIN_A22 +#define PF12 PIN_A23 +#define PF13 PIN_A24 +#define PF14 PIN_A25 +#define PF15 93 +#define PG0 94 +#define PG1 95 +#define PG2 96 +#define PG3 97 +#define PG4 98 +#define PG5 99 +#define PG6 100 +#define PG7 101 +#define PG8 102 +#define PG9 103 +#define PG10 104 +#define PG11 105 +#define PG12 106 +#define PG13 107 +#define PG14 108 +#define PG15 109 +#define PH0 110 +#define PH1 111 +#define PC2_C PIN_A26 +#define PC3_C PIN_A27 + +// Alternate pins number +#define PA0_ALT1 (PA0 | ALT1) +#define PA1_ALT1 (PA1 | ALT1) +#define PA1_ALT2 (PA1 | ALT2) +#define PA2_ALT1 (PA2 | ALT1) +#define PA2_ALT2 (PA2 | ALT2) +#define PA3_ALT1 (PA3 | ALT1) +#define PA3_ALT2 (PA3 | ALT2) +#define PA4_ALT1 (PA4 | ALT1) +#define PA4_ALT2 (PA4 | ALT2) +#define PA5_ALT1 (PA5 | ALT1) +#define PA6_ALT1 (PA6 | ALT1) +#define PA7_ALT1 (PA7 | ALT1) +#define PA7_ALT2 (PA7 | ALT2) +#define PA7_ALT3 (PA7 | ALT3) +#define PA8_ALT1 (PA8 | ALT1) +#define PA9_ALT1 (PA9 | ALT1) +#define PA10_ALT1 (PA10 | ALT1) +#define PA11_ALT1 (PA11 | ALT1) +#define PA12_ALT1 (PA12 | ALT1) +#define PA15_ALT1 (PA15 | ALT1) +#define PA15_ALT2 (PA15 | ALT2) +#define PB0_ALT1 (PB0 | ALT1) +#define PB0_ALT2 (PB0 | ALT2) +#define PB1_ALT1 (PB1 | ALT1) +#define PB1_ALT2 (PB1 | ALT2) +#define PB3_ALT1 (PB3 | ALT1) +#define PB3_ALT2 (PB3 | ALT2) +#define PB4_ALT1 (PB4 | ALT1) +#define PB4_ALT2 (PB4 | ALT2) +#define PB5_ALT1 (PB5 | ALT1) +#define PB5_ALT2 (PB5 | ALT2) +#define PB6_ALT1 (PB6 | ALT1) +#define PB6_ALT2 (PB6 | ALT2) +#define PB7_ALT1 (PB7 | ALT1) +#define PB8_ALT1 (PB8 | ALT1) +#define PB8_ALT2 (PB8 | ALT2) +#define PB9_ALT1 (PB9 | ALT1) +#define PB9_ALT2 (PB9 | ALT2) +#define PB14_ALT1 (PB14 | ALT1) +#define PB14_ALT2 (PB14 | ALT2) +#define PB15_ALT1 (PB15 | ALT1) +#define PB15_ALT2 (PB15 | ALT2) +#define PC0_ALT1 (PC0 | ALT1) +#define PC0_ALT2 (PC0 | ALT2) +#define PC1_ALT1 (PC1 | ALT1) +#define PC1_ALT2 (PC1 | ALT2) +#define PC4_ALT1 (PC4 | ALT1) +#define PC5_ALT1 (PC5 | ALT1) +#define PC6_ALT1 (PC6 | ALT1) +#define PC6_ALT2 (PC6 | ALT2) +#define PC7_ALT1 (PC7 | ALT1) +#define PC7_ALT2 (PC7 | ALT2) +#define PC8_ALT1 (PC8 | ALT1) +#define PC9_ALT1 (PC9 | ALT1) +#define PC10_ALT1 (PC10 | ALT1) +#define PC11_ALT1 (PC11 | ALT1) +#define PF0_ALT1 (PF0 | ALT1) +#define PF1_ALT1 (PF1 | ALT1) +#define PF6_ALT1 (PF6 | ALT1) +#define PF7_ALT1 (PF7 | ALT1) +#define PF8_ALT1 (PF8 | ALT1) +#define PF8_ALT2 (PF8 | ALT2) +#define PF9_ALT1 (PF9 | ALT1) +#define PF9_ALT2 (PF9 | ALT2) +#define PG13_ALT1 (PG13 | ALT1) + +#define NUM_DIGITAL_PINS 114 +#define NUM_DUALPAD_PINS 2 +#define NUM_ANALOG_INPUTS 28 + +// On-board LED pin number +#ifndef LED_BUILTIN + #define LED_BUILTIN PNUM_NOT_DEFINED +#endif + +// On-board user button +#ifndef USER_BTN + #define USER_BTN PNUM_NOT_DEFINED +#endif + +// SPI definitions +#ifndef PIN_SPI_SS + #define PIN_SPI_SS PA4 +#endif +#ifndef PIN_SPI_SS1 + #define PIN_SPI_SS1 PA15 +#endif +#ifndef PIN_SPI_SS2 + #define PIN_SPI_SS2 PG10 +#endif +#ifndef PIN_SPI_SS3 + #define PIN_SPI_SS3 PNUM_NOT_DEFINED +#endif +#ifndef PIN_SPI_MOSI + #define PIN_SPI_MOSI PA7 +#endif +#ifndef PIN_SPI_MISO + #define PIN_SPI_MISO PA6 +#endif +#ifndef PIN_SPI_SCK + #define PIN_SPI_SCK PA5 +#endif + +// I2C definitions +#ifndef PIN_WIRE_SDA + #define PIN_WIRE_SDA PB7 +#endif +#ifndef PIN_WIRE_SCL + #define PIN_WIRE_SCL PB6 +#endif + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +#ifndef TIMER_TONE + #define TIMER_TONE TIM6 +#endif +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM7 +#endif + +// UART Definitions +#ifndef SERIAL_UART_INSTANCE + #define SERIAL_UART_INSTANCE 4 +#endif + +// Default pin used for generic 'Serial' instance +// Mandatory for Firmata +#ifndef PIN_SERIAL_RX + #define PIN_SERIAL_RX PA1 +#endif +#ifndef PIN_SERIAL_TX + #define PIN_SERIAL_TX PA0 +#endif + +// Extra HAL modules +#if !defined(HAL_DAC_MODULE_DISABLED) + #define HAL_DAC_MODULE_ENABLED +#endif +#if !defined(HAL_ETH_MODULE_DISABLED) + #define HAL_ETH_MODULE_ENABLED +#endif +#if !defined(HAL_OSPI_MODULE_DISABLED) + #define HAL_OSPI_MODULE_ENABLED +#endif +#if !defined(HAL_SD_MODULE_DISABLED) + #define HAL_SD_MODULE_ENABLED +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #ifndef SERIAL_PORT_MONITOR + #define SERIAL_PORT_MONITOR Serial + #endif + #ifndef SERIAL_PORT_HARDWARE + #define SERIAL_PORT_HARDWARE Serial + #endif +#endif diff --git a/buildroot/share/fonts/bdf2u8g/Makefile b/buildroot/share/fonts/bdf2u8g/Makefile new file mode 100644 index 000000000000..cb00c7bb7425 --- /dev/null +++ b/buildroot/share/fonts/bdf2u8g/Makefile @@ -0,0 +1,15 @@ +CFLAGS = -g -Wall +#CFLAGS = -O4 -Wall + +SRC = bdf2u8g.c + +OBJ = $(SRC:.c=.o) + +bdf2u8g: $(OBJ) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o bdf2u8g.exe + +clean: + -rm $(OBJ) bdf2u8g.exe + +test: + ./bdf2u8g.exe -f 2 ../bdf/9x18.bdf u8g_aafont_9x18 u8g_aafont_9x18.c diff --git a/buildroot/share/fonts/bdf2u8g/bdf2u8g.c b/buildroot/share/fonts/bdf2u8g/bdf2u8g.c new file mode 100644 index 000000000000..0421bbd87fb9 --- /dev/null +++ b/buildroot/share/fonts/bdf2u8g/bdf2u8g.c @@ -0,0 +1,1214 @@ +/* + general font collections + http://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/ + http://techmagazine.ws/most-popular-free-quality-fonts/ + http://openfontlibrary.org/ + bitmap font collections + http://www.orgdot.com/aliasfonts/ (includes links) + http://www.04.jp.org/ + http://www.miniml.com + http://www.fontspace.com/010bus + + http://en.wikipedia.org/wiki/Unicode_typeface + da könnten auch ein paar fonts dabei sein, die die m2tklib sonderzeichen beinhalten: + Caslon Roman http://en.wikipedia.org/wiki/Caslon_Roman + Charis Sil http://en.wikipedia.org/wiki/Charis_SIL + DejaVu Sans http://en.wikipedia.org/wiki/DejaVu_fonts + Doulos http://en.wikipedia.org/wiki/Doulos_SIL + Free Serif http://en.wikipedia.org/wiki/FreeSerif http://ftp.gnu.org/gnu/freefont/ + --> keine box, aber es gibt pfeile/invertierte pfeile und kreise für m2tklib + Gentium Plus ???? http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=Gentium_download#02b091ae + --> keine graphic + GNU Unifont http://en.wikipedia.org/wiki/GNU_Unifont, http://unifoundry.com/unifont.html + + Titus cyberbit Basic http://en.wikipedia.org/wiki/TITUS_Cyberbit_Basic + + fonts + Gentium + http://openfontlibrary.org/font/gentium + license: OFL + Old-Standard + http://openfontlibrary.org/font/old-standard + license: OFL + Hanuman + http://openfontlibrary.org/font/hanumanb + license: OFL + FreeUniversal + http://openfontlibrary.org/font/freeuniversal + license: OFL + FriendShip-Code <--- nicht so sicher... + http://openfontlibrary.org/font/friendship-code + license: CC-BY-SA + LinuxLibertine + http://de.wikipedia.org/wiki/Linux_Libertine + http://sourceforge.net/projects/linuxlibertine/files/linuxlibertine/5.1.3-2/ + license: OFL + DidactGothic + source: http://openfontlibrary.org/ + judson + source: http://openfontlibrary.org/ + unicons + source: http://openfontlibrary.org/ + license: OFL + suggested pt: 26, 30 + org_V01, fixed_V0 + source: http://www.orgdot.com/aliasfonts/ + license: open source, individual, cite required + suggested pt: 8 + 04b_03b.zip 04b_03.zip 04b_09.zip 04b_11.zip 04b_19.zip 04b_21.zip 04b_25.zip 04b_30.zip + source: http://www.04.jp.org/ + license: "Freeware: You may use them as you like" + 7px4bus + source: http://www.fontspace.com/010bus + license: Licensed as: Freeware, Commercial use allowed! + suggested 7pt + 8pxbus + source: http://www.fontspace.com/010bus + license: Licensed as: Freeware, Commercial use allowed! + suggested 8pt + +*/ + +/* + only supports metric set "0" + assume DWIDTH second arg to be 0 for all glyphs + assumes that (0,0) of the BBX is placed on the base line + assumes ISO10646 encoding of the BDF file + + font information + offset + 0 font format + 1 FONTBOUNDINGBOX width unsigned + 2 FONTBOUNDINGBOX height unsigned + 3 FONTBOUNDINGBOX x-offset signed + 4 FONTBOUNDINGBOX y-offset signed + 5 capital A height unsigned + 6 start 'A' + 8 start 'a' + 10 encoding start + 11 encoding end + 12 descent 'g' negative: below baseline + 13 font max ascent + 14 font min decent negative: below baseline + 15 xascent (ascent of "(") + 16 xdescent (descent of ")") + +format 0 + glyph information + offset + 0 BBX width unsigned + 1 BBX height unsigned + 2 data size unsigned (BBX width + 7)/8 * BBX height + 3 DWIDTH signed + 4 BBX xoffset signed + 5 BBX yoffset signed + +format 1 + 0 BBX xoffset signed --> upper 4 Bit + 0 BBX yoffset signed --> lower 4 Bit + 1 BBX width unsigned --> upper 4 Bit + 1 BBX height unsigned --> lower 4 Bit + 2 data size unsigned -(BBX width + 7)/8 * BBX height --> lower 4 Bit + 2 DWIDTH signed --> upper 4 Bit + byte 0 == 255 indicates empty glyph + +format 2 + like format 0, but 4 gray levels for the glyph (4 pixel per byte in the glyph data) + + The glyph bitmap size is defined by BBX width and BBX height + number of bytes in the bitmap data (BBX width + 7)/8 * BBX height (format 0 and 1) + + draw_text(x,y,str) + get_text_frame(x,y,str, &x1, &y1, &width, &height) + frame( x1, y1, width, height) + underline( x1, y-1, width ) + + size of the surrounding bbox + + width = - xoffset(c1) + DWIDTH(c1) + DWIDTH(c2) + ... + DWIDTH(cn-1) + width(cn) + xoffset(cn) + height = FONTBOUNDINGBOX height + x1 = x + xoffset(c1) + y1 = y + yoffset(c1) + +ISO-8859-1 was incorporated as the first 256 code points of ISO/IEC 10646 and Unicode. + +*/ + +#include +#include +#include +#include + +#define BDF2U8G_COMPACT_OUTPUT +#define BDF2U8G_VERSION "1.01" +//#define VERBOSE + +/*=== forward declaration ===*/ +void bdf_aa_ClearDoShow(void); +void bdf_aa_Do(void); + +/*=== result data ===*/ +#define DATA_BUF_SIZE (1024 * 64) +unsigned char data_buf[DATA_BUF_SIZE]; +int data_pos = 0; + +void data_Init(void) { + data_pos = 0; +} + +void data_Put(unsigned char c) { + data_buf[data_pos] = c; + data_pos++; +} + +void data_Write(FILE *out_fp, const char *indent) { + int i; + int bytes_per_line = 16; + for (i = 0; i < data_pos; i++) { + fprintf(out_fp, "0x%02X", data_buf[i]); + if (i + 1 != data_pos) + fprintf(out_fp, ","); + if ((i + 1) % bytes_per_line == 0) + fprintf(out_fp, "\n%s", indent); + } +} + +/*=== low level parser ===*/ +#define P_BUF_SIZE (1024 * 4) +int p_current_char; +const char *p_line; +char p_buf[P_BUF_SIZE]; + +/* put next char into p_current_char */ +static int p_next_char(void) { + p_current_char = *p_line; + if (p_current_char == '\0') + return 0; + p_line++; + return 1; +} + +int p_first_char(const char *line) { + p_line = line; + return p_next_char(); +} + +void p_err(const char *msg) { +} + +int p_skip_space(void) { + for (;;) { + if (p_current_char == 0 || p_current_char > 32) + break; + if (p_next_char() == 0) + return 0; + } + return 1; +} + +/* put identifier into p_buf */ +int p_get_identifier(void) { + int i = 0; + if (p_current_char == '\0') + return p_err("unexpected EOF (expected identifier)"), 0; + for (;;) { + if (p_current_char <= 32) + break; + p_buf[i++] = p_current_char; + if (p_next_char() == 0) + break; + } + p_buf[i++] = '\0'; + p_skip_space(); + return 1; +} + +/* put identifier into p_buf */ +int p_get_identifier_with_blank(void) { + int i = 0; + for (;;) { + if (p_current_char < 32) + break; + p_buf[i++] = p_current_char; + if (p_next_char() == 0) + break; + } + p_buf[i++] = '\0'; + p_skip_space(); + return 1; +} + +int p_get_string(void) { + int i = 0; + if (p_current_char == '\0') + return 0; + if (p_current_char != '\"') + return p_err("\" expected"), 0; + if (p_next_char() == 0) + return p_err("unexpected EOF (\")"), 0; + for (;;) { + if (p_current_char == '\\') { + if (p_next_char() == 0) + return p_err("unexpected EOF (\\)"), 0; + } + else if (p_current_char == '\"') { + p_next_char(); + break; + } + p_buf[i++] = p_current_char; + if (p_next_char() == 0) + return p_err("unexpected EOF (\")"), 0; + } + p_buf[i] = '\0'; + return 1; +} + +int p_get_any(void) { + if (p_current_char == '\"') + return p_get_string(); + return p_get_identifier(); +} + +int p_get_val(void) { + p_get_any(); + return atoi(p_buf); +} + +int p_get_hex(void) { + int value = 0; + if (p_current_char >= '0' && p_current_char <= '9') + value = p_current_char - '0'; + else if (p_current_char >= 'a' && p_current_char <= 'f') + value = p_current_char - 'a' + 10; + else if (p_current_char >= 'A' && p_current_char <= 'F') + value = p_current_char - 'A' + 10; + p_next_char(); + return value; +} + +int p_get_hex_byte(void) { + int v; + v = p_get_hex(); + v *= 16; + v += p_get_hex(); + return v; +} + +/*=== encoding mapping ===*/ +/* the internal u8g index number (0..255) is mapped to the unicode number */ +/* for the conversion we need the reverse search */ +/* 0 is special and means not found */ +int map_u8g_to_unicode[256]; + +int map_UnicodeToU8G(int unicode) { + int i; + for (i = 0; i < 256; i++) + if (map_u8g_to_unicode[i] == unicode) + return i; + return 0; +} + +void map_Init(void) { + int i; + map_u8g_to_unicode[0] = 0; + for (i = 0; i < 256; i++) map_u8g_to_unicode[i] = i; +} + +void map_UpperLowerPage(int lower_page, int upper_page, int shift, int upper_shift) { + int i; + int encoding; + int tmp[256]; + // map_u8g_to_unicode[0] = 0; + for (i = 0; i < 128; i++) { + encoding = i + lower_page * 128; + map_u8g_to_unicode[i] = encoding; + } + + for (i = 128; i < 256; i++) { + encoding = i - 128 + upper_page * 128; + if (i + upper_shift < 256) + map_u8g_to_unicode[i + upper_shift] = encoding; + } + + for (i = 0; i < 256; i++) tmp[i] = map_u8g_to_unicode[i]; + + for (i = 0; i < shift; i++) map_u8g_to_unicode[i] = -1; + + for (i = shift; i < 256; i++) map_u8g_to_unicode[i] = tmp[(i + 256 - shift) % 256]; + /* + printf("map_u8g_to_unicode[ 32 ] = %d\n", map_u8g_to_unicode[ 32 ]); + printf("map_u8g_to_unicode[ 33 ] = %d\n", map_u8g_to_unicode[ 33 ]); + */ +} + +/*=== store bdf file positions ===*/ + +long bdf_last_line_start_pos; +long bdf_encoding_pos[256]; + +void bdf_InitFilePos(void) { + int i; + for (i = 0; i < 256; i++) bdf_encoding_pos[i] = 0; +} + +void bdf_SetFilePos(FILE *fp, int encoding) { + if (encoding < 0) + return; + if (bdf_encoding_pos[encoding] == 0L) + return; + fseek(fp, bdf_encoding_pos[encoding], SEEK_SET); + // fprintf(stderr, "setting file for encoding %d to pos %ld\n", encoding, bdf_encoding_pos[encoding]); +} + +int bdf_IsEncodingAvailable(int encoding) { + if (bdf_encoding_pos[encoding] == 0L) + // printf("encoding %d not availabe\n", encoding); + return 0; + return 1; +} + +void bdf_StoreFilePos(int encoding, long pos) { + // if ( encoding == 33 ) + // printf("encoding %d at pos %ld\n", encoding, pos); + if (bdf_encoding_pos[encoding] != 0L) + return; + bdf_encoding_pos[encoding] = pos; +} + +/*=== bdf file read ===*/ + +int bdf_font_format = 0; + +#define BDF_STATE_FONT_DATA 0 +#define BDF_STATE_ENCODING 1 + +int bdf_state = BDF_STATE_FONT_DATA; +int bdf_requested_encoding = 0; + +#define BDF_LINE_MAX (1024 * 4) +#define BDF_LINE_STATE_KEYWORDS 0 +#define BDF_LINE_STATE_BITMAP 1 +#define BDF_MAX_HEIGHT 200 +#define BDF_AA_OFFSET 1 + +char bdf_copyright[BDF_LINE_MAX]; +char bdf_font[BDF_LINE_MAX]; +unsigned char bdf_bitmap_line[BDF_MAX_HEIGHT][20]; +unsigned char bdf_aa_bitmap_line[BDF_MAX_HEIGHT + 2 * BDF_AA_OFFSET][(20 + 2 * BDF_AA_OFFSET) * 8]; + +int bdf_line_state = BDF_LINE_STATE_KEYWORDS; +int bdf_line_bm_line = 0; + +int bdf_font_size; /* point font size */ + +int bdf_font_width; /* FONTBOUNDINGBOX arg 1 */ +int bdf_font_height; /* FONTBOUNDINGBOX arg 2 */ +int bdf_font_x; /* FONTBOUNDINGBOX arg 3 */ +int bdf_font_y; /* FONTBOUNDINGBOX arg 4 */ + +int bdf_capital_A_height; +int bdf_capital_1_height; +int bdf_lower_g_descent; + +int bdf_char_width; /* BBX arg 1 */ +int bdf_char_max_width; +int bdf_char_height; /* BBX arg 2 */ +int bdf_char_ascent; /* defined as BBX arg 2 + BBX arg 4 */ +int bdf_char_xascent; +int bdf_char_xdescent; +int bdf_char_max_ascent; +int bdf_char_max_height; +int bdf_char_x; /* BBX arg 3 */ +int bdf_char_max_x; +int bdf_char_min_x; +int bdf_char_y; /* BBX arg 4 */ +int bdf_char_max_y; +int bdf_char_min_y; + +int bdf_delta_x_default = -1; +int bdf_delta_x = -1; /* DWIDTH arg 1 */ +int bdf_delta_max_x; +int bdf_delta_min_x; +int bdf_delta_y; /* DWIDTH arg 2 */ +int bdf_delta_max_y; +int bdf_delta_min_y; + +int bdf_glyph_data_len; +int bdf_glyph_data_max_len; + +int bdf_encoding; + +int bdf_encoding_65_pos; +int bdf_encoding_97_pos; +int bdf_is_encoding_successfully_done; + +char bdf_info[32000 * 2]; + +int bdf_is_put_glyph_completed = 0; /* indicator, when the glyph has been processed */ + +void bdf_ResetMax(void) { + bdf_char_max_width = 0; + bdf_char_max_height = 0; + bdf_char_max_x = 0; + bdf_char_max_y = 0; + bdf_delta_max_x = 0; + bdf_delta_max_y = 0; + bdf_char_min_x = 0; + bdf_char_min_y = 0; + bdf_delta_min_x = 0; + bdf_delta_min_y = 0; + bdf_glyph_data_max_len = 0; + bdf_char_max_ascent = 0; + bdf_char_xascent = 0; + bdf_char_xdescent = 0; +} + +void bdf_UpdateMax(void) { + if (bdf_char_max_width < bdf_char_width) + bdf_char_max_width = bdf_char_width; + if (bdf_char_max_height < bdf_char_height) + bdf_char_max_height = bdf_char_height; + + if (bdf_char_max_x < bdf_char_x) + bdf_char_max_x = bdf_char_x; + + if (bdf_char_max_y < bdf_char_y) + bdf_char_max_y = bdf_char_y; + + if (bdf_delta_max_x < bdf_delta_x) + bdf_delta_max_x = bdf_delta_x; + if (bdf_delta_max_y < bdf_delta_y) + bdf_delta_max_y = bdf_delta_y; + + if (bdf_char_min_x > bdf_char_x) + bdf_char_min_x = bdf_char_x; + + if (bdf_char_min_y > bdf_char_y) + bdf_char_min_y = bdf_char_y; + + if (bdf_delta_min_x > bdf_delta_x) + bdf_delta_min_x = bdf_delta_x; + if (bdf_delta_min_y > bdf_delta_y) + bdf_delta_min_y = bdf_delta_y; + + if (bdf_glyph_data_max_len < bdf_glyph_data_len) + bdf_glyph_data_max_len = bdf_glyph_data_len; + + if (bdf_char_max_ascent < bdf_char_ascent) + bdf_char_max_ascent = bdf_char_ascent; +} + +void bdf_ShowGlyph(void) { + #ifdef VERBOSE + int x, y, byte, bit; + int gx, gy; + char *p; + gy = bdf_char_height - 1 + bdf_char_y; + printf("bbx %d %d %d %d encoding %d\n", bdf_char_width, bdf_char_height, bdf_char_x, bdf_char_y, bdf_encoding); + for (y = 0; y < bdf_line_bm_line; y++) { + printf("%02d ", gy); + gx = bdf_char_x; + for (x = 0; x < bdf_char_width; x++) { + byte = x >> 3; + bit = 7 - (x & 7); + if ((bdf_bitmap_line[y][byte] & (1 << bit)) == 0) + p = " ."; + else + p = " *"; + if (gy == 0 && gx == 0) + p = " o"; + printf("%s", p); + gx++; + } + printf(" "); + for (x = 0; x < ((bdf_char_width + 7) / 8); x++) printf( "%02X", bdf_bitmap_line[y][x]); + gy--; + printf("\n"); + } + #else + printf("bbx %d %d %d %d encoding %d\n", bdf_char_width, bdf_char_height, bdf_char_x, bdf_char_y, bdf_encoding); + fflush(stdout); + #endif +} + +void bdf_ClearGlyphBuffer(void) { + int x, y; + for (y = 0; y < BDF_MAX_HEIGHT; y++) + for (x = 0; x < 20; x++) bdf_bitmap_line[y][x] = 0; +} + +void bdf_PutGlyph(void) { + int len; + int y, x; + + if (bdf_state == BDF_STATE_ENCODING) { + //if (bdf_char_width == 0 && bdf_char_height == 0) bdf_char_y = 0; + + bdf_char_ascent = bdf_char_height + bdf_char_y; + //printf("h:%d w:%d ascent: %d\n", bdf_char_height, bdf_char_width, bdf_char_ascent); + + if (bdf_encoding == 'A') + bdf_capital_A_height = bdf_char_height; + if (bdf_encoding == '1') + bdf_capital_1_height = bdf_char_height; + + if (bdf_encoding == 'g') + bdf_lower_g_descent = bdf_char_y; + + if (bdf_char_xascent < bdf_capital_A_height) + bdf_char_xascent = bdf_capital_A_height; + if (bdf_char_xascent < bdf_capital_1_height) + bdf_char_xascent = bdf_capital_1_height; + if (bdf_encoding == '(') + if (bdf_char_xascent < bdf_char_ascent) + bdf_char_xascent = bdf_char_ascent; + if (bdf_encoding == '[') + if (bdf_char_xascent < bdf_char_ascent) + bdf_char_xascent = bdf_char_ascent; + + if (bdf_char_xdescent > bdf_lower_g_descent) + bdf_char_xdescent = bdf_lower_g_descent; + if (bdf_encoding == '(') + if (bdf_char_xdescent > bdf_char_y) + bdf_char_xdescent = bdf_char_y; + if (bdf_encoding == '[') + if (bdf_char_xdescent > bdf_char_y) + bdf_char_xdescent = bdf_char_y; + + if (bdf_requested_encoding != bdf_encoding) + return; + + assert( bdf_line_bm_line == bdf_char_height); + + bdf_ShowGlyph(); + #ifdef VERBOSE + bdf_aa_ClearDoShow(); + #endif + + bdf_UpdateMax(); + + if (bdf_font_format <= 1) + len = (bdf_char_width + 7) / 8 * bdf_char_height; + else + len = (bdf_char_width + 2 * BDF_AA_OFFSET + 3) / 4 * (bdf_char_height + 2 * BDF_AA_OFFSET); + if (len > 255) { + fprintf(stderr, "Glyph with encoding %d is too large (%d > 255)\n", bdf_encoding, len); + exit(1); + } + + bdf_glyph_data_len = len; + + /* + format 0 and format 2 + glyph information + offset + 0 BBX width unsigned + 1 BBX height unsigned + 2 data size unsigned (BBX width + 7)/8 * BBX height + 3 DWIDTH signed + 4 BBX xoffset signed + 5 BBX yoffset signed + */ + + if (bdf_font_format == 0) { + data_Put(bdf_char_width); + data_Put(bdf_char_height); + data_Put(bdf_glyph_data_len); + data_Put(bdf_delta_x); + data_Put(bdf_char_x); + data_Put(bdf_char_y); + // data_Put(bdf_encoding); + bdf_is_encoding_successfully_done = 1; + } + else if (bdf_font_format == 2) { + data_Put(bdf_char_width + 2 * BDF_AA_OFFSET); + data_Put(bdf_char_height + 2 * BDF_AA_OFFSET); + data_Put(bdf_glyph_data_len); + data_Put(bdf_delta_x); + data_Put(bdf_char_x - BDF_AA_OFFSET); + data_Put(bdf_char_y - BDF_AA_OFFSET); + // data_Put(bdf_encoding); + bdf_is_encoding_successfully_done = 1; + } + else { + /** + * format 1 + * 0 BBX xoffset signed --> upper 4 Bit + * 0 BBX yoffset signed --> lower 4 Bit + * 1 BBX width unsigned --> upper 4 Bit + * 1 BBX height unsigned --> lower 4 Bit + * 2 data size unsigned -(BBX width + 7)/8 * BBX height --> lower 4 Bit + * 2 DWIDTH signed --> upper 4 Bit + * byte 0 == 255 indicates empty glyph + */ + if (bdf_glyph_data_len < 0 || bdf_glyph_data_len > 15) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (data len = %d)\n", bdf_encoding, bdf_glyph_data_len); + exit(1); + } + if (bdf_delta_x < 0 || bdf_delta_x > 15) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (DWIDTH = %d)\n", bdf_encoding, bdf_delta_x); + exit(1); + } + if (bdf_char_x < 0 || bdf_char_x > 15) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (x-off = %d)\n", bdf_encoding, bdf_char_x); + exit(1); + } + if (bdf_char_y < -2 || bdf_char_y > 13) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (y-off = %d [%d..%d])\n", bdf_encoding, bdf_char_y, bdf_char_min_y, bdf_char_max_y); + exit(1); + } + if (bdf_char_width < 0 || bdf_char_width > 15) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (width = %d)\n", bdf_encoding, bdf_char_width); + exit(1); + } + if (bdf_char_height < 0 || bdf_char_height > 15) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (height = %d)\n", bdf_encoding, bdf_char_height); + exit(1); + } + // data_Put(bdf_encoding); + if (((bdf_char_x << 4) | (bdf_char_y + 2)) == 255) { + fprintf(stderr, "Glyph with encoding %d does not fit for format 1 (skip mark generated)\n", bdf_encoding); + exit(1); + } + data_Put((bdf_char_x << 4) | (bdf_char_y + 2)); + data_Put((bdf_char_width << 4) | bdf_char_height ); + data_Put((bdf_delta_x << 4) | bdf_glyph_data_len ); + bdf_is_encoding_successfully_done = 1; + } + + sprintf(bdf_info + strlen(bdf_info), "/* encoding %d %c, bbx %d %d %d %d asc %d dx %d*/\n", + bdf_encoding, + bdf_encoding > 32 && bdf_encoding <= 'z' ? bdf_encoding : ' ', + bdf_char_width, + bdf_char_height, + bdf_char_x, + bdf_char_y, + bdf_char_ascent, + bdf_delta_x); + + if (bdf_font_format <= 1) { + for (y = 0; y < bdf_char_height; y++) + for (x = 0; x < ((bdf_char_width + 7) / 8); x++) { + data_Put(bdf_bitmap_line[y][x]); + len--; + } + assert( len == 0 ); + bdf_is_put_glyph_completed = 1; + } + else { /* format == 2 */ + int b, cnt; + bdf_aa_Do(); + for (y = 0; y < bdf_char_height + 2 * BDF_AA_OFFSET; y++) { + b = 0; + cnt = 0; + for (x = 0; x < bdf_char_width + 2 * BDF_AA_OFFSET; x++) { + b <<= 2; + b |= bdf_aa_bitmap_line[y][x] & 3; + cnt++; + if (cnt == 4) { + data_Put(b); + b = 0; + cnt = 0; + len--; + } + } + + if (cnt != 0) { + b <<= 2 * (4 - cnt); + data_Put(b); + b = 0; + cnt = 0; + len--; + } + } + assert( len == 0 ); + } + } +} + +/*=========================================================================*/ +/* Glyph Clipping */ + +int bdf_IsColZero(int x) { + int y, byte, bit; + for (y = 0; y < bdf_char_height; y++) { + byte = x >> 3; + bit = 7 - (x & 7); + if ((bdf_bitmap_line[y][byte] & (1 << bit)) != 0) + return 0; + } + return 1; +} + +int bdf_IsRowZero(int y) { + int x, byte, bit; + for (x = 0; x < bdf_char_width; x++) { + byte = x >> 3; + bit = 7 - (x & 7); + if ((bdf_bitmap_line[y][byte] & (1 << bit)) != 0) + return 0; + } + return 1; +} + +void bdf_DeleteFirstCol(void) { + int m = (bdf_char_width + 7) / 8; + int x, y; + for (y = 0; y < bdf_char_height; y++) + for (x = 0; x < m; x++) { + bdf_bitmap_line[y][x] <<= 1; + bdf_bitmap_line[y][x] |= bdf_bitmap_line[y][x + 1] >> 7; + } +} + +void bdf_DeleteFirstRow(void) { + int m = (bdf_char_width + 7) / 8; + int x, y; + for (y = 0; y + 1 < bdf_char_height; y++) + for (x = 0; x < m; x++) + bdf_bitmap_line[y][x] = bdf_bitmap_line[y + 1][x]; +} + +void bdf_ReduceGlyph(void) { + while (bdf_char_width > 0) { + if (bdf_IsColZero(bdf_char_width - 1) == 0) + break; + bdf_char_width--; + } + + while (bdf_char_height > 0) { + if (bdf_IsRowZero(bdf_char_height - 1) == 0) + break; + bdf_line_bm_line--; + bdf_char_height--; + bdf_char_y++; + } + + while (bdf_IsColZero(0) != 0 && bdf_char_width > 0) { + bdf_DeleteFirstCol(); + bdf_char_x++; + bdf_char_width--; + } + + while (bdf_char_height > 0) { + if (bdf_IsRowZero(0) == 0) + break; + bdf_DeleteFirstRow(); + bdf_line_bm_line--; + bdf_char_height--; + } +} + +/*=========================================================================*/ +/* Anti Aliasing / Graylevel Glyph */ + +int bdf_GetXYVal(int x, int y) { + int byte, bit; + + if (x < 0) return 0; + if (y < 0) return 0; + if (x >= bdf_char_width) return 0; + if (y >= bdf_char_height) return 0; + + byte = x >> 3; + bit = 7 - (x & 7); + if ((bdf_bitmap_line[y][byte] & (1 << bit)) != 0) return 1; + return 0; +} + +void bdf_aa_Clear(void) { + int x, y; + for (y = 0; y < BDF_MAX_HEIGHT + 2 * BDF_AA_OFFSET; y++) + for (x = 0; x < (20 + 2 * BDF_AA_OFFSET) * 8; x++) + bdf_aa_bitmap_line[y][x] = 0; +} + +void bdf_aa_SetXYVal(int x, int y, int val) { + bdf_aa_bitmap_line[y][x] = val; +} + +int bdf_aa_matrix[9] = { + 1, 3, 1, + 3, 4, 3, + 1, 3, 1 +}; +int bdf_aa_sum = 20; +int bdf_aa_gray_levels = 4; + +void bdf_aa_Do(void) { + int x, y, val, sx, sy, sum, gray; + bdf_aa_Clear(); + for (y = 0; y < bdf_char_height + 2 * BDF_AA_OFFSET; y++) + for (x = 0; x < bdf_char_width + 2 * BDF_AA_OFFSET; x++) { + if (bdf_GetXYVal(x - BDF_AA_OFFSET, y - BDF_AA_OFFSET) == 0) { + sum = 0; + for (sy = -BDF_AA_OFFSET; sy <= BDF_AA_OFFSET; sy++) + for (sx = -BDF_AA_OFFSET; sx <= BDF_AA_OFFSET; sx++) { + val = bdf_GetXYVal(x + sx - BDF_AA_OFFSET, y + sy - BDF_AA_OFFSET); + val *= bdf_aa_matrix[(sy + BDF_AA_OFFSET) * (2 * BDF_AA_OFFSET + 1) + sx + BDF_AA_OFFSET]; + sum += val; + } + if (sum <= 5) + gray = 0; + else + gray = (sum * (bdf_aa_gray_levels - 1) + (bdf_aa_sum / 2)) / bdf_aa_sum; + if (gray >= bdf_aa_gray_levels) + gray = bdf_aa_gray_levels - 1; + } + else { + gray = bdf_aa_gray_levels - 1; + } + bdf_aa_SetXYVal(x, y, gray); + } +} + +void bdf_aa_Show(void) { + int x, y; + if (bdf_font_format == 2) { + for (y = 0; y < bdf_char_height + 2 * BDF_AA_OFFSET; y++) { + for (x = 0; x < bdf_char_width + 2 * BDF_AA_OFFSET; x++) + switch (bdf_aa_bitmap_line[y][x]) { + case 0: printf("."); break; + case 1: printf("-"); break; + case 2: printf("+"); break; + case 3: printf("#"); break; + } + printf("\n"); + } + } +} + +void bdf_aa_ClearDoShow(void) { + bdf_aa_Do(); + bdf_aa_Show(); +} + +/*=========================================================================*/ +/* Parser */ + +void bdf_ReadLine(const char *s) { + /* + if ( bdf_line_state == BDF_LINE_STATE_BITMAP && bdf_requested_encoding != bdf_encoding && *s != 'E' ) + return; + */ + + if (p_first_char(s) == 0) return; + if (p_skip_space() == 0) return; + + if (bdf_line_state == BDF_LINE_STATE_KEYWORDS) { + p_get_identifier(); + if (strcmp(p_buf, "COPYRIGHT") == 0) { + p_get_any(); + strcpy(bdf_copyright, p_buf); + } + else if (strcmp(p_buf, "FONT") == 0) { + /* p_get_any(); */ + p_get_identifier_with_blank(); + strcpy(bdf_font, p_buf); + } + else if (strcmp(p_buf, "SIZE") == 0) { + bdf_font_size = p_get_val(); + } + else if (strcmp(p_buf, "ENCODING") == 0) { + bdf_encoding = map_UnicodeToU8G(p_get_val()); + bdf_StoreFilePos(bdf_encoding, bdf_last_line_start_pos); + } + else if (strcmp(p_buf, "DWIDTH") == 0) { + bdf_delta_x = p_get_val(); + bdf_delta_y = p_get_val(); + } + else if (strcmp(p_buf, "FONTBOUNDINGBOX") == 0) { + bdf_font_width = p_get_val(); + bdf_font_height = p_get_val(); + bdf_font_x = p_get_val(); + bdf_font_y = p_get_val(); + } + else if (strcmp(p_buf, "BBX") == 0) { + bdf_char_width = p_get_val(); + bdf_char_height = p_get_val(); + bdf_char_x = p_get_val(); + bdf_char_y = p_get_val(); + bdf_char_ascent = bdf_char_height + bdf_char_y; + // printf("h:%d w:%d ascent: %d\n", bdf_char_height, bdf_char_width, bdf_char_ascent); + } + else if (strcmp(p_buf, "CHARS") == 0) { + if (bdf_delta_x < 0) + bdf_delta_x = 0; + if (bdf_delta_x_default < 0) + bdf_delta_x_default = bdf_delta_x; + } + else if (strcmp(p_buf, "STARTCHAR") == 0) { + if (bdf_delta_x_default < 0) + bdf_delta_x_default = 0; + bdf_delta_x = bdf_delta_x_default; + } + else if (strcmp(p_buf, "BITMAP") == 0) { + bdf_line_state = BDF_LINE_STATE_BITMAP; + bdf_line_bm_line = 0; + } + } + else if (bdf_line_state == BDF_LINE_STATE_BITMAP) { + if (strncmp(s, "ENDCHAR", 7) == 0) { + bdf_ReduceGlyph(); + bdf_PutGlyph(); + bdf_line_state = BDF_LINE_STATE_KEYWORDS; + bdf_line_bm_line = 0; + } + else if (bdf_requested_encoding == bdf_encoding) { + int i = 0; + for (;;) { + if (p_current_char < '0') break; + bdf_bitmap_line[bdf_line_bm_line][i] = p_get_hex_byte(); + i++; + } + bdf_line_bm_line++; + assert(bdf_line_bm_line < BDF_MAX_HEIGHT); + } + } +} + +int bdf_ReadFP(FILE *fp) { + static char bdf_line[BDF_LINE_MAX]; + bdf_is_put_glyph_completed = 0; + for (;;) { + bdf_last_line_start_pos = ftell(fp); + if (fgets(bdf_line, BDF_LINE_MAX - 1, fp) == NULL) + break; + bdf_ReadLine(bdf_line); + if (bdf_is_put_glyph_completed != 0) + break; + } + return 1; +} + +int bdf_ReadFile(const char *filename, int encoding) { + int r; + FILE *fp; + fp = fopen(filename, "rb"); + if (fp != NULL) { + bdf_SetFilePos(fp, encoding); + r = bdf_ReadFP(fp); + fclose(fp); + return r; + } + return 0; /* open error */ +} + +void bdf_GenerateFontData(const char *filename, int begin, int end) { + bdf_state = BDF_STATE_FONT_DATA; + bdf_ReadFile(filename, -1); + /** + * font information + * + * offset + * 0 font format + * 1 FONTBOUNDINGBOX width unsigned + * 2 FONTBOUNDINGBOX height unsigned + * 3 FONTBOUNDINGBOX x-offset signed + * 4 FONTBOUNDINGBOX y-offset signed + * 5 Capital A Height unsigned + * 6 position of encoding 65 'A' high byte first + * 8 position of encoding 97 'a' high byte first + */ + data_Put(bdf_font_format); + data_Put(bdf_font_width); + data_Put(bdf_font_height); + data_Put(bdf_font_x); + data_Put(bdf_font_y); + data_Put(bdf_capital_A_height > 0 ? bdf_capital_A_height : bdf_capital_1_height); + data_Put(0); + data_Put(0); + data_Put(0); + data_Put(0); + data_Put(begin); + data_Put(end); /* will be overwritten later */ + data_Put(0); /* lower g descent */ + data_Put(0); /* max ascent */ + data_Put(0); /* min y = descent */ + data_Put(0); /* x ascent */ + data_Put(0); /* x descent */ +} + +void bdf_GenerateGlyph(const char *filename, int encoding) { + bdf_ClearGlyphBuffer(); + bdf_requested_encoding = encoding; + bdf_state = BDF_STATE_ENCODING; + bdf_ReadFile(filename, encoding); +} + +void bdf_Generate(const char *filename, int begin, int end) { + int i; + int last_valid_encoding; + + bdf_encoding_65_pos = 0; + bdf_encoding_97_pos = 0; + + bdf_InitFilePos(); + bdf_ResetMax(); + bdf_info[0] = '\0'; + bdf_font[0] = '\0'; + bdf_copyright[0] = '\0'; + + bdf_GenerateFontData(filename, begin, end); + for (i = begin; i <= end; i++) { + + if (i == 65) bdf_encoding_65_pos = data_pos; + if (i == 97) bdf_encoding_97_pos = data_pos; + + bdf_is_encoding_successfully_done = 0; + if (bdf_IsEncodingAvailable(i)) + bdf_GenerateGlyph(filename, i); + if (bdf_is_encoding_successfully_done == 0) + data_Put(255); /* no char encoding */ + if (bdf_is_encoding_successfully_done != 0) + last_valid_encoding = i; + } + /* data_Put(255); obsolete, not required any more for format 0 */ /* encoding 255, end of font data (format 0) */ + + data_buf[5] = bdf_capital_A_height > 0 ? bdf_capital_A_height : bdf_capital_1_height; + + data_buf[6] = (bdf_encoding_65_pos >> 8); + data_buf[7] = (bdf_encoding_65_pos & 255); + data_buf[8] = (bdf_encoding_97_pos >> 8); + data_buf[9] = (bdf_encoding_97_pos & 255); + + data_buf[12] = bdf_lower_g_descent; + data_buf[13] = bdf_char_max_ascent; + data_buf[14] = bdf_char_min_y; + data_buf[15] = bdf_char_xascent; + data_buf[16] = bdf_char_xdescent; + + if (0) data_buf[11] = last_valid_encoding; + +} + +void bdf_WriteC(const char *outname, const char *fontname) { + int capital_ascent; + FILE *out_fp; + out_fp = fopen(outname, "wb"); + assert( out_fp != NULL ); + + capital_ascent = bdf_capital_A_height > 0 ? bdf_capital_A_height : bdf_capital_1_height; + + fprintf(out_fp, "/*\n"); + fprintf(out_fp, " Fontname: %s\n", bdf_font); + fprintf(out_fp, " Copyright: %s\n", bdf_copyright); + fprintf(out_fp, " Capital A Height: %d, '1' Height: %d\n", bdf_capital_A_height, bdf_capital_1_height); + fprintf(out_fp, " Calculated Max Values w=%2d h=%2d x=%2d y=%2d dx=%2d dy=%2d ascent=%2d len=%2d\n", + bdf_char_max_width, bdf_char_max_height, bdf_char_max_x, bdf_char_max_y, bdf_delta_max_x, bdf_delta_max_y, + bdf_char_max_ascent, bdf_glyph_data_max_len); + fprintf(out_fp, " Font Bounding box w=%2d h=%2d x=%2d y=%2d\n", + bdf_font_width, bdf_font_height, bdf_font_x, bdf_font_y); + fprintf(out_fp, " Calculated Min Values x=%2d y=%2d dx=%2d dy=%2d\n", + bdf_char_min_x, bdf_char_min_y, bdf_delta_min_x, bdf_delta_min_y); + + fprintf(out_fp, " Pure Font ascent =%2d descent=%2d\n", capital_ascent, bdf_lower_g_descent); + fprintf(out_fp, " X Font ascent =%2d descent=%2d\n", bdf_char_xascent, bdf_char_xdescent); + fprintf(out_fp, " Max Font ascent =%2d descent=%2d\n", bdf_char_max_ascent, bdf_char_min_y); + + fprintf(out_fp, "*/\n"); + fprintf(out_fp, "const u8g_fntpgm_uint8_t %s[%d] U8G_FONT_SECTION(\"%s\") = {\n", fontname, data_pos, fontname); + fprintf(out_fp, " "); + data_Write(out_fp, " "); + fprintf(out_fp, "};\n"); + #ifndef BDF2U8G_COMPACT_OUTPUT + fprintf(out_fp, "%s\n", bdf_info); + #endif + + fclose(out_fp); +} + +int ga_argc; +char **ga_argv; + +void ga_remove_arg(void) { + if (ga_argc == 0) return; + ga_argc--; + ga_argv++; +} + +int ga_is_arg(char opt) { + if (ga_argc == 0) return 0; + if (ga_argv[0] == NULL) return 0; + if (ga_argv[0][0] != '-') return 0; + if (ga_argv[0][1] != opt) return 0; + ga_remove_arg(); + return 1; +} + +int main(int argc, char **argv) { + int lower_page = 0; + int upper_page = 1; + int mapping_shift = 0; + int upper_mapping_shift = 0; + int begin = 32; + int end = 255; + + if (argc < 4) { + printf("bdf to u8glib font format converter v" BDF2U8G_VERSION "\n"); + printf("%s [-l page] [-u page] [-s shift] [-S upper-shift] [-b begin] [-e end] [-f format] fontfile fontname outputfile\n", argv[0]); + return 1; + } + + ga_argc = argc; + ga_argv = argv; + ga_remove_arg(); /* remove program name */ + + for (;;) { + if (ga_is_arg('l')) { + lower_page = atoi(ga_argv[0]); + ga_remove_arg(); + } + else if (ga_is_arg('u')) { + upper_page = atoi(ga_argv[0]); + ga_remove_arg(); + } + else if (ga_is_arg('s')) { + mapping_shift = atoi(ga_argv[0]); + ga_remove_arg(); + } + else if (ga_is_arg('S')) { + upper_mapping_shift = atoi(ga_argv[0]); + ga_remove_arg(); + } + else if (ga_is_arg('b')) { + begin = atoi(ga_argv[0]); + ga_remove_arg(); + } + else if (ga_is_arg('e')) { + end = atoi(ga_argv[0]); + ga_remove_arg(); + } + else if (ga_is_arg('f')) { + bdf_font_format = atoi(ga_argv[0]); + ga_remove_arg(); + } + else { + break; + } + } + + printf("encoding range %d..%d\n", begin, end); + + data_Init(); + map_Init(); + map_UpperLowerPage(lower_page, upper_page, mapping_shift, upper_mapping_shift); + + /* + puts(bdf_font); + puts(bdf_copyright); + if (ga_argc < 3) { + printf("from page %d to page %d\n", lower_page, upper_page); + return 1; + } + */ + + bdf_Generate(ga_argv[0], begin, end); + bdf_WriteC(ga_argv[2], ga_argv[1]); + + printf("input file '%s'\n", ga_argv[0]); + printf("u8g font name '%s'\n", ga_argv[1]); + printf("output file '%s'\n", ga_argv[2]); + + return 0; +} diff --git a/buildroot/share/fonts/genallfont.sh b/buildroot/share/fonts/genallfont.sh index ebb99b273fdc..5d85c88a181c 100755 --- a/buildroot/share/fonts/genallfont.sh +++ b/buildroot/share/fonts/genallfont.sh @@ -24,18 +24,8 @@ my_getpath() { echo -n "${DN}" [[ -z "$FN" ]] || echo -n "/${FN}" } -#DN_EXEC=`echo "$0" | ${EXEC_AWK} -F/ '{b=$1; for (i=2; i < NF; i ++) {b=b "/" $(i)}; print b}'` -DN_EXEC=$(dirname $(my_getpath "$0") ) - -EXEC_WXGGEN="${DN_EXEC}/uxggenpages.sh" -# -# Locate the bdf2u8g command -# -EXEC_BDF2U8G=`which bdf2u8g` -[ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${DN_EXEC}/bdf2u8g" -[ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${PWD}/bdf2u8g" -[ -x "${EXEC_BDF2U8G}" ] || { EOL=$'\n' ; echo "ERR: Can't find bdf2u8g!${EOL}See uxggenpages.md for bdf2u8g build instructions." >&2 ; exit 1; } +DN_EXEC=$(dirname $(my_getpath "$0") ) # # Get language arguments @@ -55,33 +45,43 @@ OLDWD=`pwd` [[ -f "Configuration.h" ]] || { echo -n "cd to the 'Marlin' folder to run " ; basename $0 ; exit 1; } # -# Compile the 'genpages' command in-place +# Compile the 'genpages.exe' and 'bdf2u8g.exe' commands in-place # -(cd ${DN_EXEC}; cc -o genpages genpages.c getline.c) +if [[ ! -x "${DN_EXEC}/genpages/genpages.exe" ]]; then + echo "Building genpages.exe..." + ( cd ${DN_EXEC}/genpages ; cc -o genpages.exe genpages.c getline.c ) + [[ -x "${DN_EXEC}/genpages/genpages.exe" ]] || { echo "Build of genpages.exe failed" ; exit 1 ; } +fi + +if [[ ! -x "${DN_EXEC}/bdf2u8g/bdf2u8g.exe" ]]; then + echo "Building bdf2u8g.exe..." + ( cd ${DN_EXEC}/bdf2u8g ; make ) + [[ -x "${DN_EXEC}/bdf2u8g/bdf2u8g.exe" ]] || { echo "Build of bdf2u8g.exe failed" ; exit 1 ; } +fi # # By default loop through all languages # -LANGS_DEFAULT="an bg ca cz da de el el_CY en es eu fi fr gl hr hu it jp_kana ko_KR nl pl pt pt_br ro ru sk sv tr uk vi zh_CN zh_TW test" +LANGS_DEFAULT="an bg ca cz da de el el_CY en es eu fi fr fr_na gl hr hu it jp_kana ko_KR nl pl pt pt_br ro ru sk sv tr uk vi zh_CN zh_TW test" # # Generate data for language list MARLIN_LANGS or all if not provided # -for LANG in ${LANG_ARG:=$LANGS_DEFAULT} ; do - echo "Generating Marlin language data for '${LANG}'" >&2 - case "$LANG" in +for ALANG in ${LANG_ARG:=$LANGS_DEFAULT} ; do + echo "Generating Marlin language data for '${ALANG}'" >&2 + case "$ALANG" in zh_* ) FONTFILE="wenquanyi_12pt" ;; ko_* ) FONTFILE="${DN_EXEC}/NanumGothic.bdf" ;; * ) FONTFILE="${DN_EXEC}/marlin-6x12-3.bdf" ;; esac - DN_WORK=`mktemp -d` + DN_WORK=$(mktemp -d) cp Configuration.h ${DN_WORK}/ - cp src/lcd/language/language_${LANG}.h ${DN_WORK}/ + cp src/lcd/language/language_${ALANG}.h ${DN_WORK}/ cd "${DN_WORK}" - ${EXEC_WXGGEN} "${FONTFILE}" + ${DN_EXEC}/uxggenpages.sh "${FONTFILE}" $ALANG sed -i fontutf8-data.h -e 's|fonts//|fonts/|g' -e 's|fonts//|fonts/|g' -e 's|[/0-9a-zA-Z_\-]*buildroot/share/fonts|buildroot/share/fonts|' 2>/dev/null cd - >/dev/null - mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/fontdata/langdata_${LANG}.h + mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/fontdata/langdata_${ALANG}.h rm -rf ${DN_WORK} done @@ -89,9 +89,10 @@ done # Generate default ASCII font (char range 0-255): # Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h # +EXEC_BDF2U8G="${DN_EXEC}/bdf2u8g/bdf2u8g.exe" #if [ "${MARLIN_LANGS}" == "${LANGS_DEFAULT}" ]; then if [ 1 = 1 ]; then - DN_WORK=`mktemp -d` + DN_WORK=$(mktemp -d) cd ${DN_WORK} ${EXEC_BDF2U8G} -b 1 -e 127 ${FN_FONT} ISO10646_1_5x7 tmp1.h >/dev/null ${EXEC_BDF2U8G} -b 1 -e 255 ${FN_FONT} ISO10646_1_5x7 tmp2.h >/dev/null @@ -103,7 +104,7 @@ if [ 1 = 1 ]; then cat <src/lcd/dogm/fontdata/fontdata_ISO10646_1.h /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -139,6 +140,4 @@ EOF fi -(cd ${DN_EXEC}; rm genpages) - cd "$OLDWD" diff --git a/buildroot/share/fonts/genpages.c b/buildroot/share/fonts/genpages/genpages.c similarity index 99% rename from buildroot/share/fonts/genpages.c rename to buildroot/share/fonts/genpages/genpages.c index 8009e553fa68..dea5b05c5c80 100644 --- a/buildroot/share/fonts/genpages.c +++ b/buildroot/share/fonts/genpages/genpages.c @@ -66,7 +66,7 @@ wchar_t get_val_utf82uni(uint8_t *pstart) { */ uint8_t* get_utf8_value(uint8_t *pstart, wchar_t *pval) { uint32_t val = 0; - const uint8_t *p = pstart; + uint8_t *p = pstart; /*size_t maxlen = strlen(pstart);*/ assert(NULL != pstart); diff --git a/buildroot/share/fonts/getline.c b/buildroot/share/fonts/genpages/getline.c similarity index 100% rename from buildroot/share/fonts/getline.c rename to buildroot/share/fonts/genpages/getline.c diff --git a/buildroot/share/fonts/getline.h b/buildroot/share/fonts/genpages/getline.h similarity index 100% rename from buildroot/share/fonts/getline.h rename to buildroot/share/fonts/genpages/getline.h diff --git a/buildroot/share/fonts/get-bdf2u8g.sh b/buildroot/share/fonts/get-bdf2u8g.sh deleted file mode 100755 index 5851bf93e3a4..000000000000 --- a/buildroot/share/fonts/get-bdf2u8g.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -##################################################################### -# get-bdf2u8g.sh for Marlin -# -# This script downloads, patches, and builds bdf2u8g -# License: CC-SA -# -# Execute from within buildroot/share/fonts -# -##################################################################### - -HERE=$(pwd) - -for CMD in curl unzip patch make; do - which $CMD >/dev/null || { echo "'$CMD' is required for this script." ; exit 1 ; } -done - -[[ $HERE =~ 'buildroot/share/fonts'$ ]] || { echo "Change to buildroot/share/fonts to run $(basename $0)" ; exit 1; } - -# Download u8glib -curl -LJO https://github.com/olikraus/u8glib/archive/master.zip -unzip u8glib-master.zip >/dev/null 2>&1 - -# Patch and build bdf2u8g -cd u8glib-master/tools/font/bdf2u8g -patch -p0 <../../../../u8glib-bdf2u8g.patch bdf2u8g.c >/dev/null 2>&1 -make >/dev/null 2>&1 -mv bdf2u8g ../../../../ - -# Clean up -cd - -rm -rf u8glib-master* - -cd "$HERE" diff --git a/buildroot/share/fonts/make_lang_na.sh b/buildroot/share/fonts/make_lang_na.sh new file mode 100755 index 000000000000..d7453e282093 --- /dev/null +++ b/buildroot/share/fonts/make_lang_na.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# +# make_lang_na.sh +# +# Create non-accented language files given a list of accented language files. +# + +which gsed >/dev/null || { echo "gsed is required for this script." ; exit 1 ; } +which perl >/dev/null || { echo "perl is required for this script." ; exit 1 ; } + +# +# Get language arguments +# +[ $# ] || { echo "One or more language codes (such as 'fr') must be supplied." ; exit 1 ; } + +LANG_ARG="$@" + +# +# Change to working directory 'Marlin' +# +OLDWD=`pwd` +[[ $(basename "$OLDWD") != 'Marlin' && -d "Marlin" ]] && cd Marlin +[[ -f "Configuration.h" ]] || { echo -n "cd to the 'Marlin' folder to run " ; basename $0 ; exit 1; } + +# +# Generate a non-accented language file +# +for ALANG in $LANG_ARG ; do + echo "Generating a non-accented language for '${ALANG}'" >&2 + OUTFILE=src/lcd/language/language_${ALANG}_na.h + cp src/lcd/language/language_${ALANG}.h $OUTFILE + perl -pi -e 's/\s*#define DISPLAY_CHARSET_.+\n*//g' $OUTFILE + perl -pi -e 's/\s*constexpr .+ CHARSIZE.+\n*//g' $OUTFILE + perl -pi -e "s/namespace Language_${ALANG}/#define DISPLAY_CHARSET_ISO10646_1\n#define NOT_EXTENDED_ISO10646_1_5X7\n\nnamespace Language_${ALANG}_na/" $OUTFILE + gsed -i 'y/āáǎàâäēéěèêīíǐìïîōóǒòöôūúǔùǖǘǚǜüûĀÁǍÀĒÉĚÈÊĪÍǏÌÎŌÓǑÒÔŪÚǓÙǕǗǙǛÜÛÇçÑñ/aaaaaaeeeeeiiiiiioooooouuuuuuuuuuAAAAEEEEEIIIIIOOOOOUUUUUUUUUUCcNn/' $OUTFILE + perl -pi -e 's/ß/ss/g' $OUTFILE +done + +cd "$OLDWD" diff --git a/buildroot/share/fonts/u8glib-bdf2u8g.patch b/buildroot/share/fonts/u8glib-bdf2u8g.patch deleted file mode 100644 index 1201e99800e8..000000000000 --- a/buildroot/share/fonts/u8glib-bdf2u8g.patch +++ /dev/null @@ -1,32 +0,0 @@ -178c178 -< fprintf(out_fp, "%d", data_buf[i]); ---- -> fprintf(out_fp, "0x%02x", data_buf[i]); -180c180 -< fprintf(out_fp, "%3d", data_buf[i]); ---- -> fprintf(out_fp, "0x%02x", data_buf[i]); -487c487,488 -< int bdf_delta_x; /* DWIDTH arg 1 */ ---- -> int bdf_delta_x_default = -1; -> int bdf_delta_x = -1; /* DWIDTH arg 1 */ -1097a1099,1114 -> else if ( strcmp(p_buf, "CHARS") == 0 ) -> { -> if (bdf_delta_x < 0) { -> bdf_delta_x = 0; -> } -> if (bdf_delta_x_default < 0) { -> bdf_delta_x_default = bdf_delta_x; -> } -> } -> else if ( strcmp(p_buf, "STARTCHAR") == 0 ) -> { -> if (bdf_delta_x_default < 0) { -> bdf_delta_x_default = 0; -> } -> bdf_delta_x = bdf_delta_x_default; -> } -1293d1309 -< fprintf(out_fp, "#include \"u8g.h\"\n"); diff --git a/buildroot/share/fonts/uxggenpages.sh b/buildroot/share/fonts/uxggenpages.sh index 047d3ae661b9..2d39297b8f30 100755 --- a/buildroot/share/fonts/uxggenpages.sh +++ b/buildroot/share/fonts/uxggenpages.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash ##################################################################### -# genpages.sh for u8g +# uxggenpages.sh for u8g # # This script will generate u8g c files for specified fonts # # Copyright 2015-2018 Yunhui Fu -# License: GPL/BSD +# License: BSD ##################################################################### my_getpath() { @@ -31,16 +31,11 @@ DN_EXEC=$(dirname $(my_getpath "$0") ) ##################################################################### -EXEC_GENPAGES=${DN_EXEC}/genpages -[ -x "${EXEC_GENPAGES}" ] || EXEC_GENPAGES="$(my_getpath ${DN_EXEC}/../../../genpages)" -[ -x "${EXEC_GENPAGES}" ] || EXEC_GENPAGES=$(which genpages) +EXEC_GENPAGES=${DN_EXEC}/genpages/genpages.exe [ -x "${EXEC_GENPAGES}" ] || { echo "Error: genpages not found!" ; exit 1; } -#echo "EXEC_GENPAGES=${EXEC_GENPAGES}" -EXEC_BDF2U8G=${DN_EXEC}/bdf2u8g -[ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${DN_EXEC}/../../../bdf2u8g" -[ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G=$(which bdf2u8g) -[ -x "${EXEC_BDF2U8G}" ] || { echo "Error: bdf2u8g not found!" ; echo "Please compile u8glib/tools/font/bdf2u8g/bdf2u8g and link to it from here!"; exit 1; } +EXEC_BDF2U8G=${DN_EXEC}/bdf2u8g/bdf2u8g.exe +[ -x "${EXEC_BDF2U8G}" ] || { echo "Error: bdf2u8g not found!" ; exit 1; } DN_CUR=$(pwd) DN_DATA=$(pwd)/datatmp @@ -56,6 +51,7 @@ FN_FONT_BASE="marlin-6x12-3" #FN_FONT_BASE=wenquanyi_9pt FN_FONT="${1:-}" +LANG="$2" DN_FONT0=`dirname ${FN_FONT}` DN_FONT="$(my_getpath ${DN_FONT0})" FN_FONT="$(my_getpath "${DN_FONT}")/"`basename ${FN_FONT}` @@ -151,14 +147,14 @@ grep -Hrn _UxGT . | grep '"' \ ${EXEC_BDF2U8G} -u ${PAGE} -b ${BEGIN} -e ${END} ${FN_FONT} fontpage_${PAGE}_${BEGIN}_${END} ${DN_DATA}/fontpage_${PAGE}_${BEGIN}_${END}.h > /dev/null 2>&1 ; fi ; \ grep -A 10000000000 u8g_fntpgm_uint8_t ${DN_DATA}/fontpage_${PAGE}_${BEGIN}_${END}.h >> tmpa ; \ - echo " FONTDATA_ITEM(${PAGE}, ${BEGIN}, ${END}, fontpage_${PAGE}_${BEGIN}_${END}), // '${UTF8BEGIN}' -- '${UTF8END}'" >> tmpb ;\ + echo " FONTDATA_ITEM(${PAGE}, ${BEGIN}, ${END}, fontpage_${PAGE}_${BEGIN}_${END}), // '${UTF8BEGIN}' -- '${UTF8END}'" >> tmpb ;\ done TMPA=$(cat tmpa) TMPB=$(cat tmpb) EOL=$'\n' -[[ ! "$TMPA" == "" ]] && TMPA="$EOL$TMPA$EOL" +[[ ! "$TMPA" == "" ]] && TMPA="$TMPA$EOL$EOL" [[ ! "$TMPB" == "" ]] && TMPB="$EOL$TMPB$EOL" rm -f tmpa tmpb "proc.awk" @@ -169,8 +165,9 @@ cat <fontutf8-data.h * Contents will be REPLACED by future processing! * Use genallfont.sh to generate font data for updated languages. */ -#include -$TMPA -#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data } -static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {$TMPB}; +#pragma once + +#include "langdata.h" + +${TMPA}static const uxg_fontinfo_t g_fontinfo_${LANG}[] PROGMEM = {${TMPB}}; EOF diff --git a/buildroot/share/git/mfadd b/buildroot/share/git/mfadd index 30be1ec0f748..d6fc07bde08e 100755 --- a/buildroot/share/git/mfadd +++ b/buildroot/share/git/mfadd @@ -29,7 +29,7 @@ REPO=${INFO[2]} set -e -echo "Adding and fetching $USER..." +echo "Adding and fetching $USER/$REPO..." git remote add "$USER" "git@github.com:$USER/$REPO.git" >/dev/null 2>&1 || echo "Remote exists." git fetch "$USER" diff --git a/buildroot/share/scripts/createSpeedLookupTable.py b/buildroot/share/scripts/createSpeedLookupTable.py index da24c7c8111e..70ed953e54cd 100755 --- a/buildroot/share/scripts/createSpeedLookupTable.py +++ b/buildroot/share/scripts/createSpeedLookupTable.py @@ -19,34 +19,36 @@ cpu_freq = args.cpu_freq * 1000000 timer_freq = cpu_freq / args.divider -print("#ifndef SPEED_LOOKUPTABLE_H") -print("#define SPEED_LOOKUPTABLE_H") +print("#pragma once") print() -print('#include "MarlinCore.h"') +print("#if F_CPU == %d" % cpu_freq) print() -print("const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {") -a = [ timer_freq / ((i*256)+(args.cpu_freq*2)) for i in range(256) ] -b = [ a[i] - a[i+1] for i in range(255) ] +print(" const struct { uint16_t base; uint8_t gain; } speed_lookuptable_fast[256] PROGMEM = {") +a = [0 for i in range(8)] + [ int(0.5 + float(timer_freq) / (i*256)) for i in range(8, 256) ] +b = [0 for i in range(8)] + [ a[i] - a[i+1] for i in range(8, 255) ] b.append(b[-1]) for i in range(32): - print(" ", end=' ') + print(" ", end='') for j in range(8): - print("{%d, %d}," % (a[8*i+j], b[8*i+j]), end=' ') - print() -print("};") + print("{ %5d, %5d }," % (a[8*i+j], b[8*i+j]), end='') + if j < 7: print(" ", end='') + if i == 0: print(" // dummy first row") + else: print() +print(" };") print() -print("const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {") -a = [ timer_freq / ((i*8)+(args.cpu_freq*2)) for i in range(256) ] +print(" const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {") +a = [ int(0.5 + float(timer_freq) / ((i*8)+(args.cpu_freq*2))) for i in range(256) ] b = [ a[i] - a[i+1] for i in range(255) ] b.append(b[-1]) for i in range(32): - print(" ", end=' ') + print(" ", end='') for j in range(8): - print("{%d, %d}," % (a[8*i+j], b[8*i+j]), end=' ') + print("{ %5d, %5d }," % (a[8*i+j], b[8*i+j]), end='') + if j < 7: print(" ", end='') print() -print("};") +print(" };") print() print("#endif") diff --git a/buildroot/share/scripts/createTemperatureLookupMarlin.py b/buildroot/share/scripts/createTemperatureLookupMarlin.py index 02981f1015aa..5902e91a87d6 100755 --- a/buildroot/share/scripts/createTemperatureLookupMarlin.py +++ b/buildroot/share/scripts/createTemperatureLookupMarlin.py @@ -50,7 +50,7 @@ def __init__(self, rp, t1, r1, t2, r2, t3, r3): if c < 0: print("//////////////////////////////////////////////////////////////////////////////////////") - print("// WARNING: negative coefficient 'c'! Something may be wrong with the measurements! //") + print("// WARNING: Negative coefficient 'c'! Something may be wrong with the measurements! //") print("//////////////////////////////////////////////////////////////////////////////////////") c = -c self.c1 = a # Steinhart-Hart coefficients @@ -93,8 +93,8 @@ def main(argv): r2 = 1641.9 # resistance at middle temperature (1.6 KOhm) t3 = 250 # high temperature in Kelvin (250 degC) r3 = 226.15 # resistance at high temperature (226.15 Ohm) - rp = 4700; # pull-up resistor (4.7 kOhm) - num_temps = 36; # number of entries for look-up table + rp = 4700 # pull-up resistor (4.7 kOhm) + num_temps = 36 # number of entries for look-up table try: opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="]) @@ -125,13 +125,13 @@ def main(argv): num_temps = int(arg) t = Thermistor(rp, t1, r1, t2, r2, t3, r3) - increment = int((ARES-1)/(num_temps-1)); - step = (TMIN-TMAX) / (num_temps-1) - low_bound = t.temp(ARES-1); - up_bound = t.temp(1); + increment = int((ARES - 1) / (num_temps - 1)) + step = int((TMIN - TMAX) / (num_temps - 1)) + low_bound = t.temp(ARES - 1) + up_bound = t.temp(1) min_temp = int(TMIN if TMIN > low_bound else low_bound) max_temp = int(TMAX if TMAX < up_bound else up_bound) - temps = list(range(max_temp, TMIN+step, step)); + temps = list(range(max_temp, TMIN + step, step)) print("// Thermistor lookup table for Marlin") print("// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s" % (rp, t1, r1, t2, r2, t3, r3, num_temps)) diff --git a/buildroot/share/scripts/get_test_targets.py b/buildroot/share/scripts/get_test_targets.py new file mode 100644 index 000000000000..f51951ae12f7 --- /dev/null +++ b/buildroot/share/scripts/get_test_targets.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +""" +Extract the builds used in Github CI, so that we can run them locally +""" +import yaml + +# Set the yaml file to parse +yaml_file = '.github/workflows/test-builds.yml' + +# Parse the yaml file, and load it into a dictionary (github_configuration) +with open(yaml_file) as f: + github_configuration = yaml.safe_load(f) + +# Print out the test platforms +print(' '.join(github_configuration['jobs']['test_builds']['strategy']['matrix']['test-platform'])) diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index 09e36d64757e..8f69f5b06912 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0 +++ b/buildroot/tests/BIGTREE_GTR_V1_0 @@ -16,7 +16,8 @@ opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_ FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH \ FILAMENT_RUNOUT_SCRIPT '"M600 T%c"' opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \ - FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME + FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME \ + LCD_BED_TRAMMING BED_TRAMMING_USE_PROBE exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors w/ distinct states" "$3" restore_configs @@ -39,7 +40,7 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \ MPC_AMBIENT_XFER_COEFF '{ 0.068f, 0.068f, 0.068f }' \ MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }' \ FILAMENT_HEAT_CAPACITY_PERMM '{ 5.6e-3f, 3.6e-3f, 5.6e-3f }' -opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP MPC_EDIT_MENU MPC_AUTOTUNE_MENU +opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP MPC_EDIT_MENU MPC_AUTOTUNE MPC_AUTOTUNE_MENU opt_disable PIDTEMP exec_test $1 $2 "BigTreeTech GTR | MPC | Switching Toolhead | Tool Sensors" "$3" diff --git a/buildroot/tests/FYSETC_F6 b/buildroot/tests/FYSETC_F6 index d970a2359081..0c5f25a15517 100755 --- a/buildroot/tests/FYSETC_F6 +++ b/buildroot/tests/FYSETC_F6 @@ -7,19 +7,20 @@ set -e # -# Build with the default configurations +# Build with the default config plus DGUS_LCD_UI FYSETC # restore_configs opt_set MOTHERBOARD BOARD_FYSETC_F6_13 LCD_SERIAL_PORT 1 DGUS_LCD_UI FYSETC exec_test $1 $2 "FYSETC F6 1.3 with DGUS (FYSETC)" "$3" # -# Test IA_CREALITY +# Test DGUS_LCD_UI RELOADED # restore_configs -opt_set MOTHERBOARD BOARD_FYSETC_F6_13 LCD_SERIAL_PORT 1 DGUS_LCD_UI IA_CREALITY LCD_SCREEN_ROTATE 90 -opt_enable ADVANCED_PAUSE_FEATURE LCD_BED_TRAMMING CLASSIC_JERK BABYSTEPPING AUTO_BED_LEVELING_BILINEAR NOZZLE_PARK_FEATURE PROBE_MANUALLY -exec_test $1 $2 "FYSETC F6 1.3 with DGUS (IA_CREALITY)" "$3" +opt_set MOTHERBOARD BOARD_FYSETC_F6_13 TEMP_SENSOR_BED 2 LCD_SERIAL_PORT 1 DGUS_LCD_UI RELOADED GRID_MAX_POINTS_X 5 +opt_enable ADVANCED_PAUSE_FEATURE LCD_BED_TRAMMING CLASSIC_JERK BABYSTEPPING BABYSTEP_ALWAYS_AVAILABLE BABYSTEP_ZPROBE_OFFSET \ + BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR NOZZLE_PARK_FEATURE +exec_test $1 $2 "FYSETC F6 1.3 with DGUS (RELOADED)" "$3" # # Delta Config (generic) + UBL + ALLEN_KEY + EEPROM_SETTINGS + OLED_PANEL_TINYBOY2 @@ -38,7 +39,7 @@ restore_configs opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \ LCD_LANGUAGE vi LCD_LANGUAGE_2 fr \ X_DRIVER_TYPE TMC2160 Y_DRIVER_TYPE TMC5160 Z_DRIVER_TYPE TMC2208_STANDALONE E0_DRIVER_TYPE TMC2130 \ - X_MIN_ENDSTOP_INVERTING true Y_MIN_ENDSTOP_INVERTING true + X_MIN_ENDSTOP_HIT_STATE LOW Y_MIN_ENDSTOP_HIT_STATE LOW opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER \ MARLIN_BRICKOUT MARLIN_INVADERS MARLIN_SNAKE \ MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD \ @@ -58,12 +59,12 @@ exec_test $1 $2 "RAMPS 1.3 | DELTA | FLSUN AC Config" "$3" use_example_configs SCARA/Morgan opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \ LCD_LANGUAGE es \ - X_MAX_ENDSTOP_INVERTING false \ + X_MAX_ENDSTOP_HIT_STATE HIGH \ X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2130 Z_DRIVER_TYPE TMC2130_STANDALONE E0_DRIVER_TYPE TMC2660 \ X_HARDWARE_SERIAL Serial2 opt_enable USE_ZMIN_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR PAUSE_BEFORE_DEPLOY_STOW \ FYSETC_242_OLED_12864 EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL Z_SAFE_HOMING \ - STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING SQUARE_WAVE_STEPPING + STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING EDGE_STEPPING exec_test $1 $2 "FYSETC_F6 | SCARA | Mixed TMC | EEPROM" "$3" # clean up diff --git a/buildroot/tests/LPC1769 b/buildroot/tests/LPC1769 index b3348c6d6528..cf2838bdd5d6 100755 --- a/buildroot/tests/LPC1769 +++ b/buildroot/tests/LPC1769 @@ -18,7 +18,7 @@ opt_set MOTHERBOARD BOARD_SMOOTHIEBOARD \ GRID_MAX_POINTS_X 16 \ NOZZLE_CLEAN_START_POINT "{ { 10, 10, 3 }, { 10, 10, 3 } }" \ NOZZLE_CLEAN_END_POINT "{ { 10, 20, 3 }, { 10, 20, 3 } }" -opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING TEMP_TUNING_MAINTAIN_FAN \ +opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING REPORT_ADAPTIVE_FAN_SLOWING TEMP_TUNING_MAINTAIN_FAN \ MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \ MAG_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BED_TRAMMING_USE_PROBE BED_TRAMMING_VERIFY_RAISED \ diff --git a/buildroot/tests/SAMD21_minitronics20 b/buildroot/tests/SAMD21_minitronics20 index b46fb9f08ab3..f4a75afafea7 100755 --- a/buildroot/tests/SAMD21_minitronics20 +++ b/buildroot/tests/SAMD21_minitronics20 @@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \ SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \ MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \ LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \ - SQUARE_WAVE_STEPPING + EDGE_STEPPING exec_test $1 $2 "Minitronics 2.0 with assorted features" "$3" # clean up diff --git a/buildroot/tests/SAMD51_grandcentral_m4 b/buildroot/tests/SAMD51_grandcentral_m4 index 042733072ddc..72996e7b7f3a 100755 --- a/buildroot/tests/SAMD51_grandcentral_m4 +++ b/buildroot/tests/SAMD51_grandcentral_m4 @@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \ MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \ LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \ - SQUARE_WAVE_STEPPING TMC_DEBUG + EDGE_STEPPING TMC_DEBUG exec_test $1 $2 "Grand Central M4 with assorted features" "$3" # clean up diff --git a/buildroot/tests/STM32F103RC_btt b/buildroot/tests/STM32F103RC_btt index 16419cbfa232..95a18c615ff8 100755 --- a/buildroot/tests/STM32F103RC_btt +++ b/buildroot/tests/STM32F103RC_btt @@ -12,8 +12,8 @@ set -e restore_configs opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_E3_V1_0 SERIAL_PORT 1 SERIAL_PORT_2 -1 \ X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209 Z_DRIVER_TYPE TMC2209 E0_DRIVER_TYPE TMC2209 -opt_enable PINS_DEBUGGING Z_IDLE_HEIGHT -exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - Basic Config with TMC2209 HW Serial" "$3" +opt_enable PINS_DEBUGGING Z_IDLE_HEIGHT FT_MOTION +exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - TMC2209 HW Serial, FT_MOTION" "$3" # clean up restore_configs diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index 8c0a40d8ae22..a05f1d96bebb 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -28,7 +28,7 @@ opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED exec_test $1 $2 "Ender-3 S1 with ProUI (PIDTEMP)" "$3" opt_disable PIDTEMP -opt_enable MPCTEMP +opt_enable MPCTEMP MPC_AUTOTUNE exec_test $1 $2 "Ender-3 S1 with ProUI (MPCTEMP)" "$3" restore_configs @@ -38,5 +38,12 @@ opt_enable NOZZLE_AS_PROBE Z_SAFE_HOMING Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN FAN_ PROBE_ACTIVATION_SWITCH PROBE_TARE PROBE_TARE_ONLY_WHILE_INACTIVE exec_test $1 $2 "Creality V4.5.2 PROBE_ACTIVATION_SWITCH, Probe Tare" "$3" +restore_configs +opt_set MOTHERBOARD BOARD_CREALITY_V422 SERIAL_PORT 1 DGUS_LCD_UI IA_CREALITY +opt_enable NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE LCD_BED_TRAMMING CLASSIC_JERK BABYSTEPPING \ + AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY FAN_SOFT_PWM +opt_add NO_CREALITY_422_DRIVER_WARNING NO_AUTO_ASSIGN_WARNING +exec_test $1 $2 "Creality V4.2.2 with IA_CREALITY" "$3" + # clean up restore_configs diff --git a/buildroot/tests/linux_native b/buildroot/tests/linux_native index 0153687eacb7..268de8fd2b93 100755 --- a/buildroot/tests/linux_native +++ b/buildroot/tests/linux_native @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_LINUX_RAMPS TEMP_SENSOR_BED 1 +opt_set MOTHERBOARD BOARD_SIMULATED TEMP_SENSOR_BED 1 opt_enable PIDTEMPBED EEPROM_SETTINGS BAUD_RATE_GCODE exec_test $1 $2 "Linux with EEPROM" "$3" diff --git a/buildroot/tests/mega1280 b/buildroot/tests/mega1280 index 5bf37289ba61..d948623f4872 100755 --- a/buildroot/tests/mega1280 +++ b/buildroot/tests/mega1280 @@ -55,8 +55,8 @@ exec_test $1 $2 "RAMPS | DELTA | RRD LCD | DELTA_AUTO_CALIBRATION | DELTA_CALIBR # use_example_configs delta/generic opt_set LCD_LANGUAGE cz \ - Z_MIN_PROBE_ENDSTOP_INVERTING false \ - Z_MIN_ENDSTOP_INVERTING false + Z_MIN_PROBE_ENDSTOP_HIT_STATE HIGH \ + Z_MIN_ENDSTOP_HIT_STATE HIGH opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER DELTA_CALIBRATION_MENU AUTO_BED_LEVELING_BILINEAR BLTOUCH exec_test $1 $2 "DELTA | RRD LCD | ABL Bilinear | BLTOUCH" "$3" diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index bd855f1df111..c2a3452e67e8 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -44,7 +44,8 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO LCD_LANGUAGE jp_kana DEFAULT_EJERK 10 \ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI SHOW_CUSTOM_BOOTSCREEN BOOT_MARLIN_LOGO_SMALL \ SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES \ SDSUPPORT LONG_FILENAME_WRITE_SUPPORT SDCARD_SORT_ALPHA NO_SD_AUTOSTART USB_FLASH_DRIVE_SUPPORT CANCEL_OBJECTS \ - Z_PROBE_SLED AUTO_BED_LEVELING_UBL UBL_HILBERT_CURVE RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT \ + Z_PROBE_SLED AUTO_BED_LEVELING_UBL UBL_HILBERT_CURVE UBL_TILT_ON_MESH_POINTS UBL_TILT_ON_MESH_POINTS_3POINT \ + RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT \ EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN \ MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE QUICK_HOME \ NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL \ @@ -62,12 +63,13 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO NUM_SERVOS 1 \ NUM_RUNOUT_SENSORS 5 FIL_RUNOUT2_PIN 44 FIL_RUNOUT3_PIN 45 FIL_RUNOUT4_PIN 46 FIL_RUNOUT5_PIN 47 \ FIL_RUNOUT3_STATE HIGH FILAMENT_RUNOUT_SCRIPT '"M600 T%c"' opt_enable VIKI2 BOOT_MARLIN_LOGO_ANIMATED SDSUPPORT AUTO_REPORT_SD_STATUS \ - Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE \ + Z_PROBE_SERVO_NR Z_SERVO_ANGLES Z_SERVO_MEASURE_ANGLE DEACTIVATE_SERVOS_AFTER_MOVE Z_SERVO_DEACTIVATE_AFTER_STOW \ + AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE PROBE_PT_1 PROBE_PT_2 PROBE_PT_3 \ EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL AUTO_REPORT_POSITION \ NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \ DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \ FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULLUP -exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states" "$3" +exec_test $1 $2 "Z Servo Probe | Multiple runout sensors (x5)" "$3" # @@ -80,7 +82,7 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING_X INPUT_SHAPING_Y -opt_disable DISABLE_INACTIVE_EXTRUDER +opt_disable DISABLE_OTHER_EXTRUDERS exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping | Greek" "$3" # diff --git a/buildroot/tests/melzi_optiboot b/buildroot/tests/melzi_optiboot new file mode 100755 index 000000000000..f31c69cdcb6d --- /dev/null +++ b/buildroot/tests/melzi_optiboot @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# +# Build tests for melzi_optiboot +# + +# exit on first failure +set -e + +# +# Ender 2 +# +use_example_configs Creality/Ender-2 +exec_test $1 $2 "Ender 2" "$3" + +# clean up +restore_configs diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index 9a017c971fbb..ca6aae471f09 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -15,7 +15,7 @@ opt_set MOTHERBOARD BOARD_RAMBO \ TEMP_SENSOR_PROBE 1 TEMP_PROBE_PIN 12 \ TEMP_SENSOR_CHAMBER 3 TEMP_CHAMBER_PIN 3 HEATER_CHAMBER_PIN 45 \ GRID_MAX_POINTS_X 16 AUTO_POWER_E_TEMP 80 \ - FANMUX0_PIN 53 + FANMUX0_PIN 53 FIL_MOTION1_PIN 45 opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN USE_WATCHDOG opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ FIX_MOUNTED_PROBE CODEPENDENT_XY_HOMING PIDTEMPBED PTC_PROBE PTC_BED \ @@ -25,7 +25,7 @@ opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_P NEOPIXEL_LED NEOPIXEL_PIN CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \ PID_PARAMS_PER_HOTEND PID_AUTOTUNE_MENU PID_EDIT_MENU PID_EXTRUSION_SCALING LCD_SHOW_E_TOTAL \ PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 LCD_BED_TRAMMING BED_TRAMMING_INCLUDE_CENTER \ - NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \ + NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM FILAMENT_MOTION_SENSOR FILAMENT_SWITCH_AND_MOTION \ ADVANCED_PAUSE_FEATURE FILAMENT_LOAD_UNLOAD_GCODES FILAMENT_UNLOAD_ALL_EXTRUDERS \ PASSWORD_FEATURE PASSWORD_ON_STARTUP PASSWORD_ON_SD_PRINT_MENU PASSWORD_AFTER_SD_PRINT_END PASSWORD_AFTER_SD_PRINT_ABORT \ AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DISTINCT_E_FACTORS \ @@ -125,7 +125,7 @@ opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \ SD_ABORT_ON_ENDSTOP_HIT HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT HOST_PAUSE_M76 ADVANCED_OK M114_DETAIL \ VOLUMETRIC_DEFAULT_ON NO_WORKSPACE_OFFSETS EXTRA_FAN_SPEED FWRETRACT \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_USE_Z_ONLY -opt_disable DISABLE_INACTIVE_EXTRUDER +opt_disable DISABLE_OTHER_EXTRUDERS exec_test $1 $2 "Rambo | CoreXY, Gradient Mix | Endstop Int. | Home Y > X | FW Retract ..." "$3" # clean up diff --git a/buildroot/tests/teensy35 b/buildroot/tests/teensy35 index ec12082909f9..fd6ae86387f7 100755 --- a/buildroot/tests/teensy35 +++ b/buildroot/tests/teensy35 @@ -68,7 +68,7 @@ exec_test $1 $2 "PARKING_EXTRUDER with LCD" "$3" restore_configs opt_set MOTHERBOARD BOARD_TEENSY35_36 MIXING_STEPPERS 2 opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1 GRADIENT_MIX GRADIENT_VTOOL REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER -opt_disable DISABLE_INACTIVE_EXTRUDER +opt_disable DISABLE_OTHER_EXTRUDERS exec_test $1 $2 "Mixing Extruder" "$3" # @@ -85,7 +85,7 @@ exec_test $1 $2 "Mixing Extruder" "$3" restore_configs opt_set MOTHERBOARD BOARD_TEENSY35_36 \ X_DRIVER_TYPE TMC5160 Y_DRIVER_TYPE TMC5160 \ - X_MIN_ENDSTOP_INVERTING true Y_MIN_ENDSTOP_INVERTING true \ + X_MIN_ENDSTOP_HIT_STATE LOW Y_MIN_ENDSTOP_HIT_STATE LOW \ X_CS_PIN 46 Y_CS_PIN 47 opt_enable COREXY USE_ZMIN_PLUG MONITOR_DRIVER_STATUS SENSORLESS_HOMING exec_test $1 $2 "Teensy 3.5/3.6 COREXY" "$3" diff --git a/buildroot/tests/teensy41 b/buildroot/tests/teensy41 index 56bd5043c736..11b5e340258e 100755 --- a/buildroot/tests/teensy41 +++ b/buildroot/tests/teensy41 @@ -71,7 +71,7 @@ exec_test $1 $2 "Ethernet, EEPROM, Magnetic Parking Extruder, No LCD" "$3" restore_configs opt_set MOTHERBOARD BOARD_TEENSY41 MIXING_STEPPERS 2 opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1 GRADIENT_MIX GRADIENT_VTOOL -opt_disable DISABLE_INACTIVE_EXTRUDER +opt_disable DISABLE_OTHER_EXTRUDERS exec_test $1 $2 "Mixing Extruder" "$3" # @@ -88,7 +88,7 @@ exec_test $1 $2 "Mixing Extruder" "$3" restore_configs opt_set MOTHERBOARD BOARD_TEENSY41 \ X_DRIVER_TYPE TMC5160 Y_DRIVER_TYPE TMC5160 \ - X_MIN_ENDSTOP_INVERTING true Y_MIN_ENDSTOP_INVERTING true \ + X_MIN_ENDSTOP_HIT_STATE LOW Y_MIN_ENDSTOP_HIT_STATE LOW \ X_CS_PIN 46 Y_CS_PIN 47 opt_enable COREXY USE_ZMIN_PLUG MONITOR_DRIVER_STATUS SENSORLESS_HOMING exec_test $1 $2 "Teensy 4.0/4.1 COREXY" "$3" diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index a85e0f831507..000000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: "3.8" -services: - # The main image: this doesn't run any particular command, but is mainly used - # for running tests locally - marlin: - image: marlin-dev - build: - dockerfile: Dockerfile - context: docker - working_dir: /code - volumes: - - .:/code - - platformio-cache:/root/.platformio - -volumes: - # This volume holds installed libraries for PlatformIO. If this is deleted you - # will have to download all the dependencies again, which can be a very slow - # process - platformio-cache: diff --git a/docker/Dockerfile b/docker/Dockerfile index 7d32f9c63758..c01ca76ebbb3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,24 @@ FROM python:3.9.0-buster -RUN pip install -U platformio +# Disable warnings about not having a TTY +ARG DEBIAN_FRONTEND=noninteractive + +# Disable debconf warnings +ARG DEBCONF_NOWARNINGS="yes" + +# Upgrade pip +RUN pip install --upgrade pip + +# Install platformio toolchain / framework and pyyaml +RUN pip install -U platformio PyYaml + +# Upgrade platformio using development version / branch RUN pio upgrade --dev -# To get the test platforms -RUN pip install PyYaml + +# Set working directory +WORKDIR /code + +# Set volumes / mount points that we are using +VOLUME /code /root/.platformio + #ENV PATH /code/buildroot/bin/:/code/buildroot/tests/:${PATH} diff --git a/get_test_targets.py b/get_test_targets.py deleted file mode 100755 index a38e3a594adf..000000000000 --- a/get_test_targets.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -""" -Extract the builds used in Github CI, so that we can run them locally -""" -import yaml - - -with open('.github/workflows/test-builds.yml') as f: - github_configuration = yaml.safe_load(f) -test_platforms = github_configuration\ - ['jobs']['test_builds']['strategy']['matrix']['test-platform'] -print(' '.join(test_platforms)) diff --git a/ini/avr.ini b/ini/avr.ini index a594a6aab6d0..64ccfbddb16e 100644 --- a/ini/avr.ini +++ b/ini/avr.ini @@ -13,8 +13,9 @@ # AVR (8-bit) Common Environment values # [common_avr8] -platform = atmelavr@~3.4 +platform = atmelavr@~4.0.1 build_flags = ${common.build_flags} -Wl,--relax +build_src_flags = -std=gnu++1z board_build.f_cpu = 16000000L build_src_filter = ${common.default_src_filter} + upload_protocol = usbasp @@ -57,7 +58,7 @@ extends = common_avr8 board_build.variant = MARLIN_MEGA_EXTENDED extra_scripts = ${env:mega2560ext.extra_scripts} upload_speed = 57600 -build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues +build_flags = ${common_avr8.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -mcall-prologues # # MightyBoard ATmega1280 @@ -107,7 +108,7 @@ board_upload.maximum_size = 126976 # [tuned_1284p] -build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues +build_flags = ${common_avr8.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -mcall-prologues [env:sanguino1284p_optimized] extends = env:sanguino1284p diff --git a/ini/features.ini b/ini/features.ini index c9c752865808..d8ba74f2db20 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -60,8 +60,8 @@ MARLIN_INVADERS = src_filter=+ MARLIN_SNAKE = src_filter=+ HAS_MENU_BACKLASH = src_filter=+ -HAS_MENU_BED_CORNERS = src_filter=+ LCD_BED_LEVELING = src_filter=+ +HAS_MENU_BED_TRAMMING = src_filter=+ HAS_MENU_CANCELOBJECT = src_filter=+ HAS_MENU_DELTA_CALIBRATE = src_filter=+ HAS_MENU_FILAMENT = src_filter=+ @@ -78,9 +78,10 @@ HAS_MENU_CUTTER = src_filter=+ HAS_MENU_TMC = src_filter=+ HAS_MENU_TOUCH_SCREEN = src_filter=+ -HAS_MENU_TRAMMING = src_filter=+ +HAS_MENU_TRAMMING_WIZARD = src_filter=+ HAS_MENU_UBL = src_filter=+ ANYCUBIC_LCD_CHIRON = src_filter=+ +ANYCUBIC_LCD_VYPER = src_filter=+ ANYCUBIC_LCD_I3MEGA = src_filter=+ HAS_DGUS_LCD_CLASSIC = src_filter=+ DGUS_LCD_UI_RELOADED = src_filter=+ @@ -185,10 +186,11 @@ AIR_EVACUATION = src_filter=+ SERVO_DETACH_GCODE = src_filter=+ HAS_DUPLICATION_MODE = src_filter=+ +FT_MOTION = src_filter=+ + LIN_ADVANCE = src_filter=+ PHOTO_GCODE = src_filter=+ CONTROLLER_FAN_EDITABLE = src_filter=+ -HAS_SHAPING = src_filter=+ +HAS_ZV_SHAPING = src_filter=+ GCODE_MACROS = src_filter=+ GRADIENT_MIX = src_filter=+ HAS_SAVED_POSITIONS = src_filter=+ + @@ -205,6 +207,7 @@ HAS_GCODE_M876 = src_filter=+ HAS_RESUME_CONTINUE = src_filter=+ SET_PROGRESS_MANUALLY = src_filter=+ HAS_STATUS_MESSAGE = src_filter=+ +HAS_PREHEAT = src_filter=+ HAS_LCD_CONTRAST = src_filter=+ HAS_GCODE_M255 = src_filter=+ HAS_LCD_BRIGHTNESS = src_filter=+ diff --git a/ini/native.ini b/ini/native.ini index 6a0cce38e804..481dac1777bd 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -43,7 +43,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/refs/heads/bugfix-2.0.x.zip + MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/refs/heads/bugfix-2.1.x.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/master.zip extra_scripts = ${common.extra_scripts} diff --git a/ini/renamed.ini b/ini/renamed.ini index cd890b593cb5..ae1b5742b5e0 100644 --- a/ini/renamed.ini +++ b/ini/renamed.ini @@ -53,3 +53,21 @@ extends = renamed [env:mks_robin_nano35_maple] ;=> mks_robin_nano_v1v2_maple extends = renamed + +[env:BIGTREE_OCTOPUS_V1] ;=> STM32F446ZE_btt +extends = renamed + +[env:BIGTREE_OCTOPUS_V1_USB] ;=> STM32F446ZE_btt_USB +extends = renamed + +[env:BIGTREE_OCTOPUS_PRO_V1_F429] ;=> STM32F429ZG_btt +extends = renamed + +[env:BIGTREE_OCTOPUS_PRO_V1_F429_USB] ;=> STM32F429ZG_btt_USB +extends = renamed + +[env:BIGTREE_OCTOPUS_V1_F407] ;=> STM32F407ZE_btt +extends = renamed + +[env:BIGTREE_OCTOPUS_V1_F407_USB] ;=> STM32F407ZE_btt_USB +extends = renamed diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index d06e95750a06..d361a0d40a98 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -61,7 +61,7 @@ monitor_speed = 115200 [env:STM32F103RC_meeb_maple] extends = env:STM32F103RC_maple board = marlin_maple_MEEB_3DP -build_flags = ${STM32F1_maple.build_flags} +build_flags = ${env:STM32F103RC_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 -DSTM32_FLASH_SIZE=512 @@ -70,10 +70,10 @@ build_flags = ${STM32F1_maple.build_flags} -DVECT_TAB_OFFSET=0x2000 -DGENERIC_BOOTLOADER board_build.ldscript = STM32F103RC_MEEB_3DP.ld -extra_scripts = ${STM32F1_maple.extra_scripts} +extra_scripts = ${env:STM32F103RC_maple.extra_scripts} pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py -lib_deps = ${STM32F1_maple.lib_deps} +lib_deps = ${env:STM32F103RC_maple.lib_deps} USBComposite for STM32F1@0.91 custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use debug_tool = stlink @@ -84,9 +84,9 @@ upload_protocol = dfu # [env:STM32F103RC_fysetc_maple] extends = env:STM32F103RC_maple -extra_scripts = ${STM32F1_maple.extra_scripts} +extra_scripts = ${env:STM32F103RC_maple.extra_scripts} buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py -build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 +build_flags = ${env:STM32F103RC_maple.build_flags} -DDEBUG_LEVEL=0 lib_ldf_mode = chain debug_tool = stlink upload_protocol = serial @@ -101,7 +101,7 @@ upload_protocol = serial extends = env:STM32F103RC_maple board_build.address = 0x08007000 board_build.ldscript = STM32F103RC_SKR_MINI_256K.ld -build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 +build_flags = ${env:STM32F103RC_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 monitor_speed = 115200 [env:STM32F103RC_btt_USB_maple] @@ -115,10 +115,10 @@ lib_deps = ${env:STM32F103RC_btt_maple.lib_deps} # [env:STM32F103RE_creality_maple] extends = env:STM32F103RE_maple -build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 +build_flags = ${env:STM32F103RE_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = creality.ld -extra_scripts = ${STM32F1_maple.extra_scripts} +extra_scripts = ${env:STM32F103RE_maple.extra_scripts} pre:buildroot/share/PlatformIO/scripts/random-bin.py debug_tool = jlink upload_protocol = jlink @@ -128,10 +128,10 @@ upload_protocol = jlink # [env:STM32F103RC_creality_maple] extends = env:STM32F103RC_maple -build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 +build_flags = ${env:STM32F103RC_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = creality.ld -extra_scripts = ${STM32F1_maple.extra_scripts} +extra_scripts = ${env:STM32F103RC_maple.extra_scripts} pre:buildroot/share/PlatformIO/scripts/random-bin.py debug_tool = jlink upload_protocol = jlink @@ -154,14 +154,14 @@ board_build.ldscript = crealityPro.ld extends = env:STM32F103RE_maple board_build.address = 0x08007000 board_build.ldscript = STM32F103RE_SKR_MINI_512K.ld -build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 +build_flags = ${env:STM32F103RE_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 debug_tool = stlink upload_protocol = stlink [env:STM32F103RE_btt_USB_maple] extends = env:STM32F103RE_btt_maple build_flags = ${env:STM32F103RE_btt_maple.build_flags} -DUSE_USB_COMPOSITE -lib_deps = ${STM32F1_maple.lib_deps} +lib_deps = ${env:STM32F103RE_btt_maple.lib_deps} USBComposite for STM32F1@0.91 # @@ -238,7 +238,6 @@ board_build.ldscript = mks_robin_pro.ld # [env:trigorilla_pro_maple] extends = env:mks_robin_maple -extra_scripts = ${STM32F1_maple.extra_scripts} # # MKS Robin E3D (STM32F103RCT6) and @@ -352,7 +351,6 @@ build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 extends = STM32F1_maple platform_packages = tool-stm32duino board_build.address = 0x08005000 -board_build.offset = 0x5000 board_upload.maximum_size = 237568 build_flags = ${STM32F1_maple.build_flags} -D__STM32F1__=1 -DDEBUG_LEVEL=0 -DSS_TIMER=4 -DSERIAL_USB @@ -393,3 +391,17 @@ board_build.variant = MARLIN_F103Vx board_build.ldscript = eryone_ery32_mini.ld board_build.address = 0x08004000 build_unflags = ${STM32F1_maple.build_unflags} + +# +# Sovol (GD32F103RET6) +# +[env:GD32F103RET6_sovol_maple] +extends = env:STM32F103RE_maple +build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 +board_build.address = 0x08007000 +board_build.ldscript = sovol.ld +extra_scripts = ${STM32F1_maple.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/random-bin.py + buildroot/share/PlatformIO/scripts/custom_board.py +debug_tool = jlink +upload_protocol = jlink diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 1adc83a8f999..783d05fab4e6 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -134,6 +134,16 @@ monitor_speed = 115200 debug_tool = jlink upload_protocol = jlink +# +# Trigorilla V0.0.6 (GD32F103) +# modified version of env:STM32F103RE_creality +# +[env:trigorilla_v006] +extends = STM32F103Rx_creality +board = genericSTM32F103RE +board_build.offset = 0x8000 +board_upload.offset_address = 0x08008000 + # # Creality (STM32F103Rx) # With custom upload to SD via Marlin with binary protocol. diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 05a549bec7d8..e9b9a956ded2 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -269,7 +269,7 @@ build_unflags = ${env:BIGTREE_SKR_2_F429_USB.build_unflags} -Os -NDEBUG # # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) # -[env:BIGTREE_OCTOPUS_V1] +[env:STM32F446ZE_btt] extends = stm32_variant board = marlin_BigTree_Octopus_v1 board_build.offset = 0x8000 @@ -282,8 +282,8 @@ build_flags = ${stm32_variant.build_flags} # # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) with USB Flash Drive Support # -[env:BIGTREE_OCTOPUS_V1_USB] -extends = env:BIGTREE_OCTOPUS_V1 +[env:STM32F446ZE_btt_USB] +extends = env:STM32F446ZE_btt platform_packages = ${stm_flash_drive.platform_packages} build_unflags = -DUSBD_USE_CDC build_flags = ${stm_flash_drive.build_flags} @@ -293,9 +293,9 @@ build_flags = ${stm_flash_drive.build_flags} -DUSBD_USE_CDC_MSC # -# BigTreeTech Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) +# BigTreeTech Octopus V1.1 / Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) # -[env:BIGTREE_OCTOPUS_PRO_V1_F429] +[env:STM32F429ZG_btt] extends = stm32_variant board = marlin_BigTree_Octopus_Pro_v1_F429 board_build.offset = 0x8000 @@ -306,10 +306,10 @@ build_flags = ${stm32_variant.build_flags} -DUSE_USB_HS_IN_FS # -# BigTreeTech Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) with USB Flash Drive Support +# BigTreeTech Octopus V1.1 / Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) with USB Flash Drive Support # -[env:BIGTREE_OCTOPUS_PRO_V1_F429_USB] -extends = env:BIGTREE_OCTOPUS_PRO_V1_F429 +[env:STM32F429ZG_btt_USB] +extends = env:STM32F429ZG_btt platform_packages = ${stm_flash_drive.platform_packages} build_unflags = -DUSBD_USE_CDC build_flags = ${stm_flash_drive.build_flags} @@ -320,7 +320,7 @@ build_flags = ${stm_flash_drive.build_flags} # # BigTreeTech Octopus / Octopus Pro (STM32F407ZET6 ARM Cortex-M4) # -[env:BIGTREE_OCTOPUS_V1_F407] +[env:STM32F407ZE_btt] extends = stm32_variant board = marlin_STM32F407ZE board_build.offset = 0x8000 @@ -330,8 +330,8 @@ build_flags = ${stm32_variant.build_flags} # # BigTreeTech Octopus / Octopus Pro (STM32F407ZET6 ARM Cortex-M4) with USB Flash Drive Support # -[env:BIGTREE_OCTOPUS_V1_F407_USB] -extends = env:BIGTREE_OCTOPUS_V1_F407 +[env:STM32F407ZE_btt_USB] +extends = env:STM32F407ZE_btt platform_packages = ${stm_flash_drive.platform_packages} build_unflags = -DUSBD_USE_CDC build_flags = ${stm_flash_drive.build_flags} @@ -726,12 +726,10 @@ upload_command = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE" # STM32F446ZET6 ARM Cortex-M4 # [env:STM32F446_tronxy] -platform = ${common_stm32.platform} extends = stm32_variant board = marlin_STM32F446ZET_tronxy board_build.offset = 0x10000 board_build.rename = fmw_tronxy.bin -build_src_filter = ${common_stm32.build_src_filter} build_flags = ${stm32_variant.build_flags} -DSTM32F4xx build_unflags = ${stm32_variant.build_unflags} -fno-rtti diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index d00d374c61ed..5733d35bf0fd 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -44,7 +44,7 @@ debug_tool = cmsis-dap # [env:STM32H743Vx_btt] extends = stm32_variant -platform = ststm32@~15.4.1 +platform = ststm32@15.4.1 platform_packages = framework-arduinoststm32@~4.20200.220530 board = marlin_STM32H743Vx board_build.offset = 0x20000 @@ -59,3 +59,56 @@ build_flags = ${stm32_variant.build_flags} -DD_CACHE_DISABLED upload_protocol = cmsis-dap debug_tool = cmsis-dap + +# +# BigTreeTech SKR V3.0 / SKR V3.0 EZ (STM32H723VGT6 ARM Cortex-M7) +# BigTreeTech Octopus Max EZ V1.0 (STM32H723VET6 ARM Cortex-M7) +# +[env:STM32H723Vx_btt] +extends = stm32_variant +platform = ststm32@15.4.1 +platform_packages = framework-arduinoststm32@~4.20200.220530 +board = marlin_STM32H723Vx +board_build.offset = 0x20000 +board_upload.offset_address = 0x08020000 +build_flags = ${stm32_variant.build_flags} + -DPIN_SERIAL1_RX=PA_10 -DPIN_SERIAL1_TX=PA_9 + -DPIN_SERIAL2_RX=PD_6 -DPIN_SERIAL2_TX=PD_5 + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 + -DPIN_SERIAL4_RX=PA_1 -DPIN_SERIAL4_TX=PA_0 + -DPIN_SERIAL7_RX=PE_7 -DPIN_SERIAL7_TX=PE_8 + -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 + -DTIMER_SERVO=TIM5 -DTIMER_TONE=TIM2 + -DSTEP_TIMER_IRQ_PRIO=0 + -DRCC_PERIPHCLK_I2C35=RCC_PERIPHCLK_I2C5 + -DUSE_USB_HS -DUSE_USB_HS_IN_FS + -DD_CACHE_DISABLED + -UI2C5_BASE +upload_protocol = cmsis-dap +debug_tool = cmsis-dap + +# +# BigTreeTech Octopus Pro V1.0 / Octopus Max EZ V1.0 (STM32H723ZET6 ARM Cortex-M7) +# +[env:STM32H723Zx_btt] +extends = stm32_variant +platform = ststm32@15.4.1 +platform_packages = framework-arduinoststm32@~4.20200.220530 +board = marlin_STM32H723Zx +board_build.offset = 0x20000 +board_upload.offset_address = 0x08020000 +build_flags = ${stm32_variant.build_flags} + -DPIN_SERIAL1_RX=PA_10 -DPIN_SERIAL1_TX=PA_9 + -DPIN_SERIAL2_RX=PD_6 -DPIN_SERIAL2_TX=PD_5 + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 + -DPIN_SERIAL4_RX=PA_1 -DPIN_SERIAL4_TX=PA_0 + -DPIN_SERIAL7_RX=PE_7 -DPIN_SERIAL7_TX=PE_8 + -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 + -DTIMER_SERVO=TIM5 -DTIMER_TONE=TIM2 + -DSTEP_TIMER_IRQ_PRIO=0 + -DRCC_PERIPHCLK_I2C35=RCC_PERIPHCLK_I2C5 + -DUSE_USB_HS -DUSE_USB_HS_IN_FS + -DD_CACHE_DISABLED + -UI2C5_BASE +upload_protocol = cmsis-dap +debug_tool = cmsis-dap diff --git a/platformio.ini b/platformio.ini index 991c17b2ff7c..3478dcc1fbad 100644 --- a/platformio.ini +++ b/platformio.ini @@ -60,8 +60,8 @@ default_src_filter = + - - + - - - - - - - - - + - - - - @@ -77,10 +77,11 @@ default_src_filter = + - - + - - - - - + - - - - + - - - - - - - - @@ -191,6 +192,7 @@ default_src_filter = + - - + - - - + - - - - - @@ -224,6 +226,7 @@ default_src_filter = + - - + - - - + - - - - - - @@ -251,7 +254,6 @@ default_src_filter = + - - + - - - - - - - - - - -