Merge branch 'bugfix-2.0.x' into TMSX4_2.0_Bleeding
This commit is contained in:
@@ -48,7 +48,7 @@ jobs:
|
||||
|
||||
# Extended AVR Environments
|
||||
|
||||
- FYSETC_F6_13
|
||||
- FYSETC_F6
|
||||
- mega1280
|
||||
- rambo
|
||||
- sanguino1284p
|
||||
|
||||
@@ -27,8 +27,6 @@ tests-single-ci:
|
||||
|
||||
tests-single-local:
|
||||
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
|
||||
chmod +x buildroot/bin/*
|
||||
chmod +x buildroot/tests/*
|
||||
export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
|
||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
||||
@@ -40,8 +38,6 @@ tests-single-local-docker:
|
||||
.PHONY: tests-single-local-docker
|
||||
|
||||
tests-all-local:
|
||||
chmod +x buildroot/bin/*
|
||||
chmod +x buildroot/tests/*
|
||||
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
|
||||
|
||||
+92
-28
@@ -1,25 +1,25 @@
|
||||
//#define PetsfangMicroswiss
|
||||
#define BondtechBMG
|
||||
//#define BondtechBMG
|
||||
//#define CR10SPro_GearedExtruder
|
||||
//#define E3DV6
|
||||
#define Mosquito
|
||||
//#define Mosquito
|
||||
|
||||
//#define FilamentSensorStd
|
||||
//#define FilamentSensorLerdge
|
||||
#define FilamentEncoder
|
||||
//#define FilamentEncoder
|
||||
|
||||
//#define STOCK_2208 // V2 Stock Board with TMC2208 Drivers
|
||||
//#define SKR13 // 32 bit board - assumes 2208 drivers
|
||||
//#define SKR14
|
||||
#define SKR14Turbo
|
||||
#define SKR_2209
|
||||
//#define SKR14Turbo
|
||||
//#define SKR_2209
|
||||
//#define E_8825
|
||||
#define SKR_UART // Configure SKR board with drivers in UART mode
|
||||
//#define SKR_UART // Configure SKR board with drivers in UART mode
|
||||
|
||||
//#define SX2 // Small formfactor 200mm machine
|
||||
#define SX2 // Small formfactor 200mm machine
|
||||
|
||||
#define DUAL_Z
|
||||
#define GRAPHICSLCD
|
||||
//#define GRAPHICSLCD
|
||||
#define UBL
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#define SKRLPCBoard
|
||||
#endif
|
||||
|
||||
#define SlicePT1000
|
||||
#define SliceDualHeater
|
||||
//#define SlicePT1000
|
||||
//#define SliceDualHeater
|
||||
|
||||
// Power outputs EFBF or EFBE
|
||||
#define HEATER_1_PIN 7
|
||||
//#define HEATER_1_PIN 7
|
||||
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
@@ -94,15 +94,15 @@
|
||||
//===========================================================================
|
||||
//============================= DELTA Printer ===============================
|
||||
//===========================================================================
|
||||
// For a Delta printer start with one of the configuration files in the
|
||||
// config/examples/delta directory and customize for your machine.
|
||||
// For a Delta printer, start with one of the configuration files in the config/examples/delta directory
|
||||
// from https://github.com/MarlinFirmware/Configurations/branches/all and customize for your machine.
|
||||
//
|
||||
|
||||
//===========================================================================
|
||||
//============================= SCARA Printer ===============================
|
||||
//===========================================================================
|
||||
// For a SCARA printer start with the configuration files in
|
||||
// config/examples/SCARA and customize for your machine.
|
||||
// For a SCARA printer, start with one of the configuration files in the config/examples/SCARA directory
|
||||
// from https://github.com/MarlinFirmware/Configurations/branches/all and customize for your machine.
|
||||
//
|
||||
|
||||
// @section info
|
||||
@@ -1032,11 +1032,6 @@
|
||||
*/
|
||||
#define BLTOUCH
|
||||
|
||||
/**
|
||||
* Pressure sensor with a BLTouch-like interface
|
||||
*/
|
||||
//#define CREALITY_TOUCH
|
||||
|
||||
/**
|
||||
* Touch-MI Probe by hotends.fr
|
||||
*
|
||||
@@ -1090,10 +1085,20 @@
|
||||
/**
|
||||
* Nozzle-to-Probe offsets { X, Y, Z }
|
||||
*
|
||||
* - Use a caliper or ruler to measure the distance from the tip of
|
||||
* X and Y offset
|
||||
* Use a caliper or ruler to measure the distance from the tip of
|
||||
* the Nozzle to the center-point of the Probe in the X and Y axes.
|
||||
*
|
||||
* Z offset
|
||||
* - For the Z offset use your best known value and adjust at runtime.
|
||||
* - Probe Offsets can be tuned at runtime with 'M851', LCD menus, babystepping, etc.
|
||||
* - Common probes trigger below the nozzle and have negative values for Z offset.
|
||||
* - Probes triggering above the nozzle height are uncommon but do exist. When using
|
||||
* probes such as this, carefully set Z_CLEARANCE_DEPLOY_PROBE and Z_CLEARANCE_BETWEEN_PROBES
|
||||
* to avoid collisions during probing.
|
||||
*
|
||||
* Tune and Adjust
|
||||
* - Probe Offsets can be tuned at runtime with 'M851', LCD menus, babystepping, etc.
|
||||
* - PROBE_OFFSET_WIZARD (configuration_adv.h) can be used for setting the Z offset.
|
||||
*
|
||||
* Assuming the typical work area orientation:
|
||||
* - Probe to RIGHT of the Nozzle has a Positive X offset
|
||||
@@ -1139,11 +1144,38 @@
|
||||
#define XY_PROBE_SPEED 5000
|
||||
|
||||
// Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2)
|
||||
#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
|
||||
#define Z_PROBE_SPEED_FAST (4*60)
|
||||
|
||||
// Feedrate (mm/min) for the "accurate" probe of each point
|
||||
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
|
||||
|
||||
/**
|
||||
* Probe Activation Switch
|
||||
* A switch indicating proper deployment, or an optical
|
||||
* switch triggered when the carriage is near the bed.
|
||||
*/
|
||||
//#define PROBE_ACTIVATION_SWITCH
|
||||
#if ENABLED(PROBE_ACTIVATION_SWITCH)
|
||||
#define PROBE_ACTIVATION_SWITCH_STATE LOW // State indicating probe is active
|
||||
//#define PROBE_ACTIVATION_SWITCH_PIN PC6 // Override default pin
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tare Probe (determine zero-point) prior to each probe.
|
||||
* Useful for a strain gauge or piezo sensor that needs to factor out
|
||||
* elements such as cables pulling on the carriage.
|
||||
*/
|
||||
//#define PROBE_TARE
|
||||
#if ENABLED(PROBE_TARE)
|
||||
#define PROBE_TARE_TIME 200 // (ms) Time to hold tare pin
|
||||
#define PROBE_TARE_DELAY 200 // (ms) Delay after tare before
|
||||
#define PROBE_TARE_STATE HIGH // State to write pin for tare
|
||||
//#define PROBE_TARE_PIN PA5 // Override default pin
|
||||
#if ENABLED(PROBE_ACTIVATION_SWITCH)
|
||||
//#define PROBE_TARE_ONLY_WHILE_INACTIVE // Fail to tare/probe if PROBE_ACTIVATION_SWITCH is active
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Multiple Probing
|
||||
*
|
||||
@@ -1205,6 +1237,13 @@
|
||||
//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing
|
||||
//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors
|
||||
|
||||
// Require minimum nozzle and/or bed temperature for probing.
|
||||
//#define PREHEAT_BEFORE_PROBING
|
||||
#if ENABLED(PREHEAT_BEFORE_PROBING)
|
||||
#define PROBING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
|
||||
#define PROBING_BED_TEMP 50
|
||||
#endif
|
||||
|
||||
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
|
||||
// :{ 0:'Low', 1:'High' }
|
||||
#define X_ENABLE_ON 0
|
||||
@@ -1470,10 +1509,21 @@
|
||||
//#define MESH_BED_LEVELING
|
||||
|
||||
/**
|
||||
* Normally G28 leaves leveling disabled on completion. Enable
|
||||
* this option to have G28 restore the prior leveling state.
|
||||
* Normally G28 leaves leveling disabled on completion. Enable one of
|
||||
* these options to restore the prior leveling state or to always enable
|
||||
* leveling immediately after G28.
|
||||
*/
|
||||
#define RESTORE_LEVELING_AFTER_G28
|
||||
//#define ENABLE_LEVELING_AFTER_G28
|
||||
|
||||
/**
|
||||
* Auto-leveling needs preheating
|
||||
*/
|
||||
//#define PREHEAT_BEFORE_LEVELING
|
||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||
#define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
|
||||
#define LEVELING_BED_TEMP 50
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Enable detailed logging of G28, G29, M48, etc.
|
||||
@@ -1636,9 +1686,8 @@
|
||||
#define Z_SAFE_HOMING_Y_POINT Y_CENTER // Y point for Z homing
|
||||
#endif
|
||||
|
||||
// Homing speeds (mm/m)
|
||||
#define HOMING_FEEDRATE_XY 6000
|
||||
#define HOMING_FEEDRATE_Z 360
|
||||
// Homing speeds (mm/min)
|
||||
#define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (6*60) }
|
||||
|
||||
// Validate that endstops are triggered on homing moves
|
||||
#define VALIDATE_HOMING_ENDSTOPS
|
||||
@@ -1846,6 +1895,10 @@
|
||||
// For a purge/clean station mounted on the X axis
|
||||
//#define NOZZLE_CLEAN_NO_Y
|
||||
|
||||
// Require a minimum hotend temperature for cleaning
|
||||
#define NOZZLE_CLEAN_MIN_TEMP 170
|
||||
//#define NOZZLE_CLEAN_HEATUP // Heat up the nozzle instead of skipping wipe
|
||||
|
||||
// Explicit wipe G-code script applies to a G12 with no arguments.
|
||||
//#define WIPE_SEQUENCE_COMMANDS "G1 X-17 Y25 Z10 F4000\nG1 Z1\nM114\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 Z15\nM400\nG0 X-10.0 Y-9.0"
|
||||
|
||||
@@ -2514,6 +2567,16 @@
|
||||
//
|
||||
//#define LONGER_LK_TFT28
|
||||
|
||||
//
|
||||
// 320x240, 2.8", FSMC Stock Display from ET4
|
||||
//
|
||||
//#define ANET_ET4_TFT28
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Stock Display from ET5
|
||||
//
|
||||
//#define ANET_ET5_TFT35
|
||||
|
||||
//
|
||||
// Generic TFT with detailed options
|
||||
//
|
||||
@@ -2579,6 +2642,7 @@
|
||||
//#define TOUCH_CALIBRATION_Y -8981
|
||||
//#define TOUCH_OFFSET_X -43
|
||||
//#define TOUCH_OFFSET_Y 257
|
||||
//#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
||||
|
||||
#if ENABLED(TFT_COLOR_UI)
|
||||
//#define SINGLE_TOUCH_NAVIGATION
|
||||
|
||||
+74
-44
@@ -806,10 +806,10 @@
|
||||
//#define ASSISTED_TRAMMING
|
||||
#if ENABLED(ASSISTED_TRAMMING)
|
||||
|
||||
// Define positions for probing points, use the hotend as reference not the sensor.
|
||||
#define TRAMMING_POINT_XY { { 20, 20 }, { 200, 20 }, { 200, 200 }, { 20, 200 } }
|
||||
// Define positions for probe points.
|
||||
#define TRAMMING_POINT_XY { { 20, 20 }, { 180, 20 }, { 180, 180 }, { 20, 180 } }
|
||||
|
||||
// Define positions names for probing points.
|
||||
// Define position names for probe points.
|
||||
#define TRAMMING_POINT_NAME_1 "Front-Left"
|
||||
#define TRAMMING_POINT_NAME_2 "Front-Right"
|
||||
#define TRAMMING_POINT_NAME_3 "Back-Right"
|
||||
@@ -818,8 +818,8 @@
|
||||
#define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation
|
||||
//#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first
|
||||
|
||||
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI)
|
||||
//#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu
|
||||
//#define ASSISTED_TRAMMING_WIZARD // Add a Tramming Wizard to the LCD menu
|
||||
|
||||
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
|
||||
|
||||
/**
|
||||
@@ -1029,7 +1029,7 @@
|
||||
/**
|
||||
* I2C-based DIGIPOTs (e.g., Azteeg X3 Pro)
|
||||
*/
|
||||
//#define DIGIPOT_MCP4018 // Requires https://github.com/stawel/SlowSoftI2CMaster
|
||||
//#define DIGIPOT_MCP4018 // Requires https://github.com/felias-fogg/SlowSoftI2CMaster
|
||||
//#define DIGIPOT_MCP4451
|
||||
#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
|
||||
#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT:4 AZTEEG_X3_PRO:8 MKS_SBASE:5 MIGHTYBOARD_REVE:5
|
||||
@@ -1062,7 +1062,7 @@
|
||||
|
||||
#if EITHER(IS_ULTIPANEL, EXTENSIBLE_UI)
|
||||
#define MANUAL_FEEDRATE { 50*60, 50*60, 4*60, 2*60 } // (mm/min) Feedrates for manual moves along X, Y, Z, E from panel
|
||||
#define SHORT_MANUAL_Z_MOVE 0.025 // (mm) Smallest manual Z move (< 0.1mm)
|
||||
#define FINE_MANUAL_MOVE 0.025 // (mm) Smallest manual move (< 0.1mm) applying to Z on most machines
|
||||
#if IS_ULTIPANEL
|
||||
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
||||
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
||||
@@ -1091,7 +1091,8 @@
|
||||
#if ENABLED(PROBE_OFFSET_WIZARD)
|
||||
//
|
||||
// Enable to init the Probe Z-Offset when starting the Wizard.
|
||||
// Use the estimated nozzle-to-probe Z offset, plus a little more.
|
||||
// Use a height slightly above the estimated nozzle-to-probe Z offset.
|
||||
// For example, with an offset of -5, consider a starting height of -4.
|
||||
//
|
||||
//#define PROBE_OFFSET_WIZARD_START_Z -4.0
|
||||
|
||||
@@ -1140,35 +1141,38 @@
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
// Scroll a longer status message into view
|
||||
#define STATUS_MESSAGE_SCROLLING
|
||||
#if HAS_DISPLAY
|
||||
// The timeout (in ms) to return to the status screen from sub-menus
|
||||
//#define LCD_TIMEOUT_TO_STATUS 15000
|
||||
|
||||
// On the Info Screen, display XY with one decimal place when possible
|
||||
//#define LCD_DECIMAL_SMALL_XY
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
#define BOOTSCREEN_TIMEOUT 2000 // (ms) Total Duration to display the boot screen(s)
|
||||
#if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI)
|
||||
#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The timeout (in ms) to return to the status screen from sub-menus
|
||||
#define LCD_TIMEOUT_TO_STATUS 15000
|
||||
// Scroll a longer status message into view
|
||||
#define STATUS_MESSAGE_SCROLLING
|
||||
|
||||
// Add an 'M73' G-code to set the current percentage
|
||||
#if ENABLED(GRAPHICSLCD)
|
||||
// On the Info Screen, display XY with one decimal place when possible
|
||||
//#define LCD_DECIMAL_SMALL_XY
|
||||
|
||||
// Add an 'M73' G-code to set the current percentage
|
||||
#define LCD_SET_PROGRESS_MANUALLY
|
||||
|
||||
// Show the E position (filament used) during printing
|
||||
//#define LCD_SHOW_E_TOTAL
|
||||
#endif
|
||||
|
||||
// Show the E position (filament used) during printing
|
||||
//#define LCD_SHOW_E_TOTAL
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
#define BOOTSCREEN_TIMEOUT 2000 // (ms) Total Duration to display the boot screen(s)
|
||||
#endif
|
||||
|
||||
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
|
||||
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, EXTENSIBLE_UI)
|
||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
|
||||
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
|
||||
#endif
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
#if EITHER(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI)
|
||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
||||
#endif
|
||||
|
||||
@@ -1185,6 +1189,16 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
/**
|
||||
* SD Card SPI Speed
|
||||
* May be required to resolve "volume init" errors.
|
||||
*
|
||||
* Enable and set to SPI_HALF_SPEED, SPI_QUARTER_SPEED, or SPI_EIGHTH_SPEED
|
||||
* otherwise full speed will be applied.
|
||||
*
|
||||
* :['SPI_HALF_SPEED', 'SPI_QUARTER_SPEED', 'SPI_EIGHTH_SPEED']
|
||||
*/
|
||||
//#define SD_SPI_SPEED SPI_HALF_SPEED
|
||||
|
||||
// The standard SD detect circuit reads LOW when media is inserted and HIGH when empty.
|
||||
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
|
||||
@@ -1206,6 +1220,7 @@
|
||||
|
||||
#define SD_MENU_CONFIRM_START // Confirm the selected SD file before printing
|
||||
|
||||
//#define NO_SD_AUTOSTART // Remove auto#.g file support completely to save some Flash, SRAM
|
||||
//#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files
|
||||
|
||||
//#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted
|
||||
@@ -1330,9 +1345,6 @@
|
||||
*/
|
||||
//#define USB_FLASH_DRIVE_SUPPORT
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
||||
#define USB_CS_PIN SDSS
|
||||
#define USB_INTR_PIN SD_DETECT_PIN
|
||||
|
||||
/**
|
||||
* USB Host Shield Library
|
||||
*
|
||||
@@ -1343,7 +1355,18 @@
|
||||
* is less tested and is known to interfere with Servos.
|
||||
* [1] This requires USB_INTR_PIN to be interrupt-capable.
|
||||
*/
|
||||
//#define USE_UHS2_USB
|
||||
//#define USE_UHS3_USB
|
||||
|
||||
/**
|
||||
* Native USB Host supported by some boards (USB OTG)
|
||||
*/
|
||||
//#define USE_OTG_USB_HOST
|
||||
|
||||
#if DISABLED(USE_OTG_USB_HOST)
|
||||
#define USB_CS_PIN SDSS
|
||||
#define USB_INTR_PIN SD_DETECT_PIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1576,6 +1599,9 @@
|
||||
//#define TOUCH_UI_UTF8_FRACTIONS // ¼ ½ ¾
|
||||
//#define TOUCH_UI_UTF8_SYMBOLS // µ ¶ ¦ § ¬
|
||||
#endif
|
||||
|
||||
// Cyrillic character set, costs about 27KiB of flash
|
||||
//#define TOUCH_UI_UTF8_CYRILLIC_CHARSET
|
||||
#endif
|
||||
|
||||
// Use a smaller font when labels don't fit buttons
|
||||
@@ -1751,6 +1777,10 @@
|
||||
//#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET)
|
||||
#endif
|
||||
|
||||
#if BOTH(AUTO_BED_LEVELING_UBL, EEPROM_SETTINGS)
|
||||
//#define OPTIMIZED_MESH_STORAGE // Store mesh with less precision to save EEPROM space
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Repeatedly attempt G29 leveling until it succeeds.
|
||||
* Stop after G29_MAX_RETRIES attempts.
|
||||
@@ -2499,22 +2529,22 @@
|
||||
* Set *_SERIAL_TX_PIN and *_SERIAL_RX_PIN to match for all drivers
|
||||
* on the same serial port, either here or in your board's pins file.
|
||||
*/
|
||||
#define X_SLAVE_ADDRESS 0
|
||||
#define Y_SLAVE_ADDRESS 0
|
||||
#define Z_SLAVE_ADDRESS 0
|
||||
#define X2_SLAVE_ADDRESS 0
|
||||
#define Y2_SLAVE_ADDRESS 0
|
||||
#define Z2_SLAVE_ADDRESS 0
|
||||
#define Z3_SLAVE_ADDRESS 0
|
||||
#define Z4_SLAVE_ADDRESS 0
|
||||
#define E0_SLAVE_ADDRESS 0
|
||||
#define E1_SLAVE_ADDRESS 0
|
||||
#define E2_SLAVE_ADDRESS 0
|
||||
#define E3_SLAVE_ADDRESS 0
|
||||
#define E4_SLAVE_ADDRESS 0
|
||||
#define E5_SLAVE_ADDRESS 0
|
||||
#define E6_SLAVE_ADDRESS 0
|
||||
#define E7_SLAVE_ADDRESS 0
|
||||
//#define X_SLAVE_ADDRESS 0
|
||||
//#define Y_SLAVE_ADDRESS 0
|
||||
//#define Z_SLAVE_ADDRESS 0
|
||||
//#define X2_SLAVE_ADDRESS 0
|
||||
//#define Y2_SLAVE_ADDRESS 0
|
||||
//#define Z2_SLAVE_ADDRESS 0
|
||||
//#define Z3_SLAVE_ADDRESS 0
|
||||
//#define Z4_SLAVE_ADDRESS 0
|
||||
//#define E0_SLAVE_ADDRESS 0
|
||||
//#define E1_SLAVE_ADDRESS 0
|
||||
//#define E2_SLAVE_ADDRESS 0
|
||||
//#define E3_SLAVE_ADDRESS 0
|
||||
//#define E4_SLAVE_ADDRESS 0
|
||||
//#define E5_SLAVE_ADDRESS 0
|
||||
//#define E6_SLAVE_ADDRESS 0
|
||||
//#define E7_SLAVE_ADDRESS 0
|
||||
|
||||
/**
|
||||
* Software enable
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
#define SHORT_BUILD_VERSION "2.0.5_SX4O"
|
||||
#define SHORT_BUILD_VERSION "2.0.7_SX1"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
@@ -41,7 +41,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2020-06-17"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-01-03"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
||||
@@ -34,17 +34,17 @@
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
void spiBegin() {
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
#if DISABLED(SOFTWARE_SPI)
|
||||
// SS must be in output mode even it is not chip select
|
||||
//SET_OUTPUT(SS_PIN);
|
||||
//SET_OUTPUT(SD_SS_PIN);
|
||||
// set SS high - may be chip select for another SPI device
|
||||
//#if SET_SPI_SS_HIGH
|
||||
//WRITE(SS_PIN, HIGH);
|
||||
//WRITE(SD_SS_PIN, HIGH);
|
||||
//#endif
|
||||
// set a default rate
|
||||
spiInit(1);
|
||||
@@ -195,19 +195,19 @@ void spiBegin() {
|
||||
// no interrupts during byte receive - about 8µs
|
||||
cli();
|
||||
// output pin high - like sending 0xFF
|
||||
WRITE(MOSI_PIN, HIGH);
|
||||
WRITE(SD_MOSI_PIN, HIGH);
|
||||
|
||||
LOOP_L_N(i, 8) {
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
WRITE(SD_SCK_PIN, HIGH);
|
||||
|
||||
nop; // adjust so SCK is nice
|
||||
nop;
|
||||
|
||||
data <<= 1;
|
||||
|
||||
if (READ(MISO_PIN)) data |= 1;
|
||||
if (READ(SD_MISO_PIN)) data |= 1;
|
||||
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
}
|
||||
|
||||
sei();
|
||||
@@ -225,10 +225,10 @@ void spiBegin() {
|
||||
// no interrupts during byte send - about 8µs
|
||||
cli();
|
||||
LOOP_L_N(i, 8) {
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(MOSI_PIN, data & 0x80);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
WRITE(SD_MOSI_PIN, data & 0x80);
|
||||
data <<= 1;
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
WRITE(SD_SCK_PIN, HIGH);
|
||||
}
|
||||
|
||||
nop; // hold SCK high for a few ns
|
||||
@@ -236,7 +236,7 @@ void spiBegin() {
|
||||
nop;
|
||||
nop;
|
||||
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
|
||||
sei();
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(X_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -132,7 +132,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(X_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -140,7 +140,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Y_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -148,7 +148,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Y_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -156,7 +156,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -164,7 +164,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -172,7 +172,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X2_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(X2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -180,7 +180,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X2_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X2_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(X2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -188,7 +188,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y2_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y2_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Y2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -196,7 +196,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y2_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y2_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Y2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -204,7 +204,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z2_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -212,7 +212,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z2_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -220,7 +220,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z3_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z3_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -228,7 +228,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z3_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z3_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -236,7 +236,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z4_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z4_MAX_PIN), "Z4_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z4_MAX_PIN), "Z4_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z4_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -244,7 +244,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z4_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z4_MIN_PIN), "Z4_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z4_MIN_PIN), "Z4_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z4_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -252,7 +252,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinHasPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -51,15 +51,15 @@
|
||||
#define AVR_SS_PIN 16
|
||||
#endif
|
||||
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN AVR_SCK_PIN
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN AVR_SCK_PIN
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN AVR_MISO_PIN
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN AVR_MISO_PIN
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN AVR_MOSI_PIN
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN AVR_MOSI_PIN
|
||||
#endif
|
||||
#ifndef SS_PIN
|
||||
#define SS_PIN AVR_SS_PIN
|
||||
#ifndef SD_SS_PIN
|
||||
#define SD_SS_PIN AVR_SS_PIN
|
||||
#endif
|
||||
|
||||
@@ -69,10 +69,10 @@
|
||||
|
||||
// run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
|
||||
static uint8_t spiTransferTx0(uint8_t bout) { // using Mode 0
|
||||
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN);
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
|
||||
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN);
|
||||
uint32_t idx = 0;
|
||||
|
||||
/* Negate bout, as the assembler requires a negated value */
|
||||
@@ -154,9 +154,9 @@
|
||||
static uint8_t spiTransferRx0(uint8_t) { // using Mode 0
|
||||
uint32_t bin = 0;
|
||||
uint32_t work = 0;
|
||||
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
|
||||
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN);
|
||||
|
||||
/* The software SPI routine */
|
||||
__asm__ __volatile__(
|
||||
@@ -225,15 +225,15 @@
|
||||
static uint8_t spiTransfer1(uint8_t b) { // using Mode 0
|
||||
int bits = 8;
|
||||
do {
|
||||
WRITE(MOSI_PIN, b & 0x80);
|
||||
WRITE(SD_MOSI_PIN, b & 0x80);
|
||||
b <<= 1; // little setup time
|
||||
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
WRITE(SD_SCK_PIN, HIGH);
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
|
||||
b |= (READ(MISO_PIN) != 0);
|
||||
b |= (READ(SD_MISO_PIN) != 0);
|
||||
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
} while (--bits);
|
||||
return b;
|
||||
@@ -245,15 +245,15 @@
|
||||
static uint8_t spiTransferX(uint8_t b) { // using Mode 0
|
||||
int bits = 8;
|
||||
do {
|
||||
WRITE(MOSI_PIN, b & 0x80);
|
||||
WRITE(SD_MOSI_PIN, b & 0x80);
|
||||
b <<= 1; // little setup time
|
||||
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
WRITE(SD_SCK_PIN, HIGH);
|
||||
__delay_4cycles(spiDelayCyclesX4);
|
||||
|
||||
b |= (READ(MISO_PIN) != 0);
|
||||
b |= (READ(SD_MISO_PIN) != 0);
|
||||
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
__delay_4cycles(spiDelayCyclesX4);
|
||||
} while (--bits);
|
||||
return b;
|
||||
@@ -271,10 +271,10 @@
|
||||
|
||||
// Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
|
||||
static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) {
|
||||
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN);
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
|
||||
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN);
|
||||
uint32_t work = 0;
|
||||
uint32_t txval = 0;
|
||||
|
||||
@@ -352,9 +352,9 @@
|
||||
static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
|
||||
uint32_t bin = 0;
|
||||
uint32_t work = 0;
|
||||
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
|
||||
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */
|
||||
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
|
||||
uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN);
|
||||
|
||||
/* The software SPI routine */
|
||||
__asm__ __volatile__(
|
||||
@@ -442,22 +442,22 @@
|
||||
static pfnSpiRxBlock spiRxBlock = (pfnSpiRxBlock)spiRxBlockX;
|
||||
|
||||
#if MB(ALLIGATOR)
|
||||
#define _SS_WRITE(S) WRITE(SS_PIN, S)
|
||||
#define _SS_WRITE(S) WRITE(SD_SS_PIN, S)
|
||||
#else
|
||||
#define _SS_WRITE(S) NOOP
|
||||
#endif
|
||||
|
||||
void spiBegin() {
|
||||
SET_OUTPUT(SS_PIN);
|
||||
SET_OUTPUT(SD_SS_PIN);
|
||||
_SS_WRITE(HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
}
|
||||
|
||||
uint8_t spiRec() {
|
||||
_SS_WRITE(LOW);
|
||||
WRITE(MOSI_PIN, HIGH); // Output 1s 1
|
||||
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
|
||||
uint8_t b = spiTransferRx(0xFF);
|
||||
_SS_WRITE(HIGH);
|
||||
return b;
|
||||
@@ -466,7 +466,7 @@
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
if (nbyte) {
|
||||
_SS_WRITE(LOW);
|
||||
WRITE(MOSI_PIN, HIGH); // Output 1s 1
|
||||
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
|
||||
spiRxBlock(buf, nbyte);
|
||||
_SS_WRITE(HIGH);
|
||||
}
|
||||
@@ -519,8 +519,8 @@
|
||||
}
|
||||
|
||||
_SS_WRITE(HIGH);
|
||||
WRITE(MOSI_PIN, HIGH);
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(SD_MOSI_PIN, HIGH);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
}
|
||||
|
||||
/** Begin SPI transaction, set clock, bit order, data mode */
|
||||
@@ -575,20 +575,20 @@
|
||||
|
||||
// Configure SPI pins
|
||||
PIO_Configure(
|
||||
g_APinDescription[SCK_PIN].pPort,
|
||||
g_APinDescription[SCK_PIN].ulPinType,
|
||||
g_APinDescription[SCK_PIN].ulPin,
|
||||
g_APinDescription[SCK_PIN].ulPinConfiguration);
|
||||
g_APinDescription[SD_SCK_PIN].pPort,
|
||||
g_APinDescription[SD_SCK_PIN].ulPinType,
|
||||
g_APinDescription[SD_SCK_PIN].ulPin,
|
||||
g_APinDescription[SD_SCK_PIN].ulPinConfiguration);
|
||||
PIO_Configure(
|
||||
g_APinDescription[MOSI_PIN].pPort,
|
||||
g_APinDescription[MOSI_PIN].ulPinType,
|
||||
g_APinDescription[MOSI_PIN].ulPin,
|
||||
g_APinDescription[MOSI_PIN].ulPinConfiguration);
|
||||
g_APinDescription[SD_MOSI_PIN].pPort,
|
||||
g_APinDescription[SD_MOSI_PIN].ulPinType,
|
||||
g_APinDescription[SD_MOSI_PIN].ulPin,
|
||||
g_APinDescription[SD_MOSI_PIN].ulPinConfiguration);
|
||||
PIO_Configure(
|
||||
g_APinDescription[MISO_PIN].pPort,
|
||||
g_APinDescription[MISO_PIN].ulPinType,
|
||||
g_APinDescription[MISO_PIN].ulPin,
|
||||
g_APinDescription[MISO_PIN].ulPinConfiguration);
|
||||
g_APinDescription[SD_MISO_PIN].pPort,
|
||||
g_APinDescription[SD_MISO_PIN].ulPinType,
|
||||
g_APinDescription[SD_MISO_PIN].ulPin,
|
||||
g_APinDescription[SD_MISO_PIN].ulPinConfiguration);
|
||||
|
||||
// set master mode, peripheral select, fault detection
|
||||
SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS);
|
||||
@@ -606,7 +606,7 @@
|
||||
WRITE(SPI_EEPROM1_CS, HIGH);
|
||||
WRITE(SPI_EEPROM2_CS, HIGH);
|
||||
WRITE(SPI_FLASH_CS, HIGH);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
|
||||
OUT_WRITE(SDSS, LOW);
|
||||
|
||||
|
||||
@@ -64,12 +64,11 @@
|
||||
|
||||
#include "../../../MarlinCore.h"
|
||||
|
||||
void spiBegin();
|
||||
void spiInit(uint8_t spiRate);
|
||||
void spiSend(uint8_t b);
|
||||
void spiSend(const uint8_t* buf, size_t n);
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SPI_QUARTER_SPEED
|
||||
#endif
|
||||
|
||||
#include "../../shared/Marduino.h"
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
#include "../fastio.h"
|
||||
|
||||
void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
|
||||
@@ -100,11 +99,7 @@ uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
|
||||
|
||||
spiBegin();
|
||||
|
||||
#ifndef SPI_SPEED
|
||||
#define SPI_SPEED SPI_FULL_SPEED // use same SPI speed as SD card
|
||||
#endif
|
||||
spiInit(2);
|
||||
|
||||
spiInit(LCD_SPI_SPEED);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
|
||||
@@ -59,9 +59,6 @@
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
|
||||
#include "u8g_com_HAL_DUE_sw_spi_shared.h"
|
||||
|
||||
#include "../../shared/Marduino.h"
|
||||
|
||||
@@ -40,7 +40,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 == MOSI_PIN || TMC_SW_##P == MISO_PIN || TMC_SW_##P == SCK_PIN))
|
||||
#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))
|
||||
|
||||
#if ENABLED(SDSUPPORT) && HAS_DRIVER(TMC2130)
|
||||
#if ENABLED(TMC_USE_SW_SPI)
|
||||
|
||||
@@ -43,22 +43,22 @@
|
||||
#define SPI_PIN 87
|
||||
#define SPI_CHAN 1
|
||||
#endif
|
||||
#define SCK_PIN 76
|
||||
#define MISO_PIN 74
|
||||
#define MOSI_PIN 75
|
||||
#define SD_SCK_PIN 76
|
||||
#define SD_MISO_PIN 74
|
||||
#define SD_MOSI_PIN 75
|
||||
#else
|
||||
// defaults
|
||||
#define DUE_SOFTWARE_SPI
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN 52
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN 52
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN 50
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN 50
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN 51
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN 51
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* A.28, A.29, B.21, C.26, C.29 */
|
||||
#define SS_PIN SDSS
|
||||
#define SD_SS_PIN SDSS
|
||||
|
||||
@@ -53,11 +53,11 @@ static SPISettings spiConfig;
|
||||
// ------------------------
|
||||
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#if !PIN_EXISTS(SD_SS)
|
||||
#error "SD_SS_PIN not defined!"
|
||||
#endif
|
||||
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define SS_PIN SDSS
|
||||
#define SCK_PIN 18
|
||||
#define MISO_PIN 19
|
||||
#define MOSI_PIN 23
|
||||
#define SD_SS_PIN SDSS
|
||||
#define SD_SCK_PIN 18
|
||||
#define SD_MISO_PIN 19
|
||||
#define SD_MOSI_PIN 23
|
||||
|
||||
@@ -24,31 +24,32 @@
|
||||
#include "../../core/macros.h"
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
||||
#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.
|
||||
#endif
|
||||
|
||||
/** onboard SD card */
|
||||
//#define SCK_PIN P0_07
|
||||
//#define MISO_PIN P0_08
|
||||
//#define MOSI_PIN P0_09
|
||||
//#define SS_PIN P0_06
|
||||
/** external */
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN 50
|
||||
// Onboard SD
|
||||
//#define SD_SCK_PIN P0_07
|
||||
//#define SD_MISO_PIN P0_08
|
||||
//#define SD_MOSI_PIN P0_09
|
||||
//#define SD_SS_PIN P0_06
|
||||
|
||||
// External SD
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN 50
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN 51
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN 51
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN 52
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN 52
|
||||
#endif
|
||||
#ifndef SS_PIN
|
||||
#define SS_PIN 53
|
||||
#ifndef SD_SS_PIN
|
||||
#define SD_SS_PIN 53
|
||||
#endif
|
||||
#ifndef SDSS
|
||||
#define SDSS SS_PIN
|
||||
#define SDSS SD_SS_PIN
|
||||
#endif
|
||||
|
||||
@@ -47,9 +47,6 @@ extern "C" volatile uint32_t _millis;
|
||||
#include <pinmapping.h>
|
||||
#include <CDCSerial.h>
|
||||
|
||||
// i2c uses 8-bit shifted address
|
||||
#define I2C_ADDRESS(A) uint8_t((A) << 1)
|
||||
|
||||
//
|
||||
// Default graphical display delays
|
||||
//
|
||||
@@ -212,3 +209,11 @@ inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
#ifndef strcmp_P
|
||||
#define strcmp_P(a, b) strcmp((a), (b))
|
||||
#endif
|
||||
|
||||
#ifndef strcat_P
|
||||
#define strcat_P(a, b) strcat((a), (b))
|
||||
#endif
|
||||
|
||||
#ifndef strcpy_P
|
||||
#define strcpy_P(a, b) strcpy((a), (b))
|
||||
#endif
|
||||
|
||||
@@ -55,27 +55,33 @@
|
||||
#include <lpc17xx_pinsel.h>
|
||||
#include <lpc17xx_clkpwr.h>
|
||||
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
// ------------------------
|
||||
#if ENABLED(LPC_SOFTWARE_SPI)
|
||||
|
||||
#include <SoftwareSPI.h>
|
||||
|
||||
// Software SPI
|
||||
|
||||
static uint8_t SPI_speed = 0;
|
||||
#include <SoftwareSPI.h>
|
||||
|
||||
#ifndef HAL_SPI_SPEED
|
||||
#define HAL_SPI_SPEED SPI_FULL_SPEED
|
||||
#endif
|
||||
|
||||
static uint8_t SPI_speed = HAL_SPI_SPEED;
|
||||
|
||||
static uint8_t spiTransfer(uint8_t b) {
|
||||
return swSpiTransfer(b, SPI_speed, SCK_PIN, MISO_PIN, MOSI_PIN);
|
||||
return swSpiTransfer(b, SPI_speed, SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
|
||||
}
|
||||
|
||||
void spiBegin() {
|
||||
swSpiBegin(SCK_PIN, MISO_PIN, MOSI_PIN);
|
||||
swSpiBegin(SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
|
||||
}
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
SPI_speed = swSpiInit(spiRate, SCK_PIN, MOSI_PIN);
|
||||
SPI_speed = swSpiInit(spiRate, SD_SCK_PIN, SD_MOSI_PIN);
|
||||
}
|
||||
|
||||
uint8_t spiRec() { return spiTransfer(0xFF); }
|
||||
@@ -100,14 +106,20 @@
|
||||
|
||||
#else
|
||||
|
||||
void spiBegin() { // setup SCK, MOSI & MISO pins for SSP0
|
||||
spiInit(SPI_SPEED);
|
||||
}
|
||||
#ifndef HAL_SPI_SPEED
|
||||
#ifdef SD_SPI_SPEED
|
||||
#define HAL_SPI_SPEED SD_SPI_SPEED
|
||||
#else
|
||||
#define HAL_SPI_SPEED SPI_FULL_SPEED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void spiBegin() { spiInit(HAL_SPI_SPEED); } // Set up SCK, MOSI & MISO pins for SSP0
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
#if MISO_PIN == BOARD_SPI1_MISO_PIN
|
||||
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
|
||||
SPI.setModule(1);
|
||||
#elif MISO_PIN == BOARD_SPI2_MISO_PIN
|
||||
#elif SD_MISO_PIN == BOARD_SPI2_MISO_PIN
|
||||
SPI.setModule(2);
|
||||
#endif
|
||||
SPI.setDataSize(DATA_SIZE_8BIT);
|
||||
@@ -150,10 +162,9 @@
|
||||
(void)spiTransfer(buf[i]);
|
||||
}
|
||||
|
||||
/** Begin SPI transaction, set clock, bit order, data mode */
|
||||
// Begin SPI transaction, set clock, bit order, data mode
|
||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
||||
// TODO: to be implemented
|
||||
|
||||
// TODO: Implement this method
|
||||
}
|
||||
|
||||
#endif // LPC_SOFTWARE_SPI
|
||||
@@ -392,9 +403,9 @@ void SPIClass::updateSettings() {
|
||||
SSP_Init(_currentSetting->spi_d, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers
|
||||
}
|
||||
|
||||
#if MISO_PIN == BOARD_SPI1_MISO_PIN
|
||||
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
|
||||
SPIClass SPI(1);
|
||||
#elif MISO_PIN == BOARD_SPI2_MISO_PIN
|
||||
#elif SD_MISO_PIN == BOARD_SPI2_MISO_PIN
|
||||
SPIClass SPI(2);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,79 +46,79 @@ void setup_endstop_interrupts() {
|
||||
|
||||
#if HAS_X_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(X_MAX_PIN)
|
||||
#error "X_MAX_PIN is not INTERRUPT-capable."
|
||||
#error "X_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(X_MIN_PIN)
|
||||
#error "X_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "X_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Y_MAX_PIN)
|
||||
#error "Y_MAX_PIN is not INTERRUPT-capable."
|
||||
#error "Y_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Y_MIN_PIN)
|
||||
#error "Y_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Y_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z_MAX_PIN)
|
||||
#error "Z_MAX_PIN is not INTERRUPT-capable."
|
||||
#error "Z_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z_MIN_PIN)
|
||||
#error "Z_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Z_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z2_MAX_PIN)
|
||||
#error "Z2_MAX_PIN is not INTERRUPT-capable."
|
||||
#error "Z2_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z2_MIN_PIN)
|
||||
#error "Z2_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Z2_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z3_MAX_PIN)
|
||||
#error "Z3_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Z3_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z3_MIN_PIN)
|
||||
#error "Z3_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Z3_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z4_MAX_PIN)
|
||||
#error "Z4_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Z4_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z4_MIN_PIN)
|
||||
#error "Z4_MIN_PIN is not INTERRUPT-capable."
|
||||
#error "Z4_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z_MIN_PROBE_PIN)
|
||||
#error "Z_MIN_PROBE_PIN is not INTERRUPT-capable."
|
||||
#error "Z_MIN_PROBE_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#if PIO_PLATFORM_VERSION < 1001
|
||||
#error "nxplpc-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries. You may need to remove the platform and let it reinstall automatically."
|
||||
#endif
|
||||
#if PIO_FRAMEWORK_VERSION < 2005
|
||||
#if PIO_FRAMEWORK_VERSION < 2006
|
||||
#error "framework-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries."
|
||||
#endif
|
||||
|
||||
@@ -116,8 +116,8 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||
#elif HAS_WIRED_LCD
|
||||
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
||||
#error "Serial port pins (1) conflict with Encoder Buttons!"
|
||||
#elif ANY_TX(1, SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \
|
||||
|| ANY_RX(1, LCD_SDSS, LCD_PINS_RS, MISO_PIN, DOGLCD_A0, SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN)
|
||||
#elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \
|
||||
|| ANY_RX(1, LCD_SDSS, LCD_PINS_RS, SD_MISO_PIN, DOGLCD_A0, SD_SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN)
|
||||
#error "Serial port pins (1) conflict with LCD pins!"
|
||||
#endif
|
||||
#endif
|
||||
@@ -205,8 +205,8 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||
#error "SDA0 overlaps with BEEPER_PIN!"
|
||||
#elif IS_SCL0(BTN_ENC)
|
||||
#error "SCL0 overlaps with Encoder Button!"
|
||||
#elif IS_SCL0(SS_PIN)
|
||||
#error "SCL0 overlaps with SS_PIN!"
|
||||
#elif IS_SCL0(SD_SS_PIN)
|
||||
#error "SCL0 overlaps with SD_SS_PIN!"
|
||||
#elif IS_SCL0(LCD_SDSS)
|
||||
#error "SCL0 overlaps with LCD_SDSS!"
|
||||
#endif
|
||||
|
||||
@@ -90,11 +90,11 @@ void HAL_init() {
|
||||
//debug_frmwrk_init();
|
||||
//_DBG("\n\nDebug running\n");
|
||||
// Initialize the SD card chip select pins as soon as possible
|
||||
#if PIN_EXISTS(SS)
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(ONBOARD_SD_CS) && ONBOARD_SD_CS_PIN != SS_PIN
|
||||
#if PIN_EXISTS(ONBOARD_SD_CS) && ONBOARD_SD_CS_PIN != SD_SS_PIN
|
||||
OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "../../core/macros.h"
|
||||
|
||||
#if BOTH(SDSUPPORT, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
||||
#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
|
||||
@@ -31,24 +31,24 @@
|
||||
#endif
|
||||
|
||||
/** onboard SD card */
|
||||
//#define SCK_PIN P0_07
|
||||
//#define MISO_PIN P0_08
|
||||
//#define MOSI_PIN P0_09
|
||||
//#define SS_PIN P0_06
|
||||
//#define SD_SCK_PIN P0_07
|
||||
//#define SD_MISO_PIN P0_08
|
||||
//#define SD_MOSI_PIN P0_09
|
||||
//#define SD_SS_PIN P0_06
|
||||
/** external */
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN P0_15
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN P0_15
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN P0_17
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN P0_17
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN P0_18
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN P0_18
|
||||
#endif
|
||||
#ifndef SS_PIN
|
||||
#define SS_PIN P1_23
|
||||
#ifndef SD_SS_PIN
|
||||
#define SD_SS_PIN P1_23
|
||||
#endif
|
||||
#if !defined(SDSS) || SDSS == P_NC // gets defaulted in pins.h
|
||||
#undef SDSS
|
||||
#define SDSS SS_PIN
|
||||
#define SDSS SD_SS_PIN
|
||||
#endif
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
#endif
|
||||
|
||||
#ifndef TOUCH_MISO_PIN
|
||||
#define TOUCH_MISO_PIN MISO_PIN
|
||||
#define TOUCH_MISO_PIN SD_MISO_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_MOSI_PIN
|
||||
#define TOUCH_MOSI_PIN MOSI_PIN
|
||||
#define TOUCH_MOSI_PIN SD_MOSI_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_SCK_PIN
|
||||
#define TOUCH_SCK_PIN SCK_PIN
|
||||
#define TOUCH_SCK_PIN SD_SCK_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_CS_PIN
|
||||
#define TOUCH_CS_PIN CS_PIN
|
||||
#define TOUCH_CS_PIN SD_SS_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_INT_PIN
|
||||
#define TOUCH_INT_PIN -1
|
||||
|
||||
@@ -62,10 +62,13 @@
|
||||
#include <U8glib.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
void spiBegin();
|
||||
void spiInit(uint8_t spiRate);
|
||||
void spiSend(uint8_t b);
|
||||
void spiSend(const uint8_t* buf, size_t n);
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#ifdef SD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SD_SPI_SPEED // Assume SPI speed shared with SD
|
||||
#else
|
||||
#define LCD_SPI_SPEED SPI_FULL_SPEED // Use full speed if SD speed is not supplied
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
@@ -81,10 +84,7 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
u8g_Delay(5);
|
||||
spiBegin();
|
||||
#ifndef SPI_SPEED
|
||||
#define SPI_SPEED SPI_FULL_SPEED // use same SPI speed as SD card
|
||||
#endif
|
||||
spiInit(SPI_SPEED);
|
||||
spiInit(LCD_SPI_SPEED);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
|
||||
@@ -62,9 +62,11 @@
|
||||
#include <U8glib.h>
|
||||
#include <SoftwareSPI.h>
|
||||
#include "../../shared/Delay.h"
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 3 // About 1 MHz
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SPI_EIGHTH_SPEED // About 1 MHz
|
||||
#endif
|
||||
|
||||
static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL;
|
||||
static uint8_t SPI_speed = 0;
|
||||
@@ -92,7 +94,7 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar
|
||||
u8g_SetPIOutput(u8g, U8G_PI_MOSI);
|
||||
u8g_Delay(5);
|
||||
|
||||
SPI_speed = swSpiInit(SPI_SPEED, SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL);
|
||||
SPI_speed = swSpiInit(LCD_SPI_SPEED, SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL);
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
|
||||
|
||||
@@ -60,9 +60,11 @@
|
||||
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||
|
||||
#include <SoftwareSPI.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SPI_QUARTER_SPEED // About 2 MHz
|
||||
#endif
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <algorithm>
|
||||
@@ -145,7 +147,7 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
SPI_speed = swSpiInit(SPI_SPEED, u8g->pin_list[U8G_PI_SCK], u8g->pin_list[U8G_PI_MOSI]);
|
||||
SPI_speed = swSpiInit(LCD_SPI_SPEED, u8g->pin_list[U8G_PI_SCK], u8g->pin_list[U8G_PI_MOSI]);
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_MOSI, 0);
|
||||
break;
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
* SPI | 53 52 50 51 |
|
||||
* SPI1 | 83 81 80 82 |
|
||||
* +-------------------------+
|
||||
* Any pin can be used for Chip Select (SS_PIN)
|
||||
* Any pin can be used for Chip Select (SD_SS_PIN)
|
||||
*/
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN 52
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN 52
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN 50
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN 50
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN 51
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN 51
|
||||
#endif
|
||||
#ifndef SDSS
|
||||
#define SDSS 53
|
||||
@@ -51,4 +51,4 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define SS_PIN SDSS
|
||||
#define SD_SS_PIN SDSS
|
||||
|
||||
@@ -143,19 +143,15 @@ void _delay_ms(const int delay);
|
||||
|
||||
extern "C" char* _sbrk(int incr);
|
||||
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
static inline int freeMemory() {
|
||||
volatile char top;
|
||||
return &top - reinterpret_cast<char*>(_sbrk(0));
|
||||
}
|
||||
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//
|
||||
// ADC
|
||||
@@ -163,14 +159,14 @@ static inline int freeMemory() {
|
||||
|
||||
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)
|
||||
|
||||
inline void HAL_adc_init() {}
|
||||
|
||||
#define HAL_ADC_VREF 3.3
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_ADC_RESOLUTION ADC_RESOLUTION // 12
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
inline void HAL_adc_init() { analogReadResolution(HAL_ADC_RESOLUTION); }
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
|
||||
uint16_t HAL_adc_get_result();
|
||||
|
||||
@@ -45,10 +45,10 @@ static SPISettings spiConfig;
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
void spiBegin(void) {
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SCK_PIN, HIGH);
|
||||
SET_INPUT(MISO_PIN);
|
||||
OUT_WRITE(MOSI_PIN, HIGH);
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
OUT_WRITE(SD_SCK_PIN, HIGH);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
OUT_WRITE(SD_MOSI_PIN, HIGH);
|
||||
}
|
||||
|
||||
static uint16_t delay_STM32_soft_spi;
|
||||
@@ -72,15 +72,15 @@ static SPISettings spiConfig;
|
||||
|
||||
uint8_t HAL_SPI_STM32_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(MOSI_PIN, b & 0x80);
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
WRITE(SD_MOSI_PIN, b & 0x80);
|
||||
|
||||
DELAY_NS(delay_STM32_soft_spi);
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
WRITE(SD_SCK_PIN, HIGH);
|
||||
DELAY_NS(delay_STM32_soft_spi);
|
||||
|
||||
b <<= 1; // little setup time
|
||||
b |= (READ(MISO_PIN) != 0);
|
||||
b |= (READ(SD_MISO_PIN) != 0);
|
||||
}
|
||||
DELAY_NS(125);
|
||||
return b;
|
||||
@@ -132,8 +132,8 @@ static SPISettings spiConfig;
|
||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if PIN_EXISTS(SS)
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -154,10 +154,9 @@ static SPISettings spiConfig;
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
|
||||
#if ENABLED(CUSTOM_SPI_PINS)
|
||||
SPI.setMISO(MISO_PIN);
|
||||
SPI.setMOSI(MOSI_PIN);
|
||||
SPI.setSCLK(SCK_PIN);
|
||||
SPI.setSSEL(SS_PIN);
|
||||
SPI.setMISO(SD_MISO_PIN);
|
||||
SPI.setMOSI(SD_MOSI_PIN);
|
||||
SPI.setSCLK(SD_SCK_PIN);
|
||||
#endif
|
||||
|
||||
SPI.begin();
|
||||
|
||||
@@ -60,7 +60,6 @@ void MarlinSPI::setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaH
|
||||
_dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
}
|
||||
#ifdef STM32F4xx
|
||||
_dmaHandle.Init.Channel = DMA_CHANNEL_3;
|
||||
_dmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
#endif
|
||||
|
||||
@@ -73,7 +72,8 @@ void MarlinSPI::setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaH
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Channel3 : DMA1_Channel2;
|
||||
#elif defined(STM32F4xx)
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
_dmaHandle.Instance = DMA2_Stream3;
|
||||
_dmaHandle.Init.Channel = DMA_CHANNEL_3;
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA2_Stream3 : DMA2_Stream0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -83,7 +83,9 @@ void MarlinSPI::setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaH
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Channel5 : DMA1_Channel4;
|
||||
#elif defined(STM32F4xx)
|
||||
//TODO: f4 dma config
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
_dmaHandle.Init.Channel = DMA_CHANNEL_0;
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Stream4 : DMA1_Stream3;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -93,7 +95,9 @@ void MarlinSPI::setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaH
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA2_Channel2 : DMA2_Channel1;
|
||||
#elif defined(STM32F4xx)
|
||||
//TODO: f4 dma config
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
_dmaHandle.Init.Channel = DMA_CHANNEL_0;
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Stream5 : DMA1_Stream2;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -88,18 +88,37 @@
|
||||
|
||||
MKS Robin board seems to have stable SDIO with BusWide 1bit and ClockDiv 8 i.e. 4.8MHz SDIO clock frequency
|
||||
Additional testing is required as there are clearly some 4bit initialization problems
|
||||
|
||||
Add -DTRANSFER_CLOCK_DIV=8 to build parameters to improve SDIO stability
|
||||
*/
|
||||
|
||||
#ifndef TRANSFER_CLOCK_DIV
|
||||
#define TRANSFER_CLOCK_DIV (uint8_t(SDIO_INIT_CLK_DIV) / 40)
|
||||
#endif
|
||||
|
||||
#ifndef USBD_OK
|
||||
#define USBD_OK 0
|
||||
#endif
|
||||
|
||||
// Target Clock, configurable. Default is 18MHz, from STM32F1
|
||||
#ifndef SDIO_CLOCK
|
||||
#define SDIO_CLOCK 18000000 /* 18 MHz */
|
||||
#endif
|
||||
|
||||
// SDIO retries, configurable. Default is 3, from STM32F1
|
||||
#ifndef SDIO_READ_RETRIES
|
||||
#define SDIO_READ_RETRIES 3
|
||||
#endif
|
||||
|
||||
// SDIO Max Clock (naming from STM Manual, don't change)
|
||||
#define SDIOCLK 48000000
|
||||
|
||||
static uint32_t clock_to_divider(uint32_t clk) {
|
||||
// limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals
|
||||
// Also limited to no more than 48Mhz (SDIOCLK).
|
||||
const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq();
|
||||
clk = min(clk, (uint32_t)(pclk2 * 8 / 3));
|
||||
clk = min(clk, (uint32_t)SDIOCLK);
|
||||
// Round up divider, so we don't run the card over the speed supported,
|
||||
// and subtract by 2, because STM32 will add 2, as written in the manual:
|
||||
// SDIO_CK frequency = SDIOCLK / [CLKDIV + 2]
|
||||
return pclk2 / clk + (pclk2 % clk != 0) - 2;
|
||||
}
|
||||
|
||||
void go_to_transfer_speed() {
|
||||
SD_InitTypeDef Init;
|
||||
|
||||
@@ -109,7 +128,7 @@
|
||||
Init.ClockPowerSave = hsd.Init.ClockPowerSave;
|
||||
Init.BusWide = hsd.Init.BusWide;
|
||||
Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
|
||||
Init.ClockDiv = TRANSFER_CLOCK_DIV;
|
||||
Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
|
||||
|
||||
/* Initialize SDIO peripheral interface with default configuration */
|
||||
SDIO_Init(hsd.Instance, Init);
|
||||
@@ -155,38 +174,25 @@
|
||||
//Initialize the SDIO (with initial <400Khz Clock)
|
||||
tempreg = 0; //Reset value
|
||||
tempreg |= SDIO_CLKCR_CLKEN; // Clock enabled
|
||||
tempreg |= (uint32_t)0x76; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz
|
||||
tempreg |= SDIO_INIT_CLK_DIV; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz
|
||||
// Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable
|
||||
SDIO->CLKCR = tempreg;
|
||||
|
||||
// Power up the SDIO
|
||||
SDIO->POWER = 0x03;
|
||||
SDIO_PowerState_ON(SDIO);
|
||||
}
|
||||
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
|
||||
UNUSED(hsd); /* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(hsd); // Prevent unused argument(s) compilation warning
|
||||
__HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock
|
||||
}
|
||||
|
||||
constexpr uint8_t SD_RETRY_COUNT = TERN(SD_CHECK_AND_RETRY, 3, 1);
|
||||
|
||||
bool SDIO_Init() {
|
||||
//init SDIO and get SD card info
|
||||
|
||||
uint8_t retryCnt = SD_RETRY_COUNT;
|
||||
uint8_t retryCnt = SDIO_READ_RETRIES;
|
||||
|
||||
bool status;
|
||||
hsd.Instance = SDIO;
|
||||
hsd.State = (HAL_SD_StateTypeDef) 0; // HAL_SD_STATE_RESET
|
||||
|
||||
/*
|
||||
hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
|
||||
hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
|
||||
hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
|
||||
hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
|
||||
hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
|
||||
hsd.Init.ClockDiv = 8;
|
||||
*/
|
||||
hsd.State = HAL_SD_STATE_RESET;
|
||||
|
||||
SD_LowLevel_Init();
|
||||
|
||||
@@ -258,7 +264,7 @@
|
||||
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||
hsd.Instance = SDIO;
|
||||
uint8_t retryCnt = SD_RETRY_COUNT;
|
||||
uint8_t retryCnt = SDIO_READ_RETRIES;
|
||||
|
||||
bool status;
|
||||
for (;;) {
|
||||
@@ -307,7 +313,7 @@
|
||||
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
hsd.Instance = SDIO;
|
||||
uint8_t retryCnt = SD_RETRY_COUNT;
|
||||
uint8_t retryCnt = SDIO_READ_RETRIES;
|
||||
bool status;
|
||||
for (;;) {
|
||||
status = (bool) HAL_SD_WriteBlocks(&hsd, (uint8_t*)src, block, 1, 500); // write one 512 byte block with 500mS timeout
|
||||
|
||||
@@ -51,3 +51,7 @@
|
||||
#elif ENABLED(SERIAL_STATS_DROPPED_RX)
|
||||
#error "SERIAL_STATS_DROPPED_RX is not supported on this platform."
|
||||
#endif
|
||||
|
||||
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32F4xx, STM32F1xx)
|
||||
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32F4 and STM32F1 hardware."
|
||||
#endif
|
||||
|
||||
@@ -137,32 +137,18 @@ const XrefInfo pin_xref[] PROGMEM = {
|
||||
#endif
|
||||
|
||||
uint8_t get_pin_mode(const pin_t Ard_num) {
|
||||
uint32_t mode_all = 0;
|
||||
const PinName dp = digitalPinToPinName(Ard_num);
|
||||
switch (PORT_ALPHA(dp)) {
|
||||
case 'A' : mode_all = GPIOA->MODER; break;
|
||||
case 'B' : mode_all = GPIOB->MODER; break;
|
||||
case 'C' : mode_all = GPIOC->MODER; break;
|
||||
case 'D' : mode_all = GPIOD->MODER; break;
|
||||
#ifdef PE_0
|
||||
case 'E' : mode_all = GPIOE->MODER; break;
|
||||
#elif defined(PF_0)
|
||||
case 'F' : mode_all = GPIOF->MODER; break;
|
||||
#elif defined(PG_0)
|
||||
case 'G' : mode_all = GPIOG->MODER; break;
|
||||
#elif defined(PH_0)
|
||||
case 'H' : mode_all = GPIOH->MODER; break;
|
||||
#elif defined(PI_0)
|
||||
case 'I' : mode_all = GPIOI->MODER; break;
|
||||
#elif defined(PJ_0)
|
||||
case 'J' : mode_all = GPIOJ->MODER; break;
|
||||
#elif defined(PK_0)
|
||||
case 'K' : mode_all = GPIOK->MODER; break;
|
||||
#elif defined(PL_0)
|
||||
case 'L' : mode_all = GPIOL->MODER; break;
|
||||
#endif
|
||||
uint32_t ll_pin = STM_LL_GPIO_PIN(dp);
|
||||
GPIO_TypeDef *port = get_GPIO_Port(STM_PORT(dp));
|
||||
uint32_t mode = LL_GPIO_GetPinMode(port, ll_pin);
|
||||
switch (mode) {
|
||||
case LL_GPIO_MODE_ANALOG: return MODE_PIN_ANALOG;
|
||||
case LL_GPIO_MODE_INPUT: return MODE_PIN_INPUT;
|
||||
case LL_GPIO_MODE_OUTPUT: return MODE_PIN_OUTPUT;
|
||||
case LL_GPIO_MODE_ALTERNATE: return MODE_PIN_ALT;
|
||||
TERN_(STM32F1xx, case LL_GPIO_MODE_FLOATING:)
|
||||
default: return 0;
|
||||
}
|
||||
return (mode_all >> (2 * uint8_t(PIN_NUM(dp)))) & 0x03;
|
||||
}
|
||||
|
||||
bool GET_PINMODE(const pin_t Ard_num) {
|
||||
@@ -217,58 +203,62 @@ bool pwm_status(const pin_t Ard_num) {
|
||||
}
|
||||
|
||||
void pwm_details(const pin_t Ard_num) {
|
||||
if (pwm_status(Ard_num)) {
|
||||
uint32_t alt_all = 0;
|
||||
const PinName dp = digitalPinToPinName(Ard_num);
|
||||
pin_t pin_number = uint8_t(PIN_NUM(dp));
|
||||
const bool over_7 = pin_number >= 8;
|
||||
const uint8_t ind = over_7 ? 1 : 0;
|
||||
switch (PORT_ALPHA(dp)) { // get alt function
|
||||
case 'A' : alt_all = GPIOA->AFR[ind]; break;
|
||||
case 'B' : alt_all = GPIOB->AFR[ind]; break;
|
||||
case 'C' : alt_all = GPIOC->AFR[ind]; break;
|
||||
case 'D' : alt_all = GPIOD->AFR[ind]; break;
|
||||
#ifdef PE_0
|
||||
case 'E' : alt_all = GPIOE->AFR[ind]; break;
|
||||
#elif defined (PF_0)
|
||||
case 'F' : alt_all = GPIOF->AFR[ind]; break;
|
||||
#elif defined (PG_0)
|
||||
case 'G' : alt_all = GPIOG->AFR[ind]; break;
|
||||
#elif defined (PH_0)
|
||||
case 'H' : alt_all = GPIOH->AFR[ind]; break;
|
||||
#elif defined (PI_0)
|
||||
case 'I' : alt_all = GPIOI->AFR[ind]; break;
|
||||
#elif defined (PJ_0)
|
||||
case 'J' : alt_all = GPIOJ->AFR[ind]; break;
|
||||
#elif defined (PK_0)
|
||||
case 'K' : alt_all = GPIOK->AFR[ind]; break;
|
||||
#elif defined (PL_0)
|
||||
case 'L' : alt_all = GPIOL->AFR[ind]; break;
|
||||
#endif
|
||||
}
|
||||
if (over_7) pin_number -= 8;
|
||||
#ifndef STM32F1xx
|
||||
if (pwm_status(Ard_num)) {
|
||||
uint32_t alt_all = 0;
|
||||
const PinName dp = digitalPinToPinName(Ard_num);
|
||||
pin_t pin_number = uint8_t(PIN_NUM(dp));
|
||||
const bool over_7 = pin_number >= 8;
|
||||
const uint8_t ind = over_7 ? 1 : 0;
|
||||
switch (PORT_ALPHA(dp)) { // get alt function
|
||||
case 'A' : alt_all = GPIOA->AFR[ind]; break;
|
||||
case 'B' : alt_all = GPIOB->AFR[ind]; break;
|
||||
case 'C' : alt_all = GPIOC->AFR[ind]; break;
|
||||
case 'D' : alt_all = GPIOD->AFR[ind]; break;
|
||||
#ifdef PE_0
|
||||
case 'E' : alt_all = GPIOE->AFR[ind]; break;
|
||||
#elif defined (PF_0)
|
||||
case 'F' : alt_all = GPIOF->AFR[ind]; break;
|
||||
#elif defined (PG_0)
|
||||
case 'G' : alt_all = GPIOG->AFR[ind]; break;
|
||||
#elif defined (PH_0)
|
||||
case 'H' : alt_all = GPIOH->AFR[ind]; break;
|
||||
#elif defined (PI_0)
|
||||
case 'I' : alt_all = GPIOI->AFR[ind]; break;
|
||||
#elif defined (PJ_0)
|
||||
case 'J' : alt_all = GPIOJ->AFR[ind]; break;
|
||||
#elif defined (PK_0)
|
||||
case 'K' : alt_all = GPIOK->AFR[ind]; break;
|
||||
#elif defined (PL_0)
|
||||
case 'L' : alt_all = GPIOL->AFR[ind]; break;
|
||||
#endif
|
||||
}
|
||||
if (over_7) pin_number -= 8;
|
||||
|
||||
uint8_t alt_func = (alt_all >> (4 * pin_number)) & 0x0F;
|
||||
SERIAL_ECHOPAIR("Alt Function: ", alt_func);
|
||||
if (alt_func < 10) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPGM(" - ");
|
||||
switch (alt_func) {
|
||||
case 0 : SERIAL_ECHOPGM("system (misc. I/O)"); break;
|
||||
case 1 : SERIAL_ECHOPGM("TIM1/TIM2 (probably PWM)"); break;
|
||||
case 2 : SERIAL_ECHOPGM("TIM3..5 (probably PWM)"); break;
|
||||
case 3 : SERIAL_ECHOPGM("TIM8..11 (probably PWM)"); break;
|
||||
case 4 : SERIAL_ECHOPGM("I2C1..3"); break;
|
||||
case 5 : SERIAL_ECHOPGM("SPI1/SPI2"); break;
|
||||
case 6 : SERIAL_ECHOPGM("SPI3"); break;
|
||||
case 7 : SERIAL_ECHOPGM("USART1..3"); break;
|
||||
case 8 : SERIAL_ECHOPGM("USART4..6"); break;
|
||||
case 9 : SERIAL_ECHOPGM("CAN1/CAN2, TIM12..14 (probably PWM)"); break;
|
||||
case 10 : SERIAL_ECHOPGM("OTG"); break;
|
||||
case 11 : SERIAL_ECHOPGM("ETH"); break;
|
||||
case 12 : SERIAL_ECHOPGM("FSMC, SDIO, OTG"); break;
|
||||
case 13 : SERIAL_ECHOPGM("DCMI"); break;
|
||||
case 14 : SERIAL_ECHOPGM("unused (shouldn't see this)"); break;
|
||||
case 15 : SERIAL_ECHOPGM("EVENTOUT"); break;
|
||||
uint8_t alt_func = (alt_all >> (4 * pin_number)) & 0x0F;
|
||||
SERIAL_ECHOPAIR("Alt Function: ", alt_func);
|
||||
if (alt_func < 10) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPGM(" - ");
|
||||
switch (alt_func) {
|
||||
case 0 : SERIAL_ECHOPGM("system (misc. I/O)"); break;
|
||||
case 1 : SERIAL_ECHOPGM("TIM1/TIM2 (probably PWM)"); break;
|
||||
case 2 : SERIAL_ECHOPGM("TIM3..5 (probably PWM)"); break;
|
||||
case 3 : SERIAL_ECHOPGM("TIM8..11 (probably PWM)"); break;
|
||||
case 4 : SERIAL_ECHOPGM("I2C1..3"); break;
|
||||
case 5 : SERIAL_ECHOPGM("SPI1/SPI2"); break;
|
||||
case 6 : SERIAL_ECHOPGM("SPI3"); break;
|
||||
case 7 : SERIAL_ECHOPGM("USART1..3"); break;
|
||||
case 8 : SERIAL_ECHOPGM("USART4..6"); break;
|
||||
case 9 : SERIAL_ECHOPGM("CAN1/CAN2, TIM12..14 (probably PWM)"); break;
|
||||
case 10 : SERIAL_ECHOPGM("OTG"); break;
|
||||
case 11 : SERIAL_ECHOPGM("ETH"); break;
|
||||
case 12 : SERIAL_ECHOPGM("FSMC, SDIO, OTG"); break;
|
||||
case 13 : SERIAL_ECHOPGM("DCMI"); break;
|
||||
case 14 : SERIAL_ECHOPGM("unused (shouldn't see this)"); break;
|
||||
case 15 : SERIAL_ECHOPGM("EVENTOUT"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// TODO: F1 doesn't support changing pins function, so we need to check the function of the PIN and if it's enabled
|
||||
#endif
|
||||
} // pwm_details
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
/**
|
||||
* Define SPI Pins: SCK, MISO, MOSI, SS
|
||||
*/
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN PIN_SPI_SCK
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN PIN_SPI_SCK
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN PIN_SPI_MISO
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN PIN_SPI_MISO
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN PIN_SPI_MOSI
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN PIN_SPI_MOSI
|
||||
#endif
|
||||
#ifndef SS_PIN
|
||||
#define SS_PIN PIN_SPI_SS
|
||||
#ifndef SD_SS_PIN
|
||||
#define SD_SS_PIN PIN_SPI_SS
|
||||
#endif
|
||||
|
||||
@@ -48,13 +48,14 @@ void TFT_FSMC::Init() {
|
||||
|
||||
uint32_t NSBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
|
||||
|
||||
// Perform the SRAM1 memory initialization sequence
|
||||
SRAMx.Instance = FSMC_NORSRAM_DEVICE;
|
||||
SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
|
||||
/* SRAMx.Init */
|
||||
// SRAMx.Init
|
||||
SRAMx.Init.NSBank = NSBank;
|
||||
SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
|
||||
SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
|
||||
SRAMx.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
|
||||
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16);
|
||||
SRAMx.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
|
||||
SRAMx.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
|
||||
SRAMx.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
|
||||
@@ -67,8 +68,8 @@ void TFT_FSMC::Init() {
|
||||
#ifdef STM32F4xx
|
||||
SRAMx.Init.PageSize = FSMC_PAGE_SIZE_NONE;
|
||||
#endif
|
||||
/* Read Timing - relatively slow to ensure ID information is correctly read from TFT controller */
|
||||
/* Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss */
|
||||
// Read Timing - relatively slow to ensure ID information is correctly read from TFT controller
|
||||
// Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss
|
||||
Timing.AddressSetupTime = 15;
|
||||
Timing.AddressHoldTime = 15;
|
||||
Timing.DataSetupTime = 24;
|
||||
@@ -76,8 +77,8 @@ void TFT_FSMC::Init() {
|
||||
Timing.CLKDivision = 16;
|
||||
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 */
|
||||
// Write Timing
|
||||
// Can be decreases from 8-15-8 to 0-0-1 with risk of stability loss
|
||||
ExtTiming.AddressSetupTime = 8;
|
||||
ExtTiming.AddressHoldTime = 15;
|
||||
ExtTiming.DataSetupTime = 8;
|
||||
@@ -131,7 +132,7 @@ void TFT_FSMC::Init() {
|
||||
|
||||
uint32_t TFT_FSMC::GetID() {
|
||||
uint32_t id;
|
||||
WriteReg(0x0000);
|
||||
WriteReg(0);
|
||||
id = LCD->RAM;
|
||||
|
||||
if (id == 0)
|
||||
@@ -141,41 +142,39 @@ uint32_t TFT_FSMC::GetID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
uint32_t TFT_FSMC::ReadID(uint16_t Reg) {
|
||||
uint32_t id;
|
||||
WriteReg(Reg);
|
||||
id = LCD->RAM; // dummy read
|
||||
id = Reg << 24;
|
||||
id |= (LCD->RAM & 0x00FF) << 16;
|
||||
id |= (LCD->RAM & 0x00FF) << 8;
|
||||
id |= LCD->RAM & 0x00FF;
|
||||
return id;
|
||||
}
|
||||
uint32_t TFT_FSMC::ReadID(tft_data_t Reg) {
|
||||
uint32_t id;
|
||||
WriteReg(Reg);
|
||||
id = LCD->RAM; // dummy read
|
||||
id = Reg << 24;
|
||||
id |= (LCD->RAM & 0x00FF) << 16;
|
||||
id |= (LCD->RAM & 0x00FF) << 8;
|
||||
id |= LCD->RAM & 0x00FF;
|
||||
return id;
|
||||
}
|
||||
|
||||
bool TFT_FSMC::isBusy() {
|
||||
if (__IS_DMA_ENABLED(&DMAtx))
|
||||
#if defined(STM32F1xx)
|
||||
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
|
||||
#elif defined(STM32F4xx)
|
||||
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
|
||||
#endif
|
||||
if (dmaEnabled) {
|
||||
if (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) != 0 || __HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) != 0)
|
||||
Abort();
|
||||
return __IS_DMA_ENABLED(&DMAtx);
|
||||
}
|
||||
else
|
||||
Abort();
|
||||
return dmaEnabled;
|
||||
}
|
||||
|
||||
void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||
DMAtx.Init.PeriphInc = MemoryIncrease;
|
||||
HAL_DMA_Init(&DMAtx);
|
||||
|
||||
__HAL_DMA_CLEAR_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx));
|
||||
__HAL_DMA_CLEAR_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx));
|
||||
|
||||
#ifdef STM32F1xx
|
||||
DMAtx.Instance->CNDTR = Count;
|
||||
DMAtx.Instance->CPAR = (uint32_t)Data;
|
||||
DMAtx.Instance->CMAR = (uint32_t)&(LCD->RAM);
|
||||
#elif defined(STM32F4xx)
|
||||
DMAtx.Instance->NDTR = Count;
|
||||
DMAtx.Instance->PAR = (uint32_t)Data;
|
||||
DMAtx.Instance->M0AR = (uint32_t)&(LCD->RAM);
|
||||
#endif
|
||||
__HAL_DMA_ENABLE(&DMAtx);
|
||||
DataTransferBegin();
|
||||
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count);
|
||||
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||
Abort();
|
||||
}
|
||||
|
||||
#endif // HAS_FSMC_TFT
|
||||
|
||||
@@ -25,10 +25,8 @@
|
||||
|
||||
#ifdef STM32F1xx
|
||||
#include "stm32f1xx_hal.h"
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
#elif defined(STM32F4xx)
|
||||
#include "stm32f4xx_hal.h"
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||
#else
|
||||
#error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
|
||||
#endif
|
||||
@@ -44,9 +42,12 @@
|
||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
#define TFT_DATASIZE TERN(TFT_INTERFACE_FSMC_8BIT, DATASIZE_8BIT, DATASIZE_16BIT)
|
||||
typedef TERN(TFT_INTERFACE_FSMC_8BIT, uint8_t, uint16_t) tft_data_t;
|
||||
|
||||
typedef struct {
|
||||
__IO uint16_t REG;
|
||||
__IO uint16_t RAM;
|
||||
__IO tft_data_t REG;
|
||||
__IO tft_data_t RAM;
|
||||
} LCD_CONTROLLER_TypeDef;
|
||||
|
||||
class TFT_FSMC {
|
||||
@@ -56,8 +57,8 @@ class TFT_FSMC {
|
||||
|
||||
static LCD_CONTROLLER_TypeDef *LCD;
|
||||
|
||||
static uint32_t ReadID(uint16_t Reg);
|
||||
static void Transmit(uint16_t Data) { LCD->RAM = Data; __DSB(); }
|
||||
static uint32_t ReadID(tft_data_t Reg);
|
||||
static void Transmit(tft_data_t Data) { LCD->RAM = Data; __DSB(); }
|
||||
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
||||
|
||||
public:
|
||||
@@ -66,14 +67,21 @@ class TFT_FSMC {
|
||||
static bool isBusy();
|
||||
static void Abort() { __HAL_DMA_DISABLE(&DMAtx); }
|
||||
|
||||
static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) {}
|
||||
static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
|
||||
static void DataTransferEnd() {};
|
||||
|
||||
static void WriteData(uint16_t Data) { Transmit(Data); }
|
||||
static void WriteReg(uint16_t Reg) { LCD->REG = Reg; __DSB(); }
|
||||
static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); }
|
||||
static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); }
|
||||
|
||||
static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
|
||||
static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
|
||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
||||
static uint16_t Data; Data = Color;
|
||||
while (Count > 0) {
|
||||
TransmitDMA(DMA_MINC_DISABLE, &Data, Count > 0xFFFF ? 0xFFFF : Count);
|
||||
Count = Count > 0xFFFF ? Count - 0xFFFF : 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -98,14 +106,16 @@ const PinMap PinMap_FSMC[] = {
|
||||
{PE_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D05
|
||||
{PE_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D06
|
||||
{PE_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D07
|
||||
{PE_11, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D08
|
||||
{PE_12, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D09
|
||||
{PE_13, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D10
|
||||
{PE_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D11
|
||||
{PE_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D12
|
||||
{PD_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D13
|
||||
{PD_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D14
|
||||
{PD_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D15
|
||||
#if DISABLED(TFT_INTERFACE_FSMC_8BIT)
|
||||
{PE_11, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D08
|
||||
{PE_12, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D09
|
||||
{PE_13, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D10
|
||||
{PE_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D11
|
||||
{PE_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D12
|
||||
{PD_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D13
|
||||
{PD_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D14
|
||||
{PD_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D15
|
||||
#endif
|
||||
{PD_4, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NOE
|
||||
{PD_5, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NWE
|
||||
{NC, NP, 0}
|
||||
@@ -121,7 +131,11 @@ const PinMap PinMap_FSMC_CS[] = {
|
||||
{NC, NP, 0}
|
||||
};
|
||||
|
||||
#define FSMC_RS(A) (void *)((2 << A) - 2)
|
||||
#if ENABLED(TFT_INTERFACE_FSMC_8BIT)
|
||||
#define FSMC_RS(A) (void *)((2 << (A-1)) - 1)
|
||||
#else
|
||||
#define FSMC_RS(A) (void *)((2 << A) - 2)
|
||||
#endif
|
||||
|
||||
const PinMap PinMap_FSMC_RS[] = {
|
||||
#ifdef PF0
|
||||
|
||||
@@ -34,22 +34,13 @@ DMA_HandleTypeDef TFT_SPI::DMAtx;
|
||||
void TFT_SPI::Init() {
|
||||
SPI_TypeDef *spiInstance;
|
||||
|
||||
#if PIN_EXISTS(TFT_RESET)
|
||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||
HAL_Delay(100);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
OUT_WRITE(TFT_A0_PIN, HIGH);
|
||||
OUT_WRITE(TFT_CS_PIN, HIGH);
|
||||
|
||||
if ((spiInstance = (SPI_TypeDef *)pinmap_peripheral(digitalPinToPinName(TFT_SCK_PIN), PinMap_SPI_SCLK)) == NP) return;
|
||||
if (spiInstance != (SPI_TypeDef *)pinmap_peripheral(digitalPinToPinName(TFT_MOSI_PIN), PinMap_SPI_MOSI)) return;
|
||||
|
||||
#if PIN_EXISTS(TFT_MISO) && (TFT_MISO_PIN != TFT_MOSI_PIN)
|
||||
#if PIN_EXISTS(TFT_MISO) && TFT_MISO_PIN != TFT_MOSI_PIN
|
||||
if (spiInstance != (SPI_TypeDef *)pinmap_peripheral(digitalPinToPinName(TFT_MISO_PIN), PinMap_SPI_MISO)) return;
|
||||
#endif
|
||||
|
||||
@@ -57,12 +48,7 @@ void TFT_SPI::Init() {
|
||||
SPIx.State = HAL_SPI_STATE_RESET;
|
||||
SPIx.Init.NSS = SPI_NSS_SOFT;
|
||||
SPIx.Init.Mode = SPI_MODE_MASTER;
|
||||
SPIx.Init.Direction =
|
||||
#if TFT_MISO_PIN == TFT_MOSI_PIN
|
||||
SPI_DIRECTION_1LINE;
|
||||
#else
|
||||
SPI_DIRECTION_2LINES;
|
||||
#endif
|
||||
SPIx.Init.Direction = (TFT_MISO_PIN == TFT_MOSI_PIN) ? SPI_DIRECTION_1LINE : SPI_DIRECTION_2LINES;
|
||||
SPIx.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
|
||||
SPIx.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||
SPIx.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||
@@ -74,7 +60,7 @@ void TFT_SPI::Init() {
|
||||
|
||||
pinmap_pinout(digitalPinToPinName(TFT_SCK_PIN), PinMap_SPI_SCLK);
|
||||
pinmap_pinout(digitalPinToPinName(TFT_MOSI_PIN), PinMap_SPI_MOSI);
|
||||
#if PIN_EXISTS(TFT_MISO) && (TFT_MISO_PIN != TFT_MOSI_PIN)
|
||||
#if PIN_EXISTS(TFT_MISO) && TFT_MISO_PIN != TFT_MOSI_PIN
|
||||
pinmap_pinout(digitalPinToPinName(TFT_MISO_PIN), PinMap_SPI_MISO);
|
||||
#endif
|
||||
pin_PullConfig(get_GPIO_Port(STM_PORT(digitalPinToPinName(TFT_SCK_PIN))), STM_LL_GPIO_PIN(digitalPinToPinName(TFT_SCK_PIN)), GPIO_PULLDOWN);
|
||||
@@ -82,23 +68,41 @@ void TFT_SPI::Init() {
|
||||
#ifdef SPI1_BASE
|
||||
if (SPIx.Instance == SPI1) {
|
||||
__HAL_RCC_SPI1_CLK_ENABLE();
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
#ifdef STM32F1xx
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA1_Channel3;
|
||||
#elif defined(STM32F4xx)
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA2_Stream3;
|
||||
DMAtx.Init.Channel = DMA_CHANNEL_3;
|
||||
#endif
|
||||
SPIx.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
|
||||
DMAtx.Instance = DMA1_Channel3;
|
||||
}
|
||||
#endif
|
||||
#ifdef SPI2_BASE
|
||||
if (SPIx.Instance == SPI2) {
|
||||
__HAL_RCC_SPI2_CLK_ENABLE();
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA1_Channel5;
|
||||
#ifdef STM32F1xx
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA1_Channel5;
|
||||
#elif defined(STM32F4xx)
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA1_Stream4;
|
||||
DMAtx.Init.Channel = DMA_CHANNEL_0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef SPI3_BASE
|
||||
if (SPIx.Instance == SPI3) {
|
||||
__HAL_RCC_SPI3_CLK_ENABLE();
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA2_Channel2;
|
||||
#ifdef STM32F1xx
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA2_Channel2;
|
||||
#elif defined(STM32F4xx)
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
DMAtx.Instance = DMA1_Stream5;
|
||||
DMAtx.Init.Channel = DMA_CHANNEL_0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -110,6 +114,9 @@ void TFT_SPI::Init() {
|
||||
DMAtx.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
DMAtx.Init.Mode = DMA_NORMAL;
|
||||
DMAtx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
#ifdef STM32F4xx
|
||||
DMAtx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
||||
@@ -128,11 +135,10 @@ uint32_t TFT_SPI::GetID() {
|
||||
}
|
||||
|
||||
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||
#if !PIN_EXISTS(TFT_MISO)
|
||||
return 0;
|
||||
#else
|
||||
uint32_t Data = 0;
|
||||
#if PIN_EXISTS(TFT_MISO)
|
||||
uint32_t BaudRatePrescaler = SPIx.Init.BaudRatePrescaler;
|
||||
uint32_t i, Data = 0;
|
||||
uint32_t i;
|
||||
|
||||
SPIx.Init.BaudRatePrescaler = SPIx.Instance == SPI1 ? SPI_BAUDRATEPRESCALER_8 : SPI_BAUDRATEPRESCALER_4;
|
||||
DataTransferBegin(DATASIZE_8BIT);
|
||||
@@ -156,27 +162,42 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||
DataTransferEnd();
|
||||
|
||||
SPIx.Init.BaudRatePrescaler = BaudRatePrescaler;
|
||||
|
||||
return Data >> 7;
|
||||
#endif
|
||||
|
||||
return Data >> 7;
|
||||
}
|
||||
|
||||
bool TFT_SPI::isBusy() {
|
||||
if (DMAtx.Instance->CCR & DMA_CCR_EN)
|
||||
#if defined(STM32F1xx)
|
||||
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
|
||||
#elif defined(STM32F4xx)
|
||||
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
|
||||
#endif
|
||||
if (dmaEnabled) {
|
||||
if (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) != 0 || __HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) != 0)
|
||||
Abort();
|
||||
return DMAtx.Instance->CCR & DMA_CCR_EN;
|
||||
}
|
||||
else
|
||||
Abort();
|
||||
return dmaEnabled;
|
||||
}
|
||||
|
||||
void TFT_SPI::Abort() {
|
||||
__HAL_DMA_DISABLE(&DMAtx);
|
||||
// Wait for any running spi
|
||||
while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
|
||||
while ((SPIx.Instance->SR & SPI_FLAG_BSY) == SPI_FLAG_BSY) {}
|
||||
// First, abort any running dma
|
||||
HAL_DMA_Abort(&DMAtx);
|
||||
// DeInit objects
|
||||
HAL_DMA_DeInit(&DMAtx);
|
||||
HAL_SPI_DeInit(&SPIx);
|
||||
// Deselect CS
|
||||
DataTransferEnd();
|
||||
}
|
||||
|
||||
void TFT_SPI::Transmit(uint16_t Data) {
|
||||
#if TFT_MISO_PIN == TFT_MOSI_PIN
|
||||
if (TFT_MISO_PIN == TFT_MOSI_PIN)
|
||||
SPI_1LINE_TX(&SPIx);
|
||||
#endif
|
||||
|
||||
__HAL_SPI_ENABLE(&SPIx);
|
||||
|
||||
@@ -185,29 +206,29 @@ void TFT_SPI::Transmit(uint16_t Data) {
|
||||
while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
|
||||
while ((SPIx.Instance->SR & SPI_FLAG_BSY) == SPI_FLAG_BSY) {}
|
||||
|
||||
#if TFT_MISO_PIN != TFT_MOSI_PIN
|
||||
if (TFT_MISO_PIN != TFT_MOSI_PIN)
|
||||
__HAL_SPI_CLEAR_OVRFLAG(&SPIx); /* Clear overrun flag in 2 Lines communication mode because received is not read */
|
||||
#endif
|
||||
}
|
||||
|
||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||
// Wait last dma finish, to start another
|
||||
while(isBusy()) { }
|
||||
|
||||
DMAtx.Init.MemInc = MemoryIncrease;
|
||||
HAL_DMA_Init(&DMAtx);
|
||||
|
||||
if (TFT_MISO_PIN == TFT_MOSI_PIN)
|
||||
SPI_1LINE_TX(&SPIx);
|
||||
|
||||
DataTransferBegin();
|
||||
|
||||
#if TFT_MISO_PIN == TFT_MOSI_PIN
|
||||
SPI_1LINE_TX(&SPIx);
|
||||
#endif
|
||||
|
||||
DMAtx.DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << DMAtx.ChannelIndex);
|
||||
DMAtx.Instance->CNDTR = Count;
|
||||
DMAtx.Instance->CPAR = (uint32_t)&(SPIx.Instance->DR);
|
||||
DMAtx.Instance->CMAR = (uint32_t)Data;
|
||||
__HAL_DMA_ENABLE(&DMAtx);
|
||||
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count);
|
||||
__HAL_SPI_ENABLE(&SPIx);
|
||||
|
||||
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
|
||||
|
||||
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||
Abort();
|
||||
}
|
||||
|
||||
#endif // HAS_SPI_TFT
|
||||
|
||||
@@ -64,4 +64,11 @@ public:
|
||||
|
||||
static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); }
|
||||
static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); }
|
||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
||||
static uint16_t Data; Data = Color;
|
||||
while (Count > 0) {
|
||||
TransmitDMA(DMA_MINC_DISABLE, &Data, Count > 0xFFFF ? 0xFFFF : Count);
|
||||
Count = Count > 0xFFFF ? Count - 0xFFFF : 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_TFT_XPT2046
|
||||
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
|
||||
|
||||
#include "xpt2046.h"
|
||||
#include "pinconfig.h"
|
||||
@@ -31,7 +31,6 @@
|
||||
uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
|
||||
|
||||
SPI_HandleTypeDef XPT2046::SPIx;
|
||||
DMA_HandleTypeDef XPT2046::DMAtx;
|
||||
|
||||
void XPT2046::Init() {
|
||||
SPI_TypeDef *spiInstance;
|
||||
@@ -71,34 +70,16 @@ void XPT2046::Init() {
|
||||
if (SPIx.Instance == SPI1) {
|
||||
__HAL_RCC_SPI1_CLK_ENABLE();
|
||||
SPIx.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
|
||||
#ifdef STM32F1xx
|
||||
DMAtx.Instance = DMA1_Channel3;
|
||||
#elif defined(STM32F4xx)
|
||||
DMAtx.Instance = DMA2_Stream3; // DMA2_Stream5
|
||||
#endif
|
||||
//SERIAL_ECHO_MSG(" Touch Screen on SPI1");
|
||||
}
|
||||
#endif
|
||||
#ifdef SPI2_BASE
|
||||
if (SPIx.Instance == SPI2) {
|
||||
__HAL_RCC_SPI2_CLK_ENABLE();
|
||||
#ifdef STM32F1xx
|
||||
DMAtx.Instance = DMA1_Channel5;
|
||||
#elif defined(STM32F4xx)
|
||||
DMAtx.Instance = DMA1_Stream4;
|
||||
#endif
|
||||
//SERIAL_ECHO_MSG(" Touch Screen on SPI2");
|
||||
}
|
||||
#endif
|
||||
#ifdef SPI3_BASE
|
||||
if (SPIx.Instance == SPI3) {
|
||||
__HAL_RCC_SPI3_CLK_ENABLE();
|
||||
#ifdef STM32F1xx
|
||||
DMAtx.Instance = DMA2_Channel2;
|
||||
#elif defined(STM32F4xx)
|
||||
DMAtx.Instance = DMA1_Stream5; // DMA1_Stream7
|
||||
#endif
|
||||
//SERIAL_ECHO_MSG(" Touch Screen on SPI3");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -107,7 +88,6 @@ void XPT2046::Init() {
|
||||
SET_INPUT(TOUCH_MISO_PIN);
|
||||
SET_OUTPUT(TOUCH_MOSI_PIN);
|
||||
SET_OUTPUT(TOUCH_SCK_PIN);
|
||||
//SERIAL_ECHO_MSG(" Touch Screen on Software SPI");
|
||||
}
|
||||
|
||||
getRawData(XPT2046_Z1);
|
||||
|
||||
@@ -60,19 +60,11 @@ enum XPTCoordinate : uint8_t {
|
||||
#define XPT2046_Z1_THRESHOLD 10
|
||||
#endif
|
||||
|
||||
#ifdef STM32F1xx
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
#elif defined(STM32F4xx)
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||
#endif
|
||||
|
||||
|
||||
class XPT2046 {
|
||||
private:
|
||||
static SPI_HandleTypeDef SPIx;
|
||||
static DMA_HandleTypeDef DMAtx;
|
||||
|
||||
static bool isBusy() { return SPIx.Instance ? __IS_DMA_ENABLED(&DMAtx) : false; }
|
||||
static bool isBusy() { return false; }
|
||||
|
||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||
static bool isTouched();
|
||||
|
||||
+112
-73
@@ -27,7 +27,6 @@
|
||||
// Local defines
|
||||
// ------------------------
|
||||
|
||||
|
||||
// Default timer priorities. Override by specifying alternate priorities in the board pins file.
|
||||
// The TONE timer is not present here, as it currently cannot be set programmatically. It is set
|
||||
// by defining TIM_IRQ_PRIO in the variant.h or platformio.ini file, which adjusts the default
|
||||
@@ -96,11 +95,6 @@
|
||||
#define STEP_TIMER_DEV _TIMER_DEV(STEP_TIMER)
|
||||
#define TEMP_TIMER_DEV _TIMER_DEV(TEMP_TIMER)
|
||||
|
||||
#define __TIMER_IRQ_NAME(X) TIM##X##_IRQn
|
||||
#define _TIMER_IRQ_NAME(X) __TIMER_IRQ_NAME(X)
|
||||
#define STEP_TIMER_IRQ_NAME _TIMER_IRQ_NAME(STEP_TIMER)
|
||||
#define TEMP_TIMER_IRQ_NAME _TIMER_IRQ_NAME(TEMP_TIMER)
|
||||
|
||||
// ------------------------
|
||||
// Private Variables
|
||||
// ------------------------
|
||||
@@ -197,87 +191,132 @@ void SetTimerInterruptPriorities() {
|
||||
TERN_(HAS_SERVOS, libServo::setInterruptPriority(SERVO_TIMER_IRQ_PRIO, 0));
|
||||
}
|
||||
|
||||
// This is a terrible hack to replicate the behavior used in the framework's SoftwareSerial.cpp
|
||||
// to choose a serial timer. It will select TIM7 on most boards used by Marlin, but this is more
|
||||
// resiliant to new MCUs which may not have a TIM7. Best practice is to explicitly specify
|
||||
// TIMER_SERIAL to avoid relying on framework selections which may not be predictable.
|
||||
#if !defined(TIMER_SERIAL)
|
||||
#if defined (TIM18_BASE)
|
||||
#define TIMER_SERIAL TIM18
|
||||
#elif defined (TIM7_BASE)
|
||||
#define TIMER_SERIAL TIM7
|
||||
#elif defined (TIM6_BASE)
|
||||
#define TIMER_SERIAL TIM6
|
||||
#elif defined (TIM22_BASE)
|
||||
#define TIMER_SERIAL TIM22
|
||||
#elif defined (TIM21_BASE)
|
||||
#define TIMER_SERIAL TIM21
|
||||
#elif defined (TIM17_BASE)
|
||||
#define TIMER_SERIAL TIM17
|
||||
#elif defined (TIM16_BASE)
|
||||
#define TIMER_SERIAL TIM16
|
||||
#elif defined (TIM15_BASE)
|
||||
#define TIMER_SERIAL TIM15
|
||||
#elif defined (TIM14_BASE)
|
||||
#define TIMER_SERIAL TIM14
|
||||
#elif defined (TIM13_BASE)
|
||||
#define TIMER_SERIAL TIM13
|
||||
#elif defined (TIM11_BASE)
|
||||
#define TIMER_SERIAL TIM11
|
||||
#elif defined (TIM10_BASE)
|
||||
#define TIMER_SERIAL TIM10
|
||||
#elif defined (TIM12_BASE)
|
||||
#define TIMER_SERIAL TIM12
|
||||
#elif defined (TIM19_BASE)
|
||||
#define TIMER_SERIAL TIM19
|
||||
#elif defined (TIM9_BASE)
|
||||
#define TIMER_SERIAL TIM9
|
||||
#elif defined (TIM5_BASE)
|
||||
#define TIMER_SERIAL TIM5
|
||||
#elif defined (TIM4_BASE)
|
||||
#define TIMER_SERIAL TIM4
|
||||
#elif defined (TIM3_BASE)
|
||||
#define TIMER_SERIAL TIM3
|
||||
#elif defined (TIM2_BASE)
|
||||
#define TIMER_SERIAL TIM2
|
||||
#elif defined (TIM20_BASE)
|
||||
#define TIMER_SERIAL TIM20
|
||||
#elif defined (TIM8_BASE)
|
||||
#define TIMER_SERIAL TIM8
|
||||
#elif defined (TIM1_BASE)
|
||||
#define TIMER_SERIAL TIM1
|
||||
#else
|
||||
#error No suitable timer found for SoftwareSerial, define TIMER_SERIAL in variant.h
|
||||
// ------------------------
|
||||
// Detect timer conflicts
|
||||
// ------------------------
|
||||
|
||||
// This list serves two purposes. Firstly, it facilitates build-time mapping between
|
||||
// variant-defined timer names (such as TIM1) and timer numbers. It also replicates
|
||||
// the order of timers used in the framework's SoftwareSerial.cpp. The first timer in
|
||||
// this list will be automatically used by SoftwareSerial if it is not already defined
|
||||
// in the board's variant or compiler options.
|
||||
static constexpr struct {uintptr_t base_address; int timer_number;} stm32_timer_map[] = {
|
||||
#ifdef TIM18_BASE
|
||||
{ uintptr_t(TIM18), 18 },
|
||||
#endif
|
||||
#ifdef TIM7_BASE
|
||||
{ uintptr_t(TIM7), 7 },
|
||||
#endif
|
||||
#ifdef TIM6_BASE
|
||||
{ uintptr_t(TIM6), 6 },
|
||||
#endif
|
||||
#ifdef TIM22_BASE
|
||||
{ uintptr_t(TIM22), 22 },
|
||||
#endif
|
||||
#ifdef TIM21_BASE
|
||||
{ uintptr_t(TIM21), 21 },
|
||||
#endif
|
||||
#ifdef TIM17_BASE
|
||||
{ uintptr_t(TIM17), 17 },
|
||||
#endif
|
||||
#ifdef TIM16_BASE
|
||||
{ uintptr_t(TIM16), 16 },
|
||||
#endif
|
||||
#ifdef TIM15_BASE
|
||||
{ uintptr_t(TIM15), 15 },
|
||||
#endif
|
||||
#ifdef TIM14_BASE
|
||||
{ uintptr_t(TIM14), 14 },
|
||||
#endif
|
||||
#ifdef TIM13_BASE
|
||||
{ uintptr_t(TIM13), 13 },
|
||||
#endif
|
||||
#ifdef TIM11_BASE
|
||||
{ uintptr_t(TIM11), 11 },
|
||||
#endif
|
||||
#ifdef TIM10_BASE
|
||||
{ uintptr_t(TIM10), 10 },
|
||||
#endif
|
||||
#ifdef TIM12_BASE
|
||||
{ uintptr_t(TIM12), 12 },
|
||||
#endif
|
||||
#ifdef TIM19_BASE
|
||||
{ uintptr_t(TIM19), 19 },
|
||||
#endif
|
||||
#ifdef TIM9_BASE
|
||||
{ uintptr_t(TIM9), 9 },
|
||||
#endif
|
||||
#ifdef TIM5_BASE
|
||||
{ uintptr_t(TIM5), 5 },
|
||||
#endif
|
||||
#ifdef TIM4_BASE
|
||||
{ uintptr_t(TIM4), 4 },
|
||||
#endif
|
||||
#ifdef TIM3_BASE
|
||||
{ uintptr_t(TIM3), 3 },
|
||||
#endif
|
||||
#ifdef TIM2_BASE
|
||||
{ uintptr_t(TIM2), 2 },
|
||||
#endif
|
||||
#ifdef TIM20_BASE
|
||||
{ uintptr_t(TIM20), 20 },
|
||||
#endif
|
||||
#ifdef TIM8_BASE
|
||||
{ uintptr_t(TIM8), 8 },
|
||||
#endif
|
||||
#ifdef TIM1_BASE
|
||||
{ uintptr_t(TIM1), 1 }
|
||||
#endif
|
||||
};
|
||||
|
||||
// Convert from a timer base address to its integer timer number.
|
||||
static constexpr int get_timer_num_from_base_address(uintptr_t base_address) {
|
||||
for (const auto &timer : stm32_timer_map)
|
||||
if (timer.base_address == base_address) return timer.timer_number;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The platform's SoftwareSerial.cpp will use the first timer from stm32_timer_map.
|
||||
#if HAS_TMC_SW_SERIAL && !defined(TIMER_SERIAL)
|
||||
#define TIMER_SERIAL (stm32_timer_map[0].base_address)
|
||||
#endif
|
||||
|
||||
// Place all timers used into an array, then recursively check for duplicates during compilation.
|
||||
// This does not currently account for timers used for PWM, such as for fans.
|
||||
// Timers are actually pointers. Convert to integers to simplify constexpr logic.
|
||||
static constexpr uintptr_t timers_in_use[] = {
|
||||
uintptr_t(TEMP_TIMER_DEV), // Override in pins file
|
||||
uintptr_t(STEP_TIMER_DEV), // Override in pins file
|
||||
// constexpr doesn't like using the base address pointers that timers evaluate to.
|
||||
// We can get away with casting them to uintptr_t, if we do so inside an array.
|
||||
// GCC will not currently do it directly to a uintptr_t.
|
||||
IF_ENABLED(HAS_TMC_SW_SERIAL, static constexpr uintptr_t timer_serial[] = {uintptr_t(TIMER_SERIAL)});
|
||||
IF_ENABLED(SPEAKER, static constexpr uintptr_t timer_tone[] = {uintptr_t(TIMER_TONE)});
|
||||
IF_ENABLED(HAS_SERVOS, static constexpr uintptr_t timer_servo[] = {uintptr_t(TIMER_SERVO)});
|
||||
|
||||
enum TimerPurpose { TP_SERIAL, TP_TONE, TP_SERVO, TP_STEP, TP_TEMP };
|
||||
|
||||
// List of timers, to enable checking for conflicts.
|
||||
// Includes the purpose of each timer to ease debugging when evaluating at build-time.
|
||||
// This cannot yet account for timers used for PWM output, such as for fans.
|
||||
static constexpr struct { TimerPurpose p; int t; } timers_in_use[] = {
|
||||
#if HAS_TMC_SW_SERIAL
|
||||
uintptr_t(TIMER_SERIAL), // Set in variant.h, or as a define in platformio.h if not present in variant.h
|
||||
{TP_SERIAL, get_timer_num_from_base_address(timer_serial[0])}, // Set in variant.h, or as a define in platformio.h if not present in variant.h
|
||||
#endif
|
||||
#if ENABLED(SPEAKER)
|
||||
uintptr_t(TIMER_TONE), // Set in variant.h, or as a define in platformio.h if not present in variant.h
|
||||
{TP_TONE, get_timer_num_from_base_address(timer_tone[0])}, // Set in variant.h, or as a define in platformio.h if not present in variant.h
|
||||
#endif
|
||||
#if HAS_SERVOS
|
||||
uintptr_t(TIMER_SERVO), // Set in variant.h, or as a define in platformio.h if not present in variant.h
|
||||
{TP_SERVO, get_timer_num_from_base_address(timer_servo[0])}, // Set in variant.h, or as a define in platformio.h if not present in variant.h
|
||||
#endif
|
||||
};
|
||||
{TP_STEP, STEP_TIMER},
|
||||
{TP_TEMP, TEMP_TIMER},
|
||||
};
|
||||
|
||||
static constexpr bool verify_no_duplicate_timers() {
|
||||
static constexpr bool verify_no_timer_conflicts() {
|
||||
LOOP_L_N(i, COUNT(timers_in_use))
|
||||
LOOP_S_L_N(j, i + 1, COUNT(timers_in_use))
|
||||
if (timers_in_use[i] == timers_in_use[j]) return false;
|
||||
if (timers_in_use[i].t == timers_in_use[j].t) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this assertion fails at compile time, review the timers_in_use array. If default_envs is
|
||||
// defined properly in platformio.ini, VS Code can evaluate the array when hovering over it,
|
||||
// making it easy to identify the conflicting timers.
|
||||
static_assert(verify_no_duplicate_timers(), "One or more timer conflict detected");
|
||||
// If this assertion fails at compile time, review the timers_in_use array.
|
||||
// If default_envs is defined properly in platformio.ini, VS Code can evaluate the array
|
||||
// when hovering over it, making it easy to identify the conflicting timers.
|
||||
static_assert(verify_no_timer_conflicts(), "One or more timer conflict detected. Examine \"timers_in_use\" to help identify conflict.");
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if BOTH(USE_OTG_USB_HOST, USBHOST)
|
||||
|
||||
#include "usb_host.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "usbh_core.h"
|
||||
#include "usbh_msc.h"
|
||||
|
||||
USBH_HandleTypeDef hUsbHost;
|
||||
USBHost usb;
|
||||
BulkStorage bulk(&usb);
|
||||
|
||||
static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id) {
|
||||
switch(id) {
|
||||
case HOST_USER_SELECT_CONFIGURATION:
|
||||
//SERIAL_ECHOLNPGM("APPLICATION_SELECT_CONFIGURATION");
|
||||
break;
|
||||
case HOST_USER_DISCONNECTION:
|
||||
//SERIAL_ECHOLNPGM("APPLICATION_DISCONNECT");
|
||||
//usb.setUsbTaskState(USB_STATE_RUNNING);
|
||||
break;
|
||||
case HOST_USER_CLASS_ACTIVE:
|
||||
//SERIAL_ECHOLNPGM("APPLICATION_READY");
|
||||
usb.setUsbTaskState(USB_STATE_RUNNING);
|
||||
break;
|
||||
case HOST_USER_CONNECTION:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool USBHost::start() {
|
||||
if (USBH_Init(&hUsbHost, USBH_UserProcess, TERN(USE_USB_HS_IN_FS, HOST_HS, HOST_FS)) != USBH_OK) {
|
||||
SERIAL_ECHOLNPGM("Error: USBH_Init");
|
||||
return false;
|
||||
}
|
||||
if (USBH_RegisterClass(&hUsbHost, USBH_MSC_CLASS) != USBH_OK) {
|
||||
SERIAL_ECHOLNPGM("Error: USBH_RegisterClass");
|
||||
return false;
|
||||
}
|
||||
if (USBH_Start(&hUsbHost) != USBH_OK) {
|
||||
SERIAL_ECHOLNPGM("Error: USBH_Start");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void USBHost::Task() {
|
||||
USBH_Process(&hUsbHost);
|
||||
}
|
||||
|
||||
uint8_t USBHost::getUsbTaskState() {
|
||||
return usb_task_state;
|
||||
}
|
||||
|
||||
void USBHost::setUsbTaskState(uint8_t state) {
|
||||
usb_task_state = state;
|
||||
if (usb_task_state == USB_STATE_RUNNING) {
|
||||
MSC_LUNTypeDef info;
|
||||
USBH_MSC_GetLUNInfo(&hUsbHost, usb.lun, &info);
|
||||
capacity = info.capacity.block_nbr / 2000;
|
||||
block_size = info.capacity.block_size;
|
||||
block_count = info.capacity.block_nbr;
|
||||
// SERIAL_ECHOLNPAIR("info.capacity.block_nbr : %ld\n", info.capacity.block_nbr);
|
||||
// SERIAL_ECHOLNPAIR("info.capacity.block_size: %d\n", info.capacity.block_size);
|
||||
// SERIAL_ECHOLNPAIR("capacity : %d MB\n", capacity);
|
||||
}
|
||||
};
|
||||
|
||||
bool BulkStorage::LUNIsGood(uint8_t t) {
|
||||
return USBH_MSC_IsReady(&hUsbHost) && USBH_MSC_UnitIsReady(&hUsbHost, t);
|
||||
}
|
||||
|
||||
uint32_t BulkStorage::GetCapacity(uint8_t lun) {
|
||||
return usb->block_count;
|
||||
}
|
||||
|
||||
uint16_t BulkStorage::GetSectorSize(uint8_t lun) {
|
||||
return usb->block_size;
|
||||
}
|
||||
|
||||
uint8_t BulkStorage::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf) {
|
||||
return USBH_MSC_Read(&hUsbHost, lun, addr, buf, blocks) != USBH_OK;
|
||||
}
|
||||
|
||||
uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) {
|
||||
return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast <uint8_t*>(buf), blocks) != USBH_OK;
|
||||
}
|
||||
|
||||
#endif // USE_OTG_USB_HOST && USBHOST
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum {
|
||||
USB_STATE_INIT,
|
||||
USB_STATE_ERROR,
|
||||
USB_STATE_RUNNING,
|
||||
} usb_state_t;
|
||||
|
||||
class USBHost {
|
||||
public:
|
||||
bool start();
|
||||
void Task();
|
||||
uint8_t getUsbTaskState();
|
||||
void setUsbTaskState(uint8_t state);
|
||||
uint8_t regRd(uint8_t reg) { return 0x0; };
|
||||
uint8_t usb_task_state = USB_STATE_INIT;
|
||||
uint8_t lun = 0;
|
||||
uint32_t capacity = 0;
|
||||
uint16_t block_size = 0;
|
||||
uint32_t block_count = 0;
|
||||
};
|
||||
|
||||
class BulkStorage {
|
||||
public:
|
||||
BulkStorage(USBHost *usb) : usb(usb) {};
|
||||
|
||||
bool LUNIsGood(uint8_t t);
|
||||
uint32_t GetCapacity(uint8_t lun);
|
||||
uint16_t GetSectorSize(uint8_t lun);
|
||||
uint8_t Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf);
|
||||
uint8_t Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf);
|
||||
|
||||
USBHost *usb;
|
||||
};
|
||||
|
||||
extern USBHost usb;
|
||||
extern BulkStorage bulk;
|
||||
@@ -191,10 +191,8 @@ inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
/*
|
||||
extern "C" {
|
||||
@@ -209,9 +207,7 @@ static inline int freeMemory() {
|
||||
return &top - _sbrk(0);
|
||||
}
|
||||
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//
|
||||
// ADC
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
* @details Only configures SS pin since libmaple creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if PIN_EXISTS(SS)
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,14 @@
|
||||
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||
|
||||
#include <U8glib.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 0 // Fastest
|
||||
//#define SPI_SPEED 2 // Slower
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SPI_FULL_SPEED // Fastest
|
||||
//#define LCD_SPI_SPEED SPI_QUARTER_SPEED // Slower
|
||||
#endif
|
||||
|
||||
static uint8_t SPI_speed = SPI_SPEED;
|
||||
static uint8_t SPI_speed = LCD_SPI_SPEED;
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) {
|
||||
LOOP_L_N(i, 8) {
|
||||
@@ -104,7 +106,7 @@ static uint8_t swSpiInit(const uint8_t spi_speed) {
|
||||
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_INIT:
|
||||
SPI_speed = swSpiInit(SPI_SPEED);
|
||||
SPI_speed = swSpiInit(LCD_SPI_SPEED);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
|
||||
@@ -48,6 +48,7 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||
bool PersistentStore::access_finish() { return true; }
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
size_t written = 0;
|
||||
while (size--) {
|
||||
uint8_t v = *value;
|
||||
uint8_t * const p = (uint8_t * const)pos;
|
||||
@@ -55,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
// so only write bytes that have changed!
|
||||
if (v != eeprom_read_byte(p)) {
|
||||
eeprom_write_byte(p, v);
|
||||
if (size & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||
if (eeprom_read_byte(p) != v) {
|
||||
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
|
||||
return true;
|
||||
|
||||
@@ -31,23 +31,23 @@
|
||||
* SPI2 | PB12 PB13 PB14 PB15 |
|
||||
* SPI3 | PA15 PB3 PB4 PB5 |
|
||||
* +-----------------------------+
|
||||
* Any pin can be used for Chip Select (SS_PIN)
|
||||
* Any pin can be used for Chip Select (SD_SS_PIN)
|
||||
* SPI1 is enabled by default
|
||||
*/
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN PA5
|
||||
#ifndef SD_SCK_PIN
|
||||
#define SD_SCK_PIN PA5
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN PA6
|
||||
#ifndef SD_MISO_PIN
|
||||
#define SD_MISO_PIN PA6
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN PA7
|
||||
#ifndef SD_MOSI_PIN
|
||||
#define SD_MOSI_PIN PA7
|
||||
#endif
|
||||
#ifndef SS_PIN
|
||||
#define SS_PIN PA4
|
||||
#ifndef SD_SS_PIN
|
||||
#define SD_SS_PIN PA4
|
||||
#endif
|
||||
#undef SDSS
|
||||
#define SDSS SS_PIN
|
||||
#define SDSS SD_SS_PIN
|
||||
|
||||
#ifndef SPI_DEVICE
|
||||
#define SPI_DEVICE 1
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
#endif
|
||||
|
||||
#ifndef TOUCH_MISO_PIN
|
||||
#define TOUCH_MISO_PIN MISO_PIN
|
||||
#define TOUCH_MISO_PIN SD_MISO_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_MOSI_PIN
|
||||
#define TOUCH_MOSI_PIN MOSI_PIN
|
||||
#define TOUCH_MOSI_PIN SD_MOSI_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_SCK_PIN
|
||||
#define TOUCH_SCK_PIN SCK_PIN
|
||||
#define TOUCH_SCK_PIN SD_SCK_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_CS_PIN
|
||||
#define TOUCH_CS_PIN CS_PIN
|
||||
#define TOUCH_CS_PIN SD_SS_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_INT_PIN
|
||||
#define TOUCH_INT_PIN -1
|
||||
|
||||
@@ -35,18 +35,18 @@ static SPISettings spiConfig;
|
||||
|
||||
// Initialize SPI bus
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#if !PIN_EXISTS(SD_SS)
|
||||
#error "SD_SS_PIN not defined!"
|
||||
#endif
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
#if 0 && DISABLED(SOFTWARE_SPI)
|
||||
// set SS high - may be chip select for another SPI device
|
||||
#if SET_SPI_SS_HIGH
|
||||
WRITE(SS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
// set a default rate
|
||||
spiInit(SPI_HALF_SPEED); // 1
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define SCK_PIN 13
|
||||
#define MISO_PIN 12
|
||||
#define MOSI_PIN 11
|
||||
#define SS_PIN 20 //SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
#define SD_SCK_PIN 13
|
||||
#define SD_MISO_PIN 12
|
||||
#define SD_MOSI_PIN 11
|
||||
#define SD_SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
|
||||
@@ -35,18 +35,18 @@
|
||||
static SPISettings spiConfig;
|
||||
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#if !PIN_EXISTS(SD_SS)
|
||||
#error "SD_SS_PIN not defined!"
|
||||
#endif
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
#if 0 && DISABLED(SOFTWARE_SPI)
|
||||
// set SS high - may be chip select for another SPI device
|
||||
#if SET_SPI_SS_HIGH
|
||||
WRITE(SS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
// set a default rate
|
||||
spiInit(SPI_HALF_SPEED); // 1
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* HAL SPI Pins for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||
*/
|
||||
|
||||
#define SCK_PIN 13
|
||||
#define MISO_PIN 12
|
||||
#define MOSI_PIN 11
|
||||
#define SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
#define SD_SCK_PIN 13
|
||||
#define SD_MISO_PIN 12
|
||||
#define SD_MOSI_PIN 11
|
||||
#define SD_SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
|
||||
@@ -50,20 +50,20 @@ static SPISettings spiConfig;
|
||||
// ------------------------
|
||||
|
||||
void spiBegin() {
|
||||
#ifndef SS_PIN
|
||||
#error "SS_PIN is not defined!"
|
||||
#ifndef SD_SS_PIN
|
||||
#error "SD_SS_PIN is not defined!"
|
||||
#endif
|
||||
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
|
||||
//SET_OUTPUT(SCK_PIN);
|
||||
//SET_INPUT(MISO_PIN);
|
||||
//SET_OUTPUT(MOSI_PIN);
|
||||
//SET_OUTPUT(SD_SCK_PIN);
|
||||
//SET_INPUT(SD_MISO_PIN);
|
||||
//SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
#if 0 && DISABLED(SOFTWARE_SPI)
|
||||
// set SS high - may be chip select for another SPI device
|
||||
#if SET_SPI_SS_HIGH
|
||||
WRITE(SS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
// set a default rate
|
||||
spiInit(SPI_HALF_SPEED); // 1
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* HAL SPI Pins for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
|
||||
*/
|
||||
|
||||
#define SCK_PIN 13
|
||||
#define MISO_PIN 12
|
||||
#define MOSI_PIN 11
|
||||
#define SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
#define SD_SCK_PIN 13
|
||||
#define SD_MISO_PIN 12
|
||||
#define SD_MOSI_PIN 11
|
||||
#define SD_SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
#include "feature/runout.h"
|
||||
#endif
|
||||
|
||||
#if HAS_Z_SERVO_PROBE
|
||||
#if EITHER(PROBE_TARE, HAS_Z_SERVO_PROBE)
|
||||
#include "module/probe.h"
|
||||
#endif
|
||||
|
||||
@@ -460,6 +460,7 @@ void startOrResumeJob() {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
inline void abortSDPrinting() {
|
||||
IF_DISABLED(NO_SD_AUTOSTART, card.autofile_cancel());
|
||||
card.endFilePrint(TERN_(SD_RESORT, true));
|
||||
queue.clear();
|
||||
quickstop_stepper();
|
||||
@@ -585,7 +586,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
||||
if (ELAPSED(ms, next_home_key_ms)) {
|
||||
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
|
||||
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
||||
queue.enqueue_now_P(G28_STR);
|
||||
queue.inject_P(G28_STR);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -709,6 +710,10 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
||||
* - Handle Joystick jogging
|
||||
*/
|
||||
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
static uint8_t idle_depth = 0;
|
||||
if (++idle_depth > 5) SERIAL_ECHOLNPAIR("idle() call depth: ", int(idle_depth));
|
||||
#endif
|
||||
|
||||
// Core Marlin activities
|
||||
manage_inactivity(TERN_(ADVANCED_PAUSE_FEATURE, no_stepper_sleep));
|
||||
@@ -720,7 +725,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
TERN_(MAX7219_DEBUG, max7219.idle_tasks());
|
||||
|
||||
// Return if setup() isn't completed
|
||||
if (marlin_state == MF_INITIALIZING) return;
|
||||
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;
|
||||
|
||||
// Handle filament runout sensors
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.run());
|
||||
@@ -764,6 +769,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
|
||||
// Run i2c Position Encoders
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
{
|
||||
static millis_t i2cpem_next_update_ms;
|
||||
if (planner.has_blocks_queued()) {
|
||||
const millis_t ms = millis();
|
||||
@@ -772,6 +778,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
i2cpem_next_update_ms = ms + I2CPE_MIN_UPD_TIME_MS;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Auto-report Temperatures / SD Status
|
||||
@@ -793,6 +800,10 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
|
||||
// Update the LVGL interface
|
||||
TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());
|
||||
|
||||
IDLE_DONE:
|
||||
TERN_(MARLIN_DEV_MODE, idle_depth--);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1108,6 +1119,10 @@ void setup() {
|
||||
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TARE)
|
||||
SETUP_RUN(probe.tare_init());
|
||||
#endif
|
||||
|
||||
#if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
|
||||
SETUP_RUN(card.mount()); // Mount media with settings before first_load
|
||||
#endif
|
||||
@@ -1344,7 +1359,6 @@ void loop() {
|
||||
idle();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
card.checkautostart();
|
||||
if (card.flag.abort_sd_printing) abortSDPrinting();
|
||||
if (marlin_state == MF_SD_COMPLETE) finishSDPrinting();
|
||||
#endif
|
||||
|
||||
+24
-16
@@ -189,7 +189,7 @@
|
||||
#define BOARD_GEN3_PLUS 1601 // Gen3+
|
||||
#define BOARD_GEN6 1602 // Gen6
|
||||
#define BOARD_GEN6_DELUXE 1603 // Gen6 deluxe
|
||||
#define BOARD_GEN7_CUSTOM 1604 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
|
||||
#define BOARD_GEN7_CUSTOM 1604 // Gen7 custom (Alfons3 Version) https://github.com/Alfons3/Generation_7_Electronics
|
||||
#define BOARD_GEN7_12 1605 // Gen7 v1.1, v1.2
|
||||
#define BOARD_GEN7_13 1606 // Gen7 v1.3
|
||||
#define BOARD_GEN7_14 1607 // Gen7 v1.4
|
||||
@@ -319,21 +319,25 @@
|
||||
#define BOARD_BTT_SKR_MINI_E3_V2_0 4026 // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_MZ_V1_0 4027 // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_E3_DIP 4028 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
|
||||
#define BOARD_JGAURORA_A5S_A1 4029 // JGAurora A5S A1 (STM32F103ZET6)
|
||||
#define BOARD_FYSETC_AIO_II 4030 // FYSETC AIO_II
|
||||
#define BOARD_FYSETC_CHEETAH 4031 // FYSETC Cheetah
|
||||
#define BOARD_FYSETC_CHEETAH_V12 4032 // FYSETC Cheetah V1.2
|
||||
#define BOARD_LONGER3D_LK 4033 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
|
||||
#define BOARD_CCROBOT_MEEB_3DP 4034 // ccrobot-online.com MEEB_3DP (STM32F103RC)
|
||||
#define BOARD_CHITU3D_V5 4035 // Chitu3D TronXY X5SA V5 Board
|
||||
#define BOARD_CHITU3D_V6 4036 // Chitu3D TronXY X5SA V5 Board
|
||||
#define BOARD_CREALITY_V4 4037 // Creality v4.x (STM32F103RE)
|
||||
#define BOARD_CREALITY_V427 4038 // Creality v4.2.7 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V452 4039 // Creality v4.5.2 (STM32F103RE)
|
||||
#define BOARD_TRIGORILLA_PRO 4040 // Trigorilla Pro (STM32F103ZET6)
|
||||
#define BOARD_FLY_MINI 4041 // FLY MINI (STM32F103RCT6)
|
||||
#define BOARD_FLSUN_HISPEED 4042 // FLSUN HiSpeedV1 (STM32F103VET6)
|
||||
#define BOARD_BEAST 4043 // STM32F103RET6 Libmaple-based controller
|
||||
#define BOARD_BTT_SKR_CR6 4029 // BigTreeTech SKR CR6 v1.0 (STM32F103RE)
|
||||
#define BOARD_JGAURORA_A5S_A1 4030 // JGAurora A5S A1 (STM32F103ZET6)
|
||||
#define BOARD_FYSETC_AIO_II 4031 // FYSETC AIO_II
|
||||
#define BOARD_FYSETC_CHEETAH 4032 // FYSETC Cheetah
|
||||
#define BOARD_FYSETC_CHEETAH_V12 4033 // FYSETC Cheetah V1.2
|
||||
#define BOARD_LONGER3D_LK 4034 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
|
||||
#define BOARD_CCROBOT_MEEB_3DP 4035 // ccrobot-online.com MEEB_3DP (STM32F103RC)
|
||||
#define BOARD_CHITU3D_V5 4036 // Chitu3D TronXY X5SA V5 Board
|
||||
#define BOARD_CHITU3D_V6 4037 // Chitu3D TronXY X5SA V5 Board
|
||||
#define BOARD_CREALITY_V4 4038 // Creality v4.x (STM32F103RE)
|
||||
#define BOARD_CREALITY_V427 4039 // Creality v4.2.7 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V4210 4040 // Creality v4.2.10 (STM32F103RE) as found in the CR-30
|
||||
#define BOARD_CREALITY_V431 4041 // Creality v4.3.1 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V452 4042 // Creality v4.5.2 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V453 4043 // Creality v4.5.3 (STM32F103RE)
|
||||
#define BOARD_TRIGORILLA_PRO 4044 // Trigorilla Pro (STM32F103ZET6)
|
||||
#define BOARD_FLY_MINI 4045 // FLY MINI (STM32F103RCT6)
|
||||
#define BOARD_FLSUN_HISPEED 4046 // FLSUN HiSpeedV1 (STM32F103VET6)
|
||||
#define BOARD_BEAST 4047 // STM32F103RET6 Libmaple-based controller
|
||||
|
||||
//
|
||||
// ARM Cortex-M4F
|
||||
@@ -365,6 +369,10 @@
|
||||
#define BOARD_FYSETC_S6_V2_0 4216 // FYSETC S6 v2.0 board
|
||||
#define BOARD_FLYF407ZG 4217 // FLYF407ZG board (STM32F407ZG)
|
||||
#define BOARD_MKS_ROBIN2 4218 // MKS_ROBIN2 (STM32F407ZE)
|
||||
#define BOARD_MKS_ROBIN_PRO_V2 4219 // MKS Robin Pro V2 (STM32F407VE)
|
||||
#define BOARD_MKS_ROBIN_NANO_V3 4220 // MKS Robin Nano V3 (STM32F407VG)
|
||||
#define BOARD_ANET_ET4 4221 // ANET ET4 V1.x (STM32F407VGT6)
|
||||
#define BOARD_ANET_ET4P 4222 // ANET ET4P V1.x (STM32F407VGT6)
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
#define MACHINE_UUID DEFAULT_MACHINE_UUID
|
||||
#endif
|
||||
|
||||
#define MARLIN_WEBSITE_URL "https://marlinfw.org"
|
||||
#define MARLIN_WEBSITE_URL "marlinfw.org"
|
||||
|
||||
//#if !defined(STRING_SPLASH_LINE3) && defined(WEBSITE_URL)
|
||||
// #define STRING_SPLASH_LINE3 WEBSITE_URL
|
||||
@@ -154,6 +154,7 @@
|
||||
#define STR_Z4_MIN "z4_min"
|
||||
#define STR_Z4_MAX "z4_max"
|
||||
#define STR_Z_PROBE "z_probe"
|
||||
#define STR_PROBE_EN "probe_en"
|
||||
#define STR_FILAMENT_RUNOUT_SENSOR "filament"
|
||||
#define STR_PROBE_OFFSET "Probe Offset"
|
||||
#define STR_SKEW_MIN "min_skew_factor: "
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
// Macros to chain up to 12 conditions
|
||||
// Macros to chain up to 14 conditions
|
||||
#define _DO_1(W,C,A) (_##W##_1(A))
|
||||
#define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B))
|
||||
#define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V))
|
||||
@@ -164,6 +164,8 @@
|
||||
#define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V))
|
||||
#define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V))
|
||||
#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V))
|
||||
#define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V))
|
||||
#define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V))
|
||||
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
|
||||
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V)
|
||||
#define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V))
|
||||
@@ -214,6 +216,7 @@
|
||||
#define ANY_BUTTON(V...) DO(BTNEX,||,V)
|
||||
|
||||
#define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H))
|
||||
#define ISEOL(C) ((C) == '\n' || (C) == '\r')
|
||||
#define NUMERIC(a) WITHIN(a, '0', '9')
|
||||
#define DECIMAL(a) (NUMERIC(a) || a == '.')
|
||||
#define HEXCHR(a) (NUMERIC(a) ? (a) - '0' : WITHIN(a, 'a', 'f') ? ((a) - 'a' + 10) : WITHIN(a, 'A', 'F') ? ((a) - 'A' + 10) : -1)
|
||||
@@ -284,6 +287,7 @@
|
||||
#define RSQRT(x) (1.0f / sqrtf(x))
|
||||
#define CEIL(x) ceilf(x)
|
||||
#define FLOOR(x) floorf(x)
|
||||
#define TRUNC(x) truncf(x)
|
||||
#define LROUND(x) lroundf(x)
|
||||
#define FMOD(x, y) fmodf(x, y)
|
||||
#define HYPOT(x,y) SQRT(HYPOT2(x,y))
|
||||
|
||||
@@ -75,7 +75,6 @@ typedef float feedRate_t;
|
||||
// Conversion macros
|
||||
#define MMM_TO_MMS(MM_M) feedRate_t(float(MM_M) / 60.0f)
|
||||
#define MMS_TO_MMM(MM_S) (float(MM_S) * 60.0f)
|
||||
#define MMS_SCALED(V) ((V) * 0.01f * feedrate_percentage)
|
||||
|
||||
//
|
||||
// Coordinates structures for XY, XYZ, XYZE...
|
||||
|
||||
@@ -42,9 +42,7 @@
|
||||
|
||||
#include "math.h"
|
||||
|
||||
void unified_bed_leveling::echo_name() {
|
||||
SERIAL_ECHOPGM("Unified Bed Leveling");
|
||||
}
|
||||
void unified_bed_leveling::echo_name() { SERIAL_ECHOPGM("Unified Bed Leveling"); }
|
||||
|
||||
void unified_bed_leveling::report_current_mesh() {
|
||||
if (!leveling_is_valid()) return;
|
||||
@@ -86,9 +84,7 @@
|
||||
|
||||
volatile int16_t unified_bed_leveling::encoder_diff;
|
||||
|
||||
unified_bed_leveling::unified_bed_leveling() {
|
||||
reset();
|
||||
}
|
||||
unified_bed_leveling::unified_bed_leveling() { reset(); }
|
||||
|
||||
void unified_bed_leveling::reset() {
|
||||
const bool was_enabled = planner.leveling_active;
|
||||
@@ -113,6 +109,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(OPTIMIZED_MESH_STORAGE)
|
||||
|
||||
constexpr float mesh_store_scaling = 1000;
|
||||
constexpr int16_t Z_STEPS_NAN = INT16_MAX;
|
||||
|
||||
void unified_bed_leveling::set_store_from_mesh(const bed_mesh_t &in_values, mesh_store_t &stored_values) {
|
||||
auto z_to_store = [](const float &z) {
|
||||
if (isnan(z)) return Z_STEPS_NAN;
|
||||
const int32_t z_scaled = TRUNC(z * mesh_store_scaling);
|
||||
if (z_scaled == Z_STEPS_NAN || !WITHIN(z_scaled, INT16_MIN, INT16_MAX))
|
||||
return Z_STEPS_NAN; // If Z is out of range, return our custom 'NaN'
|
||||
return int16_t(z_scaled);
|
||||
};
|
||||
GRID_LOOP(x, y) stored_values[x][y] = z_to_store(in_values[x][y]);
|
||||
}
|
||||
|
||||
void unified_bed_leveling::set_mesh_from_store(const mesh_store_t &stored_values, bed_mesh_t &out_values) {
|
||||
auto store_to_z = [](const int16_t z_scaled) {
|
||||
return z_scaled == Z_STEPS_NAN ? NAN : z_scaled / mesh_store_scaling;
|
||||
};
|
||||
GRID_LOOP(x, y) out_values[x][y] = store_to_z(stored_values[x][y]);
|
||||
}
|
||||
|
||||
#endif // OPTIMIZED_MESH_STORAGE
|
||||
|
||||
static void serial_echo_xy(const uint8_t sp, const int16_t x, const int16_t y) {
|
||||
SERIAL_ECHO_SP(sp);
|
||||
SERIAL_CHAR('(');
|
||||
@@ -127,7 +148,7 @@
|
||||
|
||||
static void serial_echo_column_labels(const uint8_t sp) {
|
||||
SERIAL_ECHO_SP(7);
|
||||
for (int8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
|
||||
LOOP_L_N(i, GRID_MAX_POINTS_X) {
|
||||
if (i < 10) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHO(i);
|
||||
SERIAL_ECHO_SP(sp);
|
||||
|
||||
@@ -41,6 +41,10 @@ struct mesh_index_pair;
|
||||
#define MESH_X_DIST (float(MESH_MAX_X - (MESH_MIN_X)) / float(GRID_MAX_POINTS_X - 1))
|
||||
#define MESH_Y_DIST (float(MESH_MAX_Y - (MESH_MIN_Y)) / float(GRID_MAX_POINTS_Y - 1))
|
||||
|
||||
#if ENABLED(OPTIMIZED_MESH_STORAGE)
|
||||
typedef int16_t mesh_store_t[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
|
||||
#endif
|
||||
|
||||
class unified_bed_leveling {
|
||||
private:
|
||||
|
||||
@@ -106,6 +110,10 @@ class unified_bed_leveling {
|
||||
static int8_t storage_slot;
|
||||
|
||||
static bed_mesh_t z_values;
|
||||
#if ENABLED(OPTIMIZED_MESH_STORAGE)
|
||||
static void set_store_from_mesh(const bed_mesh_t &in_values, mesh_store_t &stored_values);
|
||||
static void set_mesh_from_store(const mesh_store_t &stored_values, bed_mesh_t &out_values);
|
||||
#endif
|
||||
static const float _mesh_index_to_xpos[GRID_MAX_POINTS_X],
|
||||
_mesh_index_to_ypos[GRID_MAX_POINTS_Y];
|
||||
|
||||
@@ -122,20 +130,29 @@ class unified_bed_leveling {
|
||||
|
||||
FORCE_INLINE static void set_z(const int8_t px, const int8_t py, const float &z) { z_values[px][py] = z; }
|
||||
|
||||
static int8_t cell_index_x_raw(const float &x) {
|
||||
return FLOOR((x - (MESH_MIN_X)) * RECIPROCAL(MESH_X_DIST));
|
||||
}
|
||||
|
||||
static int8_t cell_index_y_raw(const float &y) {
|
||||
return FLOOR((y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST));
|
||||
}
|
||||
|
||||
static int8_t cell_index_x_valid(const float &x) {
|
||||
return WITHIN(cell_index_x_raw(x), 0, (GRID_MAX_POINTS_X - 2));
|
||||
}
|
||||
|
||||
static int8_t cell_index_y_valid(const float &y) {
|
||||
return WITHIN(cell_index_y_raw(y), 0, (GRID_MAX_POINTS_Y - 2));
|
||||
}
|
||||
|
||||
static int8_t cell_index_x(const float &x) {
|
||||
const int8_t cx = (x - (MESH_MIN_X)) * RECIPROCAL(MESH_X_DIST);
|
||||
return constrain(cx, 0, (GRID_MAX_POINTS_X) - 1); // -1 is appropriate if we want all movement to the X_MAX
|
||||
} // position. But with this defined this way, it is possible
|
||||
// to extrapolate off of this point even further out. Probably
|
||||
// that is OK because something else should be keeping that from
|
||||
// happening and should not be worried about at this level.
|
||||
return constrain(cell_index_x_raw(x), 0, (GRID_MAX_POINTS_X) - 2);
|
||||
}
|
||||
|
||||
static int8_t cell_index_y(const float &y) {
|
||||
const int8_t cy = (y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST);
|
||||
return constrain(cy, 0, (GRID_MAX_POINTS_Y) - 1); // -1 is appropriate if we want all movement to the Y_MAX
|
||||
} // position. But with this defined this way, it is possible
|
||||
// to extrapolate off of this point even further out. Probably
|
||||
// that is OK because something else should be keeping that from
|
||||
// happening and should not be worried about at this level.
|
||||
return constrain(cell_index_y_raw(y), 0, (GRID_MAX_POINTS_Y) - 2);
|
||||
}
|
||||
|
||||
static inline xy_int8_t cell_indexes(const float &x, const float &y) {
|
||||
return { cell_index_x(x), cell_index_y(y) };
|
||||
@@ -173,6 +190,12 @@ class unified_bed_leveling {
|
||||
return z1 + (z2 - z1) * (a0 - a1) / (a2 - a1);
|
||||
}
|
||||
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#define _UBL_OUTER_Z_RAISE UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#else
|
||||
#define _UBL_OUTER_Z_RAISE NAN
|
||||
#endif
|
||||
|
||||
/**
|
||||
* z_correction_for_x_on_horizontal_mesh_line is an optimization for
|
||||
* the case where the printer is making a vertical line that only crosses horizontal mesh lines.
|
||||
@@ -186,13 +209,7 @@ class unified_bed_leveling {
|
||||
}
|
||||
|
||||
// The requested location is off the mesh. Return UBL_Z_RAISE_WHEN_OFF_MESH or NAN.
|
||||
return (
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#else
|
||||
NAN
|
||||
#endif
|
||||
);
|
||||
return _UBL_OUTER_Z_RAISE;
|
||||
}
|
||||
|
||||
const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * RECIPROCAL(MESH_X_DIST),
|
||||
@@ -215,13 +232,7 @@ class unified_bed_leveling {
|
||||
}
|
||||
|
||||
// The requested location is off the mesh. Return UBL_Z_RAISE_WHEN_OFF_MESH or NAN.
|
||||
return (
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#else
|
||||
NAN
|
||||
#endif
|
||||
);
|
||||
return _UBL_OUTER_Z_RAISE;
|
||||
}
|
||||
|
||||
const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * RECIPROCAL(MESH_Y_DIST),
|
||||
|
||||
@@ -543,7 +543,7 @@
|
||||
}
|
||||
else {
|
||||
const float cvf = parser.value_float();
|
||||
switch ((int)truncf(cvf * 10.0f) - 30) { // 3.1 -> 1
|
||||
switch ((int)TRUNC(cvf * 10.0f) - 30) { // 3.1 -> 1
|
||||
#if ENABLED(UBL_G29_P31)
|
||||
case 1: {
|
||||
|
||||
@@ -972,6 +972,12 @@
|
||||
|
||||
MeshFlags done_flags{0};
|
||||
const xy_int8_t &lpos = location.pos;
|
||||
|
||||
#if IS_TFTGLCD_PANEL
|
||||
lcd_mesh_edit_setup(0); // Change current screen before calling ui.ubl_plot
|
||||
safe_delay(50);
|
||||
#endif
|
||||
|
||||
do {
|
||||
location = find_closest_mesh_point_of_type(SET_IN_BITMAP, pos, false, &done_flags);
|
||||
|
||||
|
||||
@@ -56,39 +56,32 @@
|
||||
// A move within the same cell needs no splitting
|
||||
if (istart == iend) {
|
||||
|
||||
// For a move off the bed, use a constant Z raise
|
||||
if (!WITHIN(iend.x, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iend.y, 0, GRID_MAX_POINTS_Y - 1)) {
|
||||
|
||||
// Note: There is no Z Correction in this case. We are off the grid and don't know what
|
||||
// a reasonable correction would be. If the user has specified a UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
// value, that will be used instead of a calculated (Bi-Linear interpolation) correction.
|
||||
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
end.z += UBL_Z_RAISE_WHEN_OFF_MESH;
|
||||
#endif
|
||||
planner.buffer_segment(end, scaled_fr_mm_s, extruder);
|
||||
current_position = destination;
|
||||
return;
|
||||
}
|
||||
|
||||
FINAL_MOVE:
|
||||
|
||||
// The distance is always MESH_X_DIST so multiply by the constant reciprocal.
|
||||
const float xratio = (end.x - mesh_index_to_xpos(iend.x)) * RECIPROCAL(MESH_X_DIST);
|
||||
// When UBL_Z_RAISE_WHEN_OFF_MESH is disabled Z correction is extrapolated from the edge of the mesh
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
// For a move off the UBL mesh, use a constant Z raise
|
||||
if (!cell_index_x_valid(end.x) || !cell_index_y_valid(end.y)) {
|
||||
|
||||
float z1, z2;
|
||||
if (iend.x >= GRID_MAX_POINTS_X - 1)
|
||||
z1 = z2 = 0.0;
|
||||
else {
|
||||
z1 = z_values[iend.x ][iend.y ] + xratio *
|
||||
(z_values[iend.x + 1][iend.y ] - z_values[iend.x][iend.y ]),
|
||||
z2 = z_values[iend.x ][iend.y + 1] + xratio *
|
||||
(z_values[iend.x + 1][iend.y + 1] - z_values[iend.x][iend.y + 1]);
|
||||
}
|
||||
// Note: There is no Z Correction in this case. We are off the mesh and don't know what
|
||||
// a reasonable correction would be, UBL_Z_RAISE_WHEN_OFF_MESH will be used instead of
|
||||
// a calculated (Bi-Linear interpolation) correction.
|
||||
|
||||
end.z += UBL_Z_RAISE_WHEN_OFF_MESH;
|
||||
planner.buffer_segment(end, scaled_fr_mm_s, extruder);
|
||||
current_position = destination;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// The distance is always MESH_X_DIST so multiply by the constant reciprocal.
|
||||
const float xratio = (end.x - mesh_index_to_xpos(iend.x)) * RECIPROCAL(MESH_X_DIST),
|
||||
yratio = (end.y - mesh_index_to_ypos(iend.y)) * RECIPROCAL(MESH_Y_DIST),
|
||||
z1 = z_values[iend.x][iend.y ] + xratio * (z_values[iend.x + 1][iend.y ] - z_values[iend.x][iend.y ]),
|
||||
z2 = z_values[iend.x][iend.y + 1] + xratio * (z_values[iend.x + 1][iend.y + 1] - z_values[iend.x][iend.y + 1]);
|
||||
|
||||
// X cell-fraction done. Interpolate the two Z offsets with the Y fraction for the final Z offset.
|
||||
const float yratio = (end.y - mesh_index_to_ypos(iend.y)) * RECIPROCAL(MESH_Y_DIST),
|
||||
z0 = iend.y < GRID_MAX_POINTS_Y - 1 ? (z1 + (z2 - z1) * yratio) * planner.fade_scaling_factor_for_z(end.z) : 0.0;
|
||||
const float z0 = (z1 + (z2 - z1) * yratio) * planner.fade_scaling_factor_for_z(end.z);
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
|
||||
@@ -23,19 +23,16 @@
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if DISABLED(BLTOUCH_HS_MODE)
|
||||
#define BLTOUCH_SLOW_MODE 1
|
||||
#endif
|
||||
|
||||
// BLTouch commands are sent as servo angles
|
||||
typedef unsigned char BLTCommand;
|
||||
|
||||
#if ENABLED(CREALITY_TOUCH)
|
||||
#define STOW_ALARM false
|
||||
#define BLTOUCH_DEPLOY 170
|
||||
#define BLTOUCH_STOW 20
|
||||
#else
|
||||
#define STOW_ALARM true
|
||||
#define BLTOUCH_DEPLOY 10
|
||||
#define BLTOUCH_STOW 90
|
||||
#endif
|
||||
|
||||
#define STOW_ALARM true
|
||||
#define BLTOUCH_DEPLOY 10
|
||||
#define BLTOUCH_STOW 90
|
||||
#define BLTOUCH_SW_MODE 60
|
||||
#define BLTOUCH_SELFTEST 120
|
||||
#define BLTOUCH_MODE_STORE 130
|
||||
|
||||
@@ -92,7 +92,7 @@ void dac084s085::cshigh() {
|
||||
WRITE(SPI_EEPROM1_CS, HIGH);
|
||||
WRITE(SPI_EEPROM2_CS, HIGH);
|
||||
WRITE(SPI_FLASH_CS, HIGH);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
#endif // MB(ALLIGATOR)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "digipot.h"
|
||||
|
||||
#include <Stream.h>
|
||||
#include <SlowSoftI2CMaster.h> // https://github.com/stawel/SlowSoftI2CMaster
|
||||
#include <SlowSoftI2CMaster.h> // https://github.com/felias-fogg/SlowSoftI2CMaster
|
||||
|
||||
// Settings for the I2C based DIGIPOT (MCP4018) based on WT150
|
||||
|
||||
@@ -46,21 +46,21 @@ static byte current_to_wiper(const float current) {
|
||||
}
|
||||
|
||||
static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
|
||||
SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_X, DIGIPOTS_I2C_SCL)
|
||||
SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_X, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 1
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Y, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Y, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 2
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Z, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Z, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 3
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E0, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E0, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 4
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E1, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E1, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 5
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E2, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E2, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 6
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E3, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E3, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#if DIGIPOT_I2C_NUM_CHANNELS > 7
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E4, DIGIPOTS_I2C_SCL)
|
||||
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E4, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -76,7 +76,6 @@ public:
|
||||
FORCE_INLINE static void disable() { enabled = false; }
|
||||
|
||||
FORCE_INLINE static void update(State &state, const uint8_t c) {
|
||||
#define ISEOL(C) ((C) == '\n' || (C) == '\r')
|
||||
switch (state) {
|
||||
case EP_RESET:
|
||||
switch (c) {
|
||||
|
||||
@@ -332,7 +332,7 @@ bool I2CPositionEncoder::test_axis() {
|
||||
|
||||
const float startPosition = soft_endstop.min[encoderAxis] + 10,
|
||||
endPosition = soft_endstop.max[encoderAxis] - 10;
|
||||
const feedRate_t fr_mm_s = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY));
|
||||
const feedRate_t fr_mm_s = FLOOR(homing_feedrate(encoderAxis));
|
||||
|
||||
ec = false;
|
||||
|
||||
@@ -382,7 +382,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
|
||||
|
||||
int32_t startCount, stopCount;
|
||||
|
||||
const feedRate_t fr_mm_s = MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY);
|
||||
const feedRate_t fr_mm_s = homing_feedrate(encoderAxis);
|
||||
|
||||
bool oldec = ec;
|
||||
ec = false;
|
||||
|
||||
@@ -139,7 +139,7 @@ void FWRetract::retract(const bool retracting
|
||||
if (retracting) {
|
||||
// Retract by moving from a faux E position back to the current E position
|
||||
current_retract[active_extruder] = base_retract;
|
||||
prepare_internal_move_to_destination( // set current to destination
|
||||
prepare_internal_move_to_destination( // set current from destination
|
||||
settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
|
||||
);
|
||||
|
||||
|
||||
@@ -127,6 +127,11 @@ Joystick joystick;
|
||||
static bool injecting_now; // = false;
|
||||
if (injecting_now) return;
|
||||
|
||||
#if ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||
if (TERN0(HAS_JOY_ADC_X, axis_should_home(X_AXIS)) || TERN0(HAS_JOY_ADC_Y, axis_should_home(Y_AXIS)) || TERN0(HAS_JOY_ADC_Z, axis_should_home(Z_AXIS)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
static constexpr int QUEUE_DEPTH = 5; // Insert up to this many movements
|
||||
static constexpr float target_lag = 0.25f, // Aim for 1/4 second lag
|
||||
seg_time = target_lag / QUEUE_DEPTH; // 0.05 seconds, short segments inserted every 1/20th of a second
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#endif
|
||||
|
||||
// A white component can be passed
|
||||
#if EITHER(RGBW_LED, NEOPIXEL_LED)
|
||||
#if ANY(RGBW_LED, NEOPIXEL_LED, PCA9632_RGBW)
|
||||
#define HAS_WHITE_LED 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#define PCA9632_AUTOGLO 0xC0
|
||||
#define PCA9632_AUTOGI 0xE0
|
||||
|
||||
// Red=LED0 Green=LED1 Blue=LED2
|
||||
// Red=LED0 Green=LED1 Blue=LED2 White=LED3
|
||||
#ifndef PCA9632_RED
|
||||
#define PCA9632_RED 0x00
|
||||
#endif
|
||||
@@ -68,9 +68,12 @@
|
||||
#ifndef PCA9632_BLU
|
||||
#define PCA9632_BLU 0x04
|
||||
#endif
|
||||
#if HAS_WHITE_LED && !defined(PCA9632_WHT)
|
||||
#define PCA9632_WHT 0x06
|
||||
#endif
|
||||
|
||||
// If any of the color indexes are greater than 0x04 they can't use auto increment
|
||||
#if !defined(PCA9632_NO_AUTO_INC) && (PCA9632_RED > 0x04 || PCA9632_GRN > 0x04 || PCA9632_BLU > 0x04)
|
||||
#if !defined(PCA9632_NO_AUTO_INC) && (PCA9632_RED > 0x04 || PCA9632_GRN > 0x04 || PCA9632_BLU > 0x04 || PCA9632_WHT > 0x04)
|
||||
#define PCA9632_NO_AUTO_INC
|
||||
#endif
|
||||
|
||||
@@ -89,25 +92,28 @@ static void PCA9632_WriteRegister(const byte addr, const byte regadd, const byte
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte vr, const byte vg, const byte vb) {
|
||||
static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte vr, const byte vg, const byte vb
|
||||
#if ENABLED(PCA9632_RGBW)
|
||||
, const byte vw
|
||||
#endif
|
||||
) {
|
||||
#if DISABLED(PCA9632_NO_AUTO_INC)
|
||||
uint8_t data[4], len = 4;
|
||||
uint8_t data[4];
|
||||
data[0] = PCA9632_AUTO_IND | regadd;
|
||||
data[1 + (PCA9632_RED >> 1)] = vr;
|
||||
data[1 + (PCA9632_GRN >> 1)] = vg;
|
||||
data[1 + (PCA9632_BLU >> 1)] = vb;
|
||||
Wire.beginTransmission(I2C_ADDRESS(addr));
|
||||
Wire.write(data, sizeof(data));
|
||||
Wire.endTransmission();
|
||||
#else
|
||||
uint8_t data[6], len = 6;
|
||||
data[0] = regadd + (PCA9632_RED >> 1);
|
||||
data[1] = vr;
|
||||
data[2] = regadd + (PCA9632_GRN >> 1);
|
||||
data[3] = vg;
|
||||
data[4] = regadd + (PCA9632_BLU >> 1);
|
||||
data[5] = vb;
|
||||
PCA9632_WriteRegister(addr, regadd + (PCA9632_RED >> 1), vr);
|
||||
PCA9632_WriteRegister(addr, regadd + (PCA9632_GRN >> 1), vg);
|
||||
PCA9632_WriteRegister(addr, regadd + (PCA9632_BLU >> 1), vb);
|
||||
#if ENABLED(PCA9632_RGBW)
|
||||
PCA9632_WriteRegister(addr, regadd + (PCA9632_WHT >> 1), vw);
|
||||
#endif
|
||||
#endif
|
||||
Wire.beginTransmission(I2C_ADDRESS(addr));
|
||||
Wire.write(data, len);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -130,9 +136,17 @@ void PCA9632_set_led_color(const LEDColor &color) {
|
||||
|
||||
const byte LEDOUT = (color.r ? LED_PWM << PCA9632_RED : 0)
|
||||
| (color.g ? LED_PWM << PCA9632_GRN : 0)
|
||||
| (color.b ? LED_PWM << PCA9632_BLU : 0);
|
||||
| (color.b ? LED_PWM << PCA9632_BLU : 0)
|
||||
#if ENABLED(PCA9632_RGBW)
|
||||
| (color.w ? LED_PWM << PCA9632_WHT : 0)
|
||||
#endif
|
||||
;
|
||||
|
||||
PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.r, color.g, color.b);
|
||||
PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.r, color.g, color.b
|
||||
#if ENABLED(PCA9632_RGBW)
|
||||
, color.w
|
||||
#endif
|
||||
);
|
||||
PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
|
||||
|
||||
// Machine state
|
||||
info.current_position = current_position;
|
||||
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
|
||||
info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
|
||||
info.zraise = zraise;
|
||||
|
||||
TERN_(GCODE_REPEAT_MARKERS, info.stored_repeat = repeat);
|
||||
|
||||
@@ -152,7 +152,7 @@ class PrintJobRecovery {
|
||||
static void resume();
|
||||
static void purge();
|
||||
|
||||
static inline void cancel() { purge(); card.autostart_index = 0; }
|
||||
static inline void cancel() { purge(); IF_DISABLED(NO_SD_AUTOSTART, card.autofile_begin()); }
|
||||
|
||||
static void load();
|
||||
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE), const float zraise=0);
|
||||
|
||||
@@ -39,6 +39,10 @@ private:
|
||||
static uint8_t index;
|
||||
public:
|
||||
static inline void reset() { index = 0; }
|
||||
static inline bool is_active() {
|
||||
LOOP_L_N(i, index) if (marker[i].counter) return true;
|
||||
return false;
|
||||
}
|
||||
static bool is_command_M808(char * const cmd) { return cmd[0] == 'M' && cmd[1] == '8' && cmd[2] == '0' && cmd[3] == '8' && !NUMERIC(cmd[4]); }
|
||||
static void early_parse_M808(char * const cmd);
|
||||
static void add_marker(const uint32_t sdpos, const uint16_t count);
|
||||
|
||||
@@ -28,22 +28,29 @@
|
||||
|
||||
#include "../module/motion.h" // for active_extruder
|
||||
|
||||
#if ENABLED(MANUAL_SOLENOID_CONTROL)
|
||||
#define HAS_SOLENOID(N) HAS_SOLENOID_##N
|
||||
// PARKING_EXTRUDER options alter the default behavior of solenoids, this ensures compliance of M380-381
|
||||
|
||||
#if ENABLED(PARKING_EXTRUDER)
|
||||
#include "../module/tool_change.h"
|
||||
#define SOLENOID_MAGNETIZED_STATE (TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT,!)PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE)
|
||||
#else
|
||||
#define HAS_SOLENOID(N) (HAS_SOLENOID_##N && EXTRUDERS > N)
|
||||
#define SOLENOID_MAGNETIZED_STATE HIGH
|
||||
#endif
|
||||
|
||||
#define HAS_SOLENOID(N) (HAS_SOLENOID_##N && TERN(MANUAL_SOLENOID_CONTROL, true, EXTRUDERS > N))
|
||||
|
||||
// Used primarily with MANUAL_SOLENOID_CONTROL
|
||||
static void set_solenoid(const uint8_t num, const bool active) {
|
||||
const uint8_t value = active ? HIGH : LOW;
|
||||
const uint8_t value = active ? SOLENOID_MAGNETIZED_STATE : !SOLENOID_MAGNETIZED_STATE;
|
||||
switch (num) {
|
||||
case 0:
|
||||
OUT_WRITE(SOL0_PIN, value);
|
||||
TERN_(PARKING_EXTRUDER, if (!active && active_extruder == 0) parking_extruder_set_parked()); // If active extruder's solenoid is disabled, carriage is considered parked
|
||||
break;
|
||||
#if HAS_SOLENOID(1)
|
||||
case 1:
|
||||
OUT_WRITE(SOL1_PIN, value);
|
||||
TERN_(PARKING_EXTRUDER, if (!active && active_extruder == 1) parking_extruder_set_parked()); // If active extruder's solenoid is disabled, carriage is considered parked
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOLENOID(2)
|
||||
|
||||
@@ -43,7 +43,7 @@ cutter_power_t SpindleLaser::menuPower, // Power s
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K
|
||||
#endif
|
||||
#define SPINDLE_LASER_PWM_OFF ((SPINDLE_LASER_PWM_INVERT) ? 255 : 0)
|
||||
#define SPINDLE_LASER_PWM_OFF TERN(SPINDLE_LASER_PWM_INVERT, 255, 0)
|
||||
|
||||
//
|
||||
// Init the cutter to a safe OFF state
|
||||
@@ -71,16 +71,23 @@ void SpindleLaser::init() {
|
||||
/**
|
||||
* Set the cutter PWM directly to the given ocr value
|
||||
*/
|
||||
void SpindleLaser::set_ocr(const uint8_t ocr) {
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Turn spindle on
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
||||
void SpindleLaser::_set_ocr(const uint8_t ocr) {
|
||||
#if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY
|
||||
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), TERN(MARLIN_DEV_MODE, frequency, SPINDLE_LASER_FREQUENCY));
|
||||
set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
||||
#else
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpindleLaser::set_ocr(const uint8_t ocr) {
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Cutter ON
|
||||
_set_ocr(ocr);
|
||||
}
|
||||
|
||||
void SpindleLaser::ocr_off() {
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Turn spindle off
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Only write low byte
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF
|
||||
_set_ocr(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -97,7 +104,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
|
||||
ocr_off();
|
||||
isReady = false;
|
||||
}
|
||||
else if (enabled() || ENABLED(CUTTER_POWER_RELATIVE)) {
|
||||
else if (ENABLED(CUTTER_POWER_RELATIVE) || enabled()) {
|
||||
set_ocr(power);
|
||||
isReady = true;
|
||||
}
|
||||
@@ -118,7 +125,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
|
||||
// Set the spindle direction and apply immediately
|
||||
// Stop on direction change if SPINDLE_STOP_ON_DIR_CHANGE is enabled
|
||||
//
|
||||
void SpindleLaser::set_direction(const bool reverse) {
|
||||
void SpindleLaser::set_reverse(const bool reverse) {
|
||||
const bool dir_state = (reverse == SPINDLE_INVERT_DIR); // Forward (M3) HIGH when not inverted
|
||||
if (TERN0(SPINDLE_STOP_ON_DIR_CHANGE, enabled()) && READ(SPINDLE_DIR_PIN) != dir_state) disable();
|
||||
WRITE(SPINDLE_DIR_PIN, dir_state);
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
static const inline uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) {
|
||||
constexpr cutter_cpower_t power_floor = TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0),
|
||||
power_range = SPEED_POWER_MAX - power_floor;
|
||||
return unitPower ? round(100.0f * (cpwr - power_floor) / power_range) : 0;
|
||||
return cpwr ? round(100.0f * (cpwr - power_floor) / power_range) : 0;
|
||||
}
|
||||
|
||||
// Convert a cpower (e.g., SPEED_POWER_STARTUP) to unit power (upwr, upower),
|
||||
@@ -117,6 +117,12 @@ public:
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
|
||||
private:
|
||||
|
||||
static void _set_ocr(const uint8_t ocr);
|
||||
|
||||
public:
|
||||
|
||||
static void set_ocr(const uint8_t ocr);
|
||||
static inline void set_ocr_power(const uint8_t ocr) { power = ocr; set_ocr(ocr); }
|
||||
static void ocr_off();
|
||||
@@ -143,7 +149,7 @@ public:
|
||||
#elif CUTTER_UNIT_IS(RPM)
|
||||
2
|
||||
#else
|
||||
#error "???"
|
||||
#error "CUTTER_UNIT_IS(???)"
|
||||
#endif
|
||||
));
|
||||
}
|
||||
@@ -191,9 +197,11 @@ public:
|
||||
}
|
||||
|
||||
#if ENABLED(SPINDLE_CHANGE_DIR)
|
||||
static void set_direction(const bool reverse);
|
||||
static void set_reverse(const bool reverse);
|
||||
static bool is_reverse() { return READ(SPINDLE_DIR_PIN) == SPINDLE_INVERT_DIR; }
|
||||
#else
|
||||
static inline void set_direction(const bool) {}
|
||||
static inline void set_reverse(const bool) {}
|
||||
static bool is_reverse() { return false; }
|
||||
#endif
|
||||
|
||||
static inline void disable() { isReady = false; set_enabled(false); }
|
||||
@@ -208,11 +216,12 @@ public:
|
||||
else
|
||||
menuPower = cpwr_to_upwr(SPEED_POWER_STARTUP);
|
||||
unitPower = menuPower;
|
||||
set_direction(reverse);
|
||||
set_reverse(reverse);
|
||||
set_enabled(true);
|
||||
}
|
||||
FORCE_INLINE static void enable_forward() { enable_with_dir(false); }
|
||||
FORCE_INLINE static void enable_reverse() { enable_with_dir(true); }
|
||||
FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); }
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
static inline void update_from_mpower() {
|
||||
|
||||
@@ -39,12 +39,17 @@ typedef IF<(SPEED_POWER_MAX > 255), uint16_t, uint8_t>::type cutter_cpower_t;
|
||||
|
||||
#if CUTTER_UNIT_IS(RPM) && SPEED_POWER_MAX > 255
|
||||
typedef uint16_t cutter_power_t;
|
||||
#define CUTTER_MENU_POWER_TYPE uint16_5
|
||||
#define cutter_power2str ui16tostr5rj
|
||||
#define CUTTER_MENU_POWER_TYPE uint16_5
|
||||
#define cutter_power2str ui16tostr5rj
|
||||
#else
|
||||
typedef uint8_t cutter_power_t;
|
||||
#define CUTTER_MENU_POWER_TYPE uint8
|
||||
#define cutter_power2str ui8tostr3rj
|
||||
#if CUTTER_UNIT_IS(PERCENT)
|
||||
#define CUTTER_MENU_POWER_TYPE percent_3
|
||||
#define cutter_power2str pcttostrpctrj
|
||||
#else
|
||||
#define CUTTER_MENU_POWER_TYPE uint8
|
||||
#define cutter_power2str ui8tostr3rj
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(ASSISTED_TRAMMING)
|
||||
|
||||
#include "tramming.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../core/debug_out.h"
|
||||
|
||||
PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
|
||||
PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
|
||||
PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
|
||||
#ifdef TRAMMING_POINT_NAME_4
|
||||
PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
|
||||
#ifdef TRAMMING_POINT_NAME_5
|
||||
PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PGM_P const tramming_point_name[] PROGMEM = {
|
||||
point_name_1, point_name_2, point_name_3
|
||||
#ifdef TRAMMING_POINT_NAME_4
|
||||
, point_name_4
|
||||
#ifdef TRAMMING_POINT_NAME_5
|
||||
, point_name_5
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef ASSISTED_TRAMMING_WAIT_POSITION
|
||||
|
||||
// Move to the defined wait position
|
||||
void move_to_tramming_wait_pos() {
|
||||
constexpr xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
|
||||
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ASSISTED_TRAMMING
|
||||
@@ -19,8 +19,10 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
#include "../module/probe.h"
|
||||
|
||||
#if !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1
|
||||
#error "TRAMMING_SCREW_THREAD must be equal to 30, 31, 40, 41, 50, or 51."
|
||||
@@ -31,6 +33,10 @@ constexpr xy_pos_t screws_tilt_adjust_pos[] = TRAMMING_POINT_XY;
|
||||
#define G35_PROBE_COUNT COUNT(screws_tilt_adjust_pos)
|
||||
static_assert(G35_PROBE_COUNT >= 3, "TRAMMING_POINT_XY requires at least 3 XY positions.");
|
||||
|
||||
#define VALIDATE_TRAMMING_POINT(N) static_assert(N >= G35_PROBE_COUNT || Probe::build_time::can_reach(screws_tilt_adjust_pos[N]), \
|
||||
"TRAMMING_POINT_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
||||
VALIDATE_TRAMMING_POINT(0); VALIDATE_TRAMMING_POINT(1); VALIDATE_TRAMMING_POINT(2); VALIDATE_TRAMMING_POINT(3); VALIDATE_TRAMMING_POINT(4);
|
||||
|
||||
extern const char point_name_1[], point_name_2[], point_name_3[]
|
||||
#ifdef TRAMMING_POINT_NAME_4
|
||||
, point_name_4[]
|
||||
@@ -57,3 +63,9 @@ static_assert(_NR_TRAM_NAMES >= G35_PROBE_COUNT, "Define enough TRAMMING_POINT_N
|
||||
#undef _NR_TRAM_NAMES
|
||||
|
||||
extern PGM_P const tramming_point_name[];
|
||||
|
||||
#ifdef ASSISTED_TRAMMING_WAIT_POSITION
|
||||
void move_to_tramming_wait_pos();
|
||||
#else
|
||||
inline void move_to_tramming_wait_pos() {}
|
||||
#endif
|
||||
|
||||
@@ -54,27 +54,11 @@ void ZStepperAlign::reset_to_default() {
|
||||
#endif
|
||||
);
|
||||
|
||||
constexpr xyz_pos_t dpo = NOZZLE_TO_PROBE_OFFSET;
|
||||
#define VALIDATE_ALIGN_POINT(N) static_assert(N >= NUM_Z_STEPPER_DRIVERS || Probe::build_time::can_reach(xy_init[N]), \
|
||||
"Z_STEPPER_ALIGN_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
||||
VALIDATE_ALIGN_POINT(0); VALIDATE_ALIGN_POINT(1); VALIDATE_ALIGN_POINT(2); VALIDATE_ALIGN_POINT(3);
|
||||
|
||||
#define LTEST(N) (xy_init[N].x >= _MAX(X_MIN_BED + PROBING_MARGIN_LEFT, X_MIN_POS + dpo.x) - 0.00001f)
|
||||
#define RTEST(N) (xy_init[N].x <= _MIN(X_MAX_BED - PROBING_MARGIN_RIGHT, X_MAX_POS + dpo.x) + 0.00001f)
|
||||
#define FTEST(N) (xy_init[N].y >= _MAX(Y_MIN_BED + PROBING_MARGIN_FRONT, Y_MIN_POS + dpo.y) - 0.00001f)
|
||||
#define BTEST(N) (xy_init[N].y <= _MIN(Y_MAX_BED - PROBING_MARGIN_BACK, Y_MAX_POS + dpo.y) + 0.00001f)
|
||||
|
||||
static_assert(LTEST(0) && RTEST(0), "The 1st Z_STEPPER_ALIGN_XY X is unreachable with the default probe X offset.");
|
||||
static_assert(FTEST(0) && BTEST(0), "The 1st Z_STEPPER_ALIGN_XY Y is unreachable with the default probe Y offset.");
|
||||
static_assert(LTEST(1) && RTEST(1), "The 2nd Z_STEPPER_ALIGN_XY X is unreachable with the default probe X offset.");
|
||||
static_assert(FTEST(1) && BTEST(1), "The 2nd Z_STEPPER_ALIGN_XY Y is unreachable with the default probe Y offset.");
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
static_assert(LTEST(2) && RTEST(2), "The 3rd Z_STEPPER_ALIGN_XY X is unreachable with the default probe X offset.");
|
||||
static_assert(FTEST(2) && BTEST(2), "The 3rd Z_STEPPER_ALIGN_XY Y is unreachable with the default probe Y offset.");
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
static_assert(LTEST(3) && RTEST(3), "The 4th Z_STEPPER_ALIGN_XY X is unreachable with the default probe X offset.");
|
||||
static_assert(FTEST(3) && BTEST(3), "The 4th Z_STEPPER_ALIGN_XY Y is unreachable with the default probe Y offset.");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else // !defined(Z_STEPPER_ALIGN_XY)
|
||||
#else // !Z_STEPPER_ALIGN_XY
|
||||
|
||||
const xy_pos_t xy_init[] = {
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3 // First probe point...
|
||||
@@ -115,7 +99,7 @@ void ZStepperAlign::reset_to_default() {
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // !defined(Z_STEPPER_ALIGN_XY)
|
||||
#endif // !Z_STEPPER_ALIGN_XY
|
||||
|
||||
COPY(xy, xy_init);
|
||||
|
||||
|
||||
@@ -40,27 +40,7 @@
|
||||
// Define tramming point names.
|
||||
//
|
||||
|
||||
#include "../../feature/tramming.h" // Validate
|
||||
|
||||
PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
|
||||
PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
|
||||
PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
|
||||
#ifdef TRAMMING_POINT_NAME_4
|
||||
PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
|
||||
#ifdef TRAMMING_POINT_NAME_5
|
||||
PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PGM_P const tramming_point_name[] PROGMEM = {
|
||||
point_name_1, point_name_2, point_name_3
|
||||
#ifdef TRAMMING_POINT_NAME_4
|
||||
, point_name_4
|
||||
#ifdef TRAMMING_POINT_NAME_5
|
||||
, point_name_5
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#include "../../feature/tramming.h"
|
||||
|
||||
/**
|
||||
* G35: Read bed corners to help adjust bed screws
|
||||
@@ -178,11 +158,10 @@ void GcodeSuite::G35() {
|
||||
// the probe deployed if it was successful.
|
||||
probe.stow();
|
||||
|
||||
move_to_tramming_wait_pos();
|
||||
|
||||
// After this operation the Z position needs correction
|
||||
set_axis_never_homed(Z_AXIS);
|
||||
|
||||
// Home Z after the alignment procedure
|
||||
process_subcommands_now_P(PSTR("G28Z"));
|
||||
}
|
||||
|
||||
#endif // ASSISTED_TRAMMING
|
||||
|
||||
@@ -177,8 +177,6 @@ G29_TYPE GcodeSuite::G29() {
|
||||
if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
|
||||
#endif
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
|
||||
|
||||
const bool seenA = TERN0(PROBE_MANUALLY, parser.seen('A')),
|
||||
no_action = seenA || seenQ,
|
||||
faux = ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) ? parser.boolval('C') : no_action;
|
||||
@@ -399,7 +397,17 @@ G29_TYPE GcodeSuite::G29() {
|
||||
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
|
||||
#endif
|
||||
|
||||
if (!faux) remember_feedrate_scaling_off();
|
||||
#if BOTH(AUTO_BED_LEVELING_BILINEAR, EXTENSIBLE_UI)
|
||||
ExtUI::onMeshLevelingStart();
|
||||
#endif
|
||||
|
||||
if (!faux) {
|
||||
remember_feedrate_scaling_off();
|
||||
|
||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||
if (!dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, LEVELING_BED_TEMP);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Disable auto bed leveling during G29.
|
||||
// Be formal so G29 can be done successively without G28.
|
||||
|
||||
@@ -227,7 +227,7 @@ void GcodeSuite::G28() {
|
||||
#endif
|
||||
|
||||
// Home (O)nly if position is unknown
|
||||
if (!homing_needed() && parser.boolval('O')) {
|
||||
if (!axes_should_home() && parser.boolval('O')) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> homing not needed, skip");
|
||||
return;
|
||||
}
|
||||
@@ -241,11 +241,12 @@ void GcodeSuite::G28() {
|
||||
|
||||
// Disable the leveling matrix before homing
|
||||
#if HAS_LEVELING
|
||||
TERN_(RESTORE_LEVELING_AFTER_G28, const bool leveling_was_active = planner.leveling_active);
|
||||
TERN_(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session
|
||||
IF_ENABLED(RESTORE_LEVELING_AFTER_G28, const bool leveling_restore_state = planner.leveling_active);
|
||||
IF_ENABLED(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
// Reset to the XY plane
|
||||
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
|
||||
|
||||
// Count this command as movement / activity
|
||||
@@ -289,6 +290,10 @@ void GcodeSuite::G28() {
|
||||
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
#endif
|
||||
// PARKING_EXTRUDER homing requires different handling of movement / solenoid activation, depending on the side of homing
|
||||
#if ENABLED(PARKING_EXTRUDER)
|
||||
const bool pe_final_change_must_unpark = parking_extruder_unpark_after_homing(old_tool_index, X_HOME_DIR + 1 == old_tool_index * 2);
|
||||
#endif
|
||||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
@@ -435,13 +440,14 @@ void GcodeSuite::G28() {
|
||||
do_blocking_move_to_z(delta_clip_start_height);
|
||||
#endif
|
||||
|
||||
TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_was_active));
|
||||
IF_ENABLED(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_restore_state));
|
||||
IF_ENABLED(ENABLE_LEVELING_AFTER_G28, set_bed_leveling_enabled(true));
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
// Restore the active tool after homing
|
||||
#if HAS_MULTI_HOTEND && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
|
||||
tool_change(old_tool_index, NONE(PARKING_EXTRUDER, DUAL_X_CARRIAGE)); // Do move if one of these
|
||||
tool_change(old_tool_index, TERN(PARKING_EXTRUDER, !pe_final_change_must_unpark, DISABLED(DUAL_X_CARRIAGE))); // Do move if one of these
|
||||
#endif
|
||||
|
||||
#if HAS_HOMING_CURRENT
|
||||
|
||||
@@ -41,8 +41,9 @@ void GcodeSuite::G34() {
|
||||
// Home before the alignment procedure
|
||||
if (!all_axes_trusted()) home_all_axes();
|
||||
|
||||
TERN_(HAS_LEVELING, TEMPORARY_BED_LEVELING_STATE(false));
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
TEMPORARY_BED_LEVELING_STATE(false);
|
||||
TemporaryGlobalEndstopsState unlock_z(false);
|
||||
|
||||
#ifdef GANTRY_CALIBRATION_COMMANDS_PRE
|
||||
@@ -63,7 +64,7 @@ void GcodeSuite::G34() {
|
||||
|
||||
// Move Z to pounce position
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Setting Z Pounce");
|
||||
do_blocking_move_to_z(zpounce, MMM_TO_MMS(HOMING_FEEDRATE_Z));
|
||||
do_blocking_move_to_z(zpounce, homing_feedrate(Z_AXIS));
|
||||
|
||||
// Store current motor settings, then apply reduced value
|
||||
|
||||
|
||||
@@ -37,11 +37,9 @@
|
||||
*/
|
||||
void GcodeSuite::M220() {
|
||||
|
||||
#if HAS_PRUSA_MMU2
|
||||
static int16_t backup_feedrate_percentage = 100;
|
||||
if (parser.seen('B')) backup_feedrate_percentage = feedrate_percentage;
|
||||
if (parser.seen('R')) feedrate_percentage = backup_feedrate_percentage;
|
||||
#endif
|
||||
static int16_t backup_feedrate_percentage = 100;
|
||||
if (parser.seen('B')) backup_feedrate_percentage = feedrate_percentage;
|
||||
if (parser.seen('R')) feedrate_percentage = backup_feedrate_percentage;
|
||||
|
||||
if (parser.seenval('S')) feedrate_percentage = parser.value_int();
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
|
||||
#endif
|
||||
|
||||
planner.synchronize(); // Wait for previous movement commands (G0/G0/G2/G3) to complete before changing power
|
||||
cutter.set_direction(is_M4);
|
||||
cutter.set_reverse(is_M4);
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
if (parser.seenval('O')) {
|
||||
|
||||
@@ -61,16 +61,10 @@ void GcodeSuite::T(const int8_t tool_index) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EXTRUDERS < 2
|
||||
|
||||
tool_change(tool_index);
|
||||
|
||||
#else
|
||||
|
||||
tool_change(
|
||||
tool_index,
|
||||
(tool_index == active_extruder) || parser.boolval('S')
|
||||
);
|
||||
|
||||
#endif
|
||||
tool_change(tool_index
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
, TERN(PARKING_EXTRUDER, false, tool_index == active_extruder) // For PARKING_EXTRUDER motion is decided in tool_change()
|
||||
|| parser.boolval('S')
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,10 +49,6 @@ void GcodeSuite::G61(void) {
|
||||
// No saved position? No axes being restored?
|
||||
if (!TEST(saved_slots[slot >> 3], slot & 0x07) || !parser.seen("XYZ")) return;
|
||||
|
||||
// Apply any given feedrate over 0.0
|
||||
const float fr = parser.linearval('F');
|
||||
if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);
|
||||
|
||||
SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
|
||||
LOOP_XYZ(i) {
|
||||
destination[i] = parser.seen(XYZ_CHAR(i))
|
||||
@@ -63,8 +59,15 @@ void GcodeSuite::G61(void) {
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
||||
// Apply any given feedrate over 0.0
|
||||
feedRate_t saved_feedrate = feedrate_mm_s;
|
||||
const float fr = parser.linearval('F');
|
||||
if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);
|
||||
|
||||
// Move to the saved position
|
||||
prepare_line_to_destination();
|
||||
|
||||
feedrate_mm_s = saved_feedrate;
|
||||
}
|
||||
|
||||
#endif // SAVED_POSITIONS
|
||||
|
||||
@@ -66,7 +66,7 @@ void GcodeSuite::M118() {
|
||||
#endif
|
||||
|
||||
if (hasE) SERIAL_ECHO_START();
|
||||
if (hasA) SERIAL_ECHOPGM("// ");
|
||||
if (hasA) SERIAL_ECHOPGM("//");
|
||||
SERIAL_ECHOLN(p);
|
||||
|
||||
TERN_(HAS_MULTI_SERIAL, serial_port_index = old_serial);
|
||||
|
||||
@@ -41,13 +41,12 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Plan an arc in 2 dimensions
|
||||
* Plan an arc in 2 dimensions, with optional linear motion in a 3rd dimension
|
||||
*
|
||||
* The arc is approximated by generating many small linear segments.
|
||||
* The length of each segment is configured in MM_PER_ARC_SEGMENT (Default 1mm)
|
||||
* Arcs should only be made relatively large (over 5mm), as larger arcs with
|
||||
* larger segments will tend to be more efficient. Your slicer should have
|
||||
* options for G2/G3 arc generation. In future these options may be GCode tunable.
|
||||
* The arc is traced by generating many small linear segments, as configured by
|
||||
* MM_PER_ARC_SEGMENT (Default 1mm). In the future we hope more slicers will include
|
||||
* an option to generate G2/G3 arcs for curved surfaces, as this will allow faster
|
||||
* boards to produce much smoother curved surfaces.
|
||||
*/
|
||||
void plan_arc(
|
||||
const xyze_pos_t &cart, // Destination position
|
||||
@@ -77,26 +76,33 @@ void plan_arc(
|
||||
rt_Y = cart[q_axis] - center_Q,
|
||||
start_L = current_position[l_axis];
|
||||
|
||||
// Angle of rotation between position and target from the circle center.
|
||||
float angular_travel = ATAN2(rvec.a * rt_Y - rvec.b * rt_X, rvec.a * rt_X + rvec.b * rt_Y);
|
||||
|
||||
#ifdef MIN_ARC_SEGMENTS
|
||||
uint16_t min_segments = MIN_ARC_SEGMENTS;
|
||||
#else
|
||||
constexpr uint16_t min_segments = 1;
|
||||
#endif
|
||||
|
||||
// Do a full circle if angular rotation is near 0 and the target is current position
|
||||
if (!angular_travel || (NEAR_ZERO(angular_travel) && NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis]))) {
|
||||
// Angle of rotation between position and target from the circle center.
|
||||
float angular_travel;
|
||||
|
||||
// Do a full circle if starting and ending positions are "identical"
|
||||
if (NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis])) {
|
||||
// Preserve direction for circles
|
||||
angular_travel = clockwise ? -RADIANS(360) : RADIANS(360);
|
||||
}
|
||||
else {
|
||||
// Calculate the angle
|
||||
angular_travel = ATAN2(rvec.a * rt_Y - rvec.b * rt_X, rvec.a * rt_X + rvec.b * rt_Y);
|
||||
|
||||
// Angular travel too small to detect? Just return.
|
||||
if (!angular_travel) return;
|
||||
|
||||
// Make sure angular travel over 180 degrees goes the other way around.
|
||||
switch (((angular_travel < 0) << 1) | clockwise) {
|
||||
case 1: angular_travel -= RADIANS(360); break; // Positive but CW? Reverse direction.
|
||||
case 2: angular_travel += RADIANS(360); break; // Negative but CCW? Reverse direction.
|
||||
}
|
||||
|
||||
#ifdef MIN_ARC_SEGMENTS
|
||||
min_segments = CEIL(min_segments * ABS(angular_travel) / RADIANS(360));
|
||||
NOLESS(min_segments, 1U);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
*/
|
||||
void GcodeSuite::M401() {
|
||||
probe.deploy();
|
||||
TERN_(PROBE_TARE, probe.tare());
|
||||
report_current_position();
|
||||
}
|
||||
|
||||
|
||||
@@ -158,8 +158,6 @@ bool GCodeQueue::_enqueue(const char* cmd, bool say_ok/*=false*/
|
||||
return true;
|
||||
}
|
||||
|
||||
#define ISEOL(C) ((C) == '\n' || (C) == '\r')
|
||||
|
||||
/**
|
||||
* Enqueue with Serial Echo
|
||||
* Return true if the command was consumed
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
#include "../gcode.h"
|
||||
#include "../../module/printcounter.h"
|
||||
|
||||
#if DISABLED(NO_SD_AUTOSTART)
|
||||
#include "../../sd/cardreader.h"
|
||||
#endif
|
||||
|
||||
#ifdef SD_FINISHED_RELEASECOMMAND
|
||||
#include "../queue.h"
|
||||
#endif
|
||||
@@ -60,6 +64,11 @@
|
||||
* M1001: Execute actions for SD print completion
|
||||
*/
|
||||
void GcodeSuite::M1001() {
|
||||
// If there's another auto#.g file to run...
|
||||
if (TERN(NO_SD_AUTOSTART, false, card.autofile_check())) return;
|
||||
|
||||
// Purge the recovery file...
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
|
||||
|
||||
// Report total print time
|
||||
const bool long_print = print_job_timer.duration() > 60;
|
||||
@@ -71,9 +80,6 @@ void GcodeSuite::M1001() {
|
||||
// Set the progress bar "done" state
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
|
||||
|
||||
// Purge the recovery file
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
|
||||
|
||||
// Announce SD file completion
|
||||
{
|
||||
PORT_REDIRECT(SERIAL_BOTH);
|
||||
@@ -93,7 +99,7 @@ void GcodeSuite::M1001() {
|
||||
|
||||
// Inject SD_FINISHED_RELEASECOMMAND, if any
|
||||
#ifdef SD_FINISHED_RELEASECOMMAND
|
||||
queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||
gcode.process_subcommands_now_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||
#endif
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
|
||||
|
||||
@@ -653,11 +653,6 @@
|
||||
#define SERIAL_CATCHALL 0
|
||||
#endif
|
||||
|
||||
// Pressure sensor with a BLTouch-like interface
|
||||
#if ENABLED(CREALITY_TOUCH)
|
||||
#define BLTOUCH
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The BLTouch Probe emulates a servo probe
|
||||
* and uses "special" angles for its state.
|
||||
@@ -819,9 +814,26 @@
|
||||
#define TOTAL_PROBING MULTIPLE_PROBING
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(PREHEAT_BEFORE_PROBING)
|
||||
#ifndef PROBING_NOZZLE_TEMP
|
||||
#define PROBING_NOZZLE_TEMP 0
|
||||
#endif
|
||||
#ifndef PROBING_BED_TEMP
|
||||
#define PROBING_BED_TEMP 0
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||
#ifndef LEVELING_NOZZLE_TEMP
|
||||
#define LEVELING_NOZZLE_TEMP 0
|
||||
#endif
|
||||
#ifndef LEVELING_BED_TEMP
|
||||
#define LEVELING_BED_TEMP 0
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
// Clear probe pin settings when no probe is selected
|
||||
#undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
|
||||
#undef USE_PROBE_FOR_Z_HOMING
|
||||
#endif
|
||||
|
||||
#if Z_HOME_DIR > 0
|
||||
@@ -870,6 +882,7 @@
|
||||
#if !HAS_LEVELING
|
||||
#undef PROBE_MANUALLY
|
||||
#undef RESTORE_LEVELING_AFTER_G28
|
||||
#undef ENABLE_LEVELING_AFTER_G28
|
||||
#endif
|
||||
|
||||
#ifdef GRID_MAX_POINTS_X
|
||||
@@ -1032,9 +1045,9 @@
|
||||
#define INVERT_E_DIR false
|
||||
#endif
|
||||
|
||||
// Fallback SPI Speed
|
||||
#ifndef SPI_SPEED
|
||||
#define SPI_SPEED SPI_FULL_SPEED
|
||||
// Fallback SPI Speed for SD
|
||||
#if ENABLED(SDSUPPORT) && !defined(SD_SPI_SPEED)
|
||||
#define SD_SPI_SPEED SPI_FULL_SPEED
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1057,28 +1070,23 @@
|
||||
* - TFT_COLOR
|
||||
* - GRAPHICAL_TFT_UPSCALE
|
||||
*/
|
||||
#if ENABLED(MKS_TS35_V2_0)
|
||||
// Most common: ST7796
|
||||
#if ENABLED(MKS_TS35_V2_0) // Most common: ST7796
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
|
||||
#define TFT_RES_480x320
|
||||
#define TFT_INTERFACE_SPI
|
||||
#elif ENABLED(MKS_ROBIN_TFT24)
|
||||
// Most common: ST7789
|
||||
#elif ENABLED(MKS_ROBIN_TFT24) // Most common: ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT28)
|
||||
// Most common: ST7789
|
||||
#elif ENABLED(MKS_ROBIN_TFT28) // Most common: ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT32)
|
||||
// Most common: ST7789
|
||||
#elif ENABLED(MKS_ROBIN_TFT32) // Most common: ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT35)
|
||||
// Most common: ILI9488
|
||||
#elif ENABLED(MKS_ROBIN_TFT35) // Most common: ILI9488
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_RES_480x320
|
||||
#define TFT_INTERFACE_FSMC
|
||||
@@ -1087,12 +1095,11 @@
|
||||
#define TFT_DRIVER SSD1963
|
||||
#define TFT_RES_480x272
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT_V1_1R)
|
||||
// ILI9328 or R61505
|
||||
#elif ENABLED(MKS_ROBIN_TFT_V1_1R) // ILI9328 or R61505
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35)
|
||||
#elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_DRIVER ILI9488
|
||||
#define TFT_RES_480x320
|
||||
@@ -1101,6 +1108,14 @@
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(ANET_ET4_TFT28) // ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(ANET_ET5_TFT35) // ST7796
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
|
||||
#define TFT_RES_480x320
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(TFT_GENERIC)
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
|
||||
@@ -1154,6 +1169,12 @@
|
||||
#elif ENABLED(TFT_INTERFACE_FSMC)
|
||||
#define TFT_480x320
|
||||
#endif
|
||||
#elif ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 272
|
||||
#if ENABLED(TFT_INTERFACE_SPI)
|
||||
#define TFT_480x272_SPI
|
||||
#elif ENABLED(TFT_INTERFACE_FSMC)
|
||||
#define TFT_480x272
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fewer lines with touch buttons on-screen
|
||||
@@ -1163,12 +1184,15 @@
|
||||
#elif EITHER(TFT_480x320, TFT_480x320_SPI)
|
||||
#define HAS_UI_480x320 1
|
||||
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
|
||||
#elif EITHER(TFT_480x272, TFT_480x272_SPI)
|
||||
#define HAS_UI_480x272 1
|
||||
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
|
||||
#endif
|
||||
|
||||
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
|
||||
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
||||
#undef TOUCH_SCREEN
|
||||
#if !HAS_TFT_LVGL_UI
|
||||
#if ENABLED(TFT_CLASSIC_UI)
|
||||
#define HAS_TOUCH_BUTTONS 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -1181,11 +1205,5 @@
|
||||
#define TOUCH_OFFSET_X XPT2046_X_OFFSET
|
||||
#define TOUCH_OFFSET_Y XPT2046_Y_OFFSET
|
||||
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
||||
#else
|
||||
#define TOUCH_CALIBRATION_X 0
|
||||
#define TOUCH_CALIBRATION_Y 0
|
||||
#define TOUCH_OFFSET_X 0
|
||||
#define TOUCH_OFFSET_Y 0
|
||||
#define TOUCH_ORIENTATION TOUCH_ORIENTATION_NONE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -142,6 +142,10 @@
|
||||
#undef SD_FINISHED_RELEASECOMMAND
|
||||
#endif
|
||||
|
||||
#if ENABLED(NO_SD_AUTOSTART)
|
||||
#undef MENU_ADDAUTOSTART
|
||||
#endif
|
||||
|
||||
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
||||
#define HAS_PRINT_PROGRESS 1
|
||||
#endif
|
||||
@@ -378,6 +382,14 @@
|
||||
#define POLL_JOG
|
||||
#endif
|
||||
|
||||
#ifndef HOMING_BUMP_MM
|
||||
#define HOMING_BUMP_MM { 0, 0, 0 }
|
||||
#endif
|
||||
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && NONE(USE_OTG_USB_HOST, USE_UHS3_USB)
|
||||
#define USE_UHS2_USB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Driver Timings (in nanoseconds)
|
||||
* NOTE: Driver timing order is longest-to-shortest duration.
|
||||
|
||||
@@ -1647,6 +1647,54 @@
|
||||
#ifndef E7_INTERPOLATE
|
||||
#define E7_INTERPOLATE INTERPOLATE
|
||||
#endif
|
||||
#ifndef X_SLAVE_ADDRESS
|
||||
#define X_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Y_SLAVE_ADDRESS
|
||||
#define Y_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Z_SLAVE_ADDRESS
|
||||
#define Z_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef X2_SLAVE_ADDRESS
|
||||
#define X2_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Y2_SLAVE_ADDRESS
|
||||
#define Y2_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Z2_SLAVE_ADDRESS
|
||||
#define Z2_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Z3_SLAVE_ADDRESS
|
||||
#define Z3_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Z4_SLAVE_ADDRESS
|
||||
#define Z4_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E0_SLAVE_ADDRESS
|
||||
#define E0_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E1_SLAVE_ADDRESS
|
||||
#define E1_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E2_SLAVE_ADDRESS
|
||||
#define E2_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E3_SLAVE_ADDRESS
|
||||
#define E3_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E4_SLAVE_ADDRESS
|
||||
#define E4_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E5_SLAVE_ADDRESS
|
||||
#define E5_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E6_SLAVE_ADDRESS
|
||||
#define E6_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef E7_SLAVE_ADDRESS
|
||||
#define E7_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (HAS_E_DRIVER(TMC2660) \
|
||||
@@ -2317,11 +2365,7 @@
|
||||
#define Z_PROBE_OFFSET_RANGE_MAX 20
|
||||
#endif
|
||||
#ifndef XY_PROBE_SPEED
|
||||
#ifdef HOMING_FEEDRATE_XY
|
||||
#define XY_PROBE_SPEED HOMING_FEEDRATE_XY
|
||||
#else
|
||||
#define XY_PROBE_SPEED 4000
|
||||
#endif
|
||||
#define XY_PROBE_SPEED ((homing_feedrate_mm_m.x + homing_feedrate_mm_m.y) / 2)
|
||||
#endif
|
||||
#ifndef NOZZLE_TO_PROBE_OFFSET
|
||||
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }
|
||||
@@ -2377,7 +2421,7 @@
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE && (EITHER(PROBING_HEATERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0)
|
||||
#define QUIET_PROBING 1
|
||||
#define HAS_QUIET_PROBING 1
|
||||
#endif
|
||||
#if EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF)
|
||||
#define HEATER_IDLE_HANDLER 1
|
||||
@@ -2546,10 +2590,10 @@
|
||||
*/
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
#ifndef DOGLCD_SCK
|
||||
#define DOGLCD_SCK SCK_PIN
|
||||
#define DOGLCD_SCK SD_SCK_PIN
|
||||
#endif
|
||||
#ifndef DOGLCD_MOSI
|
||||
#define DOGLCD_MOSI MOSI_PIN
|
||||
#define DOGLCD_MOSI SD_MOSI_PIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2639,7 +2683,7 @@
|
||||
// Force SDCARD_SORT_ALPHA to be enabled for Graphical LCD on LPC1768
|
||||
// on boards where SD card and LCD display share the same SPI bus
|
||||
// because of a bug in the shared SPI implementation. (See #8122)
|
||||
#if defined(TARGET_LPC1768) && IS_RRD_FG_SC && (SCK_PIN == LCD_PINS_D4)
|
||||
#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
|
||||
|
||||
@@ -105,9 +105,9 @@
|
||||
#elif defined(USE_AUTOMATIC_VERSIONING)
|
||||
#error "USE_AUTOMATIC_VERSIONING is now CUSTOM_VERSION_FILE."
|
||||
#elif defined(SDSLOW)
|
||||
#error "SDSLOW deprecated. Set SPI_SPEED to SPI_HALF_SPEED instead."
|
||||
#error "SDSLOW deprecated. Set SD_SPI_SPEED to SPI_HALF_SPEED instead."
|
||||
#elif defined(SDEXTRASLOW)
|
||||
#error "SDEXTRASLOW deprecated. Set SPI_SPEED to SPI_QUARTER_SPEED instead."
|
||||
#error "SDEXTRASLOW deprecated. Set SD_SPI_SPEED to SPI_QUARTER_SPEED instead."
|
||||
#elif defined(FILAMENT_SENSOR)
|
||||
#error "FILAMENT_SENSOR is now FILAMENT_WIDTH_SENSOR."
|
||||
#elif defined(ENDSTOPPULLUP_FIL_RUNOUT)
|
||||
@@ -189,7 +189,9 @@
|
||||
#elif defined(ENDSTOPS_ONLY_FOR_HOMING)
|
||||
#error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
|
||||
#elif defined(HOMING_FEEDRATE)
|
||||
#error "HOMING_FEEDRATE is deprecated. Set individual rates with HOMING_FEEDRATE_(XY|Z|E) instead."
|
||||
#error "HOMING_FEEDRATE is now set using the HOMING_FEEDRATE_MM_M array instead."
|
||||
#elif (defined(HOMING_FEEDRATE_XY) || defined(HOMING_FEEDRATE_Z)) && !defined(HOMING_FEEDRATE_MM_M)
|
||||
#error "HOMING_FEEDRATE_XY and HOMING_FEEDRATE_Z are now set using the HOMING_FEEDRATE_MM_M array instead."
|
||||
#elif defined(MANUAL_HOME_POSITIONS)
|
||||
#error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead."
|
||||
#elif defined(PID_ADD_EXTRUSION_RATE)
|
||||
@@ -531,12 +533,16 @@
|
||||
#error "PROBE_OFFSET_START is now PROBE_OFFSET_WIZARD_START_Z."
|
||||
#elif defined(POWER_LOSS_PULL)
|
||||
#error "POWER_LOSS_PULL is now specifically POWER_LOSS_PULL(UP|DOWN)."
|
||||
#elif defined(SHORT_MANUAL_Z_MOVE)
|
||||
#error "SHORT_MANUAL_Z_MOVE is now FINE_MANUAL_MOVE, applying to Z on most printers."
|
||||
#elif defined(FIL_RUNOUT_INVERTING)
|
||||
#if FIL_RUNOUT_INVERTING
|
||||
#error "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_STATE HIGH."
|
||||
#else
|
||||
#error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW."
|
||||
#endif
|
||||
#elif defined(ASSISTED_TRAMMING_MENU_ITEM)
|
||||
#error "ASSISTED_TRAMMING_MENU_ITEM is deprecated and should be removed."
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -717,7 +723,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE)
|
||||
#error "SHOW_CUSTOM_BOOTSCREEN requires Graphical LCD or TOUCH_UI_FTDI_EVE."
|
||||
#elif ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) && !HAS_MARLINUI_U8GLIB
|
||||
#error "CUSTOM_STATUS_SCREEN_IMAGE requires a Graphical LCD."
|
||||
#error "CUSTOM_STATUS_SCREEN_IMAGE requires a 128x64 DOGM B/W Graphical LCD."
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1251,8 +1257,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
*/
|
||||
#if 1 < 0 \
|
||||
+ (DISABLED(BLTOUCH) && HAS_Z_SERVO_PROBE) \
|
||||
+ (ENABLED(BLTOUCH) && DISABLED(CREALITY_TOUCH)) \
|
||||
+ COUNT_ENABLED(PROBE_MANUALLY, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, CREALITY_TOUCH, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING)
|
||||
+ COUNT_ENABLED(PROBE_MANUALLY, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING)
|
||||
#error "Please enable only one probe option: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
|
||||
#endif
|
||||
|
||||
@@ -1357,12 +1362,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
static_assert(sanity_nozzle_to_probe_offset.x == 0 && sanity_nozzle_to_probe_offset.y == 0,
|
||||
"NOZZLE_AS_PROBE requires the XY offsets in NOZZLE_TO_PROBE_OFFSET to both be 0.");
|
||||
#else
|
||||
static_assert(sanity_nozzle_to_probe_offset.z <= 0.25,
|
||||
"Are you sure your Probe triggers above the nozzle? Set a negative Z value in the NOZZLE_TO_PROBE_OFFSET.");
|
||||
#ifdef PROBE_OFFSET_WIZARD_START_Z
|
||||
static_assert(PROBE_OFFSET_WIZARD_START_Z <= 0.25,
|
||||
"Are you sure your Probe triggers above the nozzle? Set a negative value for PROBE_OFFSET_WIZARD_START_Z.");
|
||||
#endif
|
||||
static_assert(PROBING_MARGIN >= 0, "PROBING_MARGIN must be >= 0.");
|
||||
static_assert(PROBING_MARGIN_BACK >= 0, "PROBING_MARGIN_BACK must be >= 0.");
|
||||
static_assert(PROBING_MARGIN_FRONT >= 0, "PROBING_MARGIN_FRONT must be >= 0.");
|
||||
@@ -1411,6 +1410,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "Z_SAFE_HOMING is recommended when homing with a probe. Enable it or comment out this line to continue."
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_ACTIVATION_SWITCH)
|
||||
#ifndef PROBE_ACTIVATION_SWITCH_STATE
|
||||
#error "PROBE_ACTIVATION_SWITCH_STATE is required for PROBE_ACTIVATION_SWITCH."
|
||||
#elif !PIN_EXISTS(PROBE_ACTIVATION_SWITCH)
|
||||
#error "A PROBE_ACTIVATION_SWITCH_PIN is required for PROBE_ACTIVATION_SWITCH."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
@@ -1449,8 +1456,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS."
|
||||
#elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15)
|
||||
#error "GRID_MAX_POINTS_[XY] must be a whole number between 3 and 15."
|
||||
#elif !defined(RESTORE_LEVELING_AFTER_G28)
|
||||
#error "AUTO_BED_LEVELING_UBL used to enable RESTORE_LEVELING_AFTER_G28. To keep this behavior enable RESTORE_LEVELING_AFTER_G28. Otherwise define it as 'false'."
|
||||
#endif
|
||||
|
||||
#elif HAS_ABL_NOT_UBL
|
||||
@@ -1477,6 +1482,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#if HAS_MESH && HAS_CLASSIC_JERK
|
||||
static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
|
||||
#endif
|
||||
@@ -1512,6 +1521,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOTH(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
|
||||
#error "Disable PREHEAT_BEFORE_LEVELING when using PREHEAT_BEFORE_PROBING."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Homing
|
||||
*/
|
||||
@@ -1867,7 +1880,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
#error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
|
||||
#elif !HAS_TEMP_ADC_PROBE
|
||||
#error "TEMP_PROBE_PIN must be an ADC pin."
|
||||
#elif !ENABLED(FIX_MOUNTED_PROBE)
|
||||
#elif DISABLED(FIX_MOUNTED_PROBE)
|
||||
#error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
|
||||
#endif
|
||||
#endif
|
||||
@@ -1914,7 +1927,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
/**
|
||||
* LED Backlight Timeout
|
||||
*/
|
||||
#if defined(LED_BACKLIGHT_TIMEOUT) && !(ENABLED(PSU_CONTROL) && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1))
|
||||
#if defined(LED_BACKLIGHT_TIMEOUT) && !(ENABLED(PSU_CONTROL) && ANY(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864))
|
||||
#error "LED_BACKLIGHT_TIMEOUT requires a FYSETC Mini Panel and a Power Switch."
|
||||
#endif
|
||||
|
||||
@@ -2289,7 +2302,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \
|
||||
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
|
||||
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
|
||||
+ COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R) \
|
||||
+ COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, ANET_ET4_TFT28, ANET_ET5_TFT35) \
|
||||
+ COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \
|
||||
+ COUNT_ENABLED(VIKI2, miniVIKI) \
|
||||
+ COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \
|
||||
@@ -2333,7 +2346,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
#undef IS_EXTUI
|
||||
#undef IS_LEGACY_TFT
|
||||
|
||||
#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28)
|
||||
#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35)
|
||||
#if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
|
||||
#error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one."
|
||||
#elif 1 < ENABLED(TFT_COLOR_UI) + ENABLED(TFT_CLASSIC_UI) + ENABLED(TFT_LVGL_UI)
|
||||
@@ -2660,6 +2673,10 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
#if ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
|
||||
#error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes."
|
||||
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
#error "SENSORLESS_PROBING cannot be used with Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
|
||||
#elif ENABLED(USE_PROBE_FOR_Z_HOMING)
|
||||
#error "SENSORLESS_PROBING cannot be used with USE_PROBE_FOR_Z_HOMING."
|
||||
#elif !Z_SENSORLESS
|
||||
#error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z."
|
||||
#endif
|
||||
@@ -2897,10 +2914,14 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
#error "PRINTCOUNTER requires EEPROM_SETTINGS."
|
||||
#endif
|
||||
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR)
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR) && DISABLED(USE_OTG_USB_HOST)
|
||||
#error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT."
|
||||
#endif
|
||||
|
||||
#if ENABLED(USE_OTG_USB_HOST) && !defined(HAS_OTG_USB_HOST_SUPPORT)
|
||||
#error "The current board does not support USE_OTG_USB_HOST."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__)
|
||||
#error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board."
|
||||
#endif
|
||||
@@ -3195,10 +3216,8 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
#undef _PIN_CONFLICT
|
||||
#endif
|
||||
|
||||
#if !HAS_MARLINUI_U8GLIB
|
||||
#if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
|
||||
#error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
|
||||
#endif
|
||||
#if NONE(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI) && ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
|
||||
#error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
|
||||
#endif
|
||||
|
||||
#if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16
|
||||
@@ -3228,7 +3247,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
/**
|
||||
* Touch Buttons
|
||||
*/
|
||||
#if ENABLED(TOUCH_SCREEN)
|
||||
#if ENABLED(TOUCH_SCREEN) && DISABLED(TOUCH_SCREEN_CALIBRATION)
|
||||
#ifndef TOUCH_CALIBRATION_X
|
||||
#error "TOUCH_CALIBRATION_X must be defined with TOUCH_SCREEN."
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user