Merge branch 'bugfix-2.1.x' into CrealityDwin2.0_Bleeding

This commit is contained in:
InsanityAutomation
2022-08-20 15:17:46 -04:00
283 changed files with 10858 additions and 3634 deletions
+5 -1
View File
@@ -14,6 +14,10 @@ end_of_line = lf
indent_style = space
indent_size = 2
[{*.py,*.conf,*.sublime-project}]
[{*.py}]
indent_style = space
indent_size = 4
[{*.conf,*.sublime-project}]
indent_style = tab
indent_size = 4
+5 -2
View File
@@ -34,8 +34,11 @@ This project and everyone participating in it is governed by the [Marlin Code of
We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions.
* [Marlin RepRap forum](https://reprap.org/forum/list.php?415)
* [MarlinFirmware on Facebook](https://www.facebook.com/groups/1049718498464482/)
- [Marlin Documentation](https://marlinfw.org) - Official Marlin documentation
- Facebook Group ["Marlin Firmware"](https://www.facebook.com/groups/1049718498464482/)
- RepRap.org [Marlin Forum](https://forums.reprap.org/list.php?415)
- Facebook Group ["Marlin Firmware for 3D Printers"](https://www.facebook.com/groups/3Dtechtalk/)
- [Marlin Configuration](https://www.youtube.com/results?search_query=marlin+configuration) on YouTube
If chat is more your speed, you can join the MarlinFirmware Discord server:
+1 -1
View File
@@ -25,4 +25,4 @@ jobs:
days-before-close: 10
stale-issue-label: 'stale-closing-soon'
exempt-all-assignees: true
exempt-issue-labels: 'Bug: Confirmed !,T: Feature Request,Needs: Discussion,Needs: Documentation,Needs: Patch,Needs: Work,Needs: Testing,help wanted,no-locking'
exempt-issue-labels: 'Bug: Confirmed !,T: Feature Request,Needs: More Data,Needs: Discussion,Needs: Documentation,Needs: Patch,Needs: Work,Needs: Testing,help wanted,no-locking'
+4 -2
View File
@@ -8,7 +8,6 @@ name: CI
on:
pull_request:
branches:
- bugfix-2.0.x
- bugfix-2.1.x
paths-ignore:
- config/**
@@ -17,7 +16,6 @@ on:
- '**/*.md'
push:
branches:
- bugfix-2.0.x
- bugfix-2.1.x
paths-ignore:
- config/**
@@ -47,6 +45,7 @@ jobs:
- teensy35
- teensy41
- SAMD51_grandcentral_m4
- PANDA_PI_V29
# Extended AVR Environments
@@ -101,6 +100,9 @@ jobs:
- chitu_f103
- Opulo_Lumen_REV3
# ESP32 environments
- mks_tinybee
# Put lengthy tests last
- LPC1768
+100 -34
View File
@@ -192,7 +192,6 @@
//#define OriginalCrealitySquareBoard
//#define MachineCR10Orig // Forces Melzi board
//#define Melzi_To_SBoardUpgrade // Upgrade Melzi board to 10S board
//#define CrealitySilentBoard // Creality board with TMC2208 Standalone drivers. Disables Linear Advance
//#define Creality422
//#define Creality427
//define CR6_452 // Older recalled Creality 452 motherboard
@@ -534,7 +533,6 @@
#if ANY(MachineEnder3V2, MachineEnder3Pro422, MachineEnder3Pro427, Creality422, Creality427, MachineEnder3Max, MachineEnder6, MachineEnder7, MachineSermoonD1, MachineEnder3S1)
#define POWER_LOSS_RECOVERY //Screen will not compile without PLR
#define CrealitySilentBoard
#endif
#if ANY(MachineEnder3Pro422, MachineEnder3Pro427)
@@ -738,7 +736,7 @@
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_2 -1
//#define BAUDRATE_2 250000 // Enable to override BAUDRATE
//#define BAUDRATE_2 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
/**
* Select a third serial port on the board to use for communication with the host.
@@ -746,7 +744,7 @@
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_3 1
//#define BAUDRATE_3 250000 // Enable to override BAUDRATE
//#define BAUDRATE_3 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
// Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH
@@ -805,6 +803,8 @@
// Choose your own or use a service like http://www.uuidgenerator.net/version4
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
// @section stepper drivers
/**
* Stepper Drivers
*
@@ -823,7 +823,7 @@
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
#if (ANY(SKR13, SKR14, SKR14Turbo, SKRPRO11, CrealitySilentBoard) || ANY(MachineCR10SV2, MachineEnder3S1, MachineCR10SPro, MachineCR10SProV2, MachineCR10Max, MachineCR5, SKRMiniE3V2, SKRMiniE3V3, MachineCR6, MachineCR6Max, MachineEnder6, MachineEnder7, MachineSermoonD1, MachineCR30, MachineCR10Smart, MachineCR10SmartPro)) && DISABLED(SKR_UART)
#if (ANY(SKR13, SKR14, SKR14Turbo, SKRPRO11) || ANY(MachineCR10SV2, MachineEnder3S1, MachineCR10SPro, MachineCR10SProV2, MachineCR10Max, MachineCR5, SKRMiniE3V2, SKRMiniE3V3, MachineCR6, MachineCR6Max, MachineEnder6, MachineEnder7, MachineSermoonD1, MachineCR30, MachineCR10Smart, MachineCR10SmartPro)) && DISABLED(SKR_UART)
#if ENABLED(SKR_2209)
#define X_DRIVER_TYPE TMC2209_STANDALONE
#define Y_DRIVER_TYPE TMC2209_STANDALONE
@@ -985,6 +985,8 @@
#define SINGLENOZZLE_STANDBY_FAN
#endif
// @section multi-material
/**
* Multi-Material Unit
* Set to one of these predefined models:
@@ -997,6 +999,7 @@
*
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* See additional options in Configuration_adv.h.
* :["PRUSA_MMU1", "PRUSA_MMU2", "PRUSA_MMU2S", "EXTENDABLE_EMU_MMU2", "EXTENDABLE_EMU_MMU2S"]
*/
//#define MMU_MODEL PRUSA_MMU2
@@ -1016,6 +1019,7 @@
#define SWITCHING_NOZZLE_SERVO_NR 0
//#define SWITCHING_NOZZLE_E1_SERVO_NR 1 // If two servos are used, the index of the second
#define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 (single servo) or lowered/raised (dual servo)
#define SWITCHING_NOZZLE_SERVO_DWELL 2500 // Dwell time to wait for servo to make physical move
#endif
/**
@@ -1134,7 +1138,7 @@
#endif
//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle
// @section machine
// @section psu control
/**
* Power Supply Control
@@ -1337,28 +1341,43 @@
#define DUMMY_THERMISTOR_999_VALUE 100
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for Adafruit PT100; 4300 for Adafruit PT1000
//#define MAX31865_SENSOR_OHMS_1 100
//#define MAX31865_CALIBRATION_OHMS_1 430
#if TEMP_SENSOR_IS_MAX_TC(0)
#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for Adafruit PT100; 4300 for Adafruit PT1000
#endif
#if TEMP_SENSOR_IS_MAX_TC(1)
#define MAX31865_SENSOR_OHMS_1 100
#define MAX31865_CALIBRATION_OHMS_1 430
#endif
// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
// from the two sensors differ too much the print will be aborted.
//#define TEMP_SENSOR_1_AS_REDUNDANT
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10
#define TEMP_RESIDENCY_TIME 2 // (seconds) Time to wait for hotend to "settle" in M109
#if ENABLED(UnstableTemps)
#define TEMP_WINDOW 5 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 7 // (°C) Temperature proximity considered "close enough" to the target
#else
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#if HAS_E_TEMP_SENSOR
#define TEMP_RESIDENCY_TIME 2 // (seconds) Time to wait for hotend to "settle" in M109
#if ENABLED(UnstableTemps)
#define TEMP_WINDOW 5 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 7 // (°C) Temperature proximity considered "close enough" to the target
#else
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#endif
#endif
#if TEMP_SENSOR_BED
#define TEMP_BED_RESIDENCY_TIME 5 // (seconds) Time to wait for bed to "settle" in M190
#define TEMP_BED_WINDOW 2 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#endif
#if TEMP_SENSOR_CHAMBER
#define TEMP_CHAMBER_RESIDENCY_TIME 10 // (seconds) Time to wait for chamber to "settle" in M191
#define TEMP_CHAMBER_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#endif
#define TEMP_BED_RESIDENCY_TIME 5 // (seconds) Time to wait for bed to "settle" in M190
#define TEMP_BED_WINDOW 2 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
/**
* Redundant Temperature Sensor (TEMP_SENSOR_REDUNDANT)
@@ -1423,6 +1442,8 @@
//============================= PID Settings ================================
//===========================================================================
// @section hotend temp
// Enable PIDTEMP for PID control or MPCTEMP for Predictive Model.
// temperature control. Disable both for bang-bang heating.
#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning
@@ -1519,7 +1540,8 @@
*
* Use a physical model of the hotend to control temperature. When configured correctly
* this gives better responsiveness and stability than PID and it also removes the need
* for PID_EXTRUSION_SCALING and PID_FAN_SCALING. Use M306 to autotune the model.
* for PID_EXTRUSION_SCALING and PID_FAN_SCALING. Use M306 T to autotune the model.
* @section mpctemp
*/
#if ENABLED(MPCTEMP)
//#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1300 bytes of flash)
@@ -1572,6 +1594,7 @@
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W
* heater. If your configuration is significantly different than this and you don't understand
* the issues involved, don't use bed PID until someone else verifies that your hardware works.
* @section bed temp
*/
#if NONE(MachineCR10Orig, LowMemoryBoard, SKRMiniE3V2) || ENABLED(MelziHostOnly)
#define PIDTEMPBED
@@ -1588,7 +1611,7 @@
#if ENABLED(PIDTEMPBED)
//#define MIN_BED_POWER 0
//#define PID_BED_DEBUG // Sends debug data to the serial port.
//#define PID_BED_DEBUG // Print Bed PID debug data to the serial port.
//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
@@ -1626,6 +1649,7 @@
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 200W
* heater. If your configuration is significantly different than this and you don't understand
* the issues involved, don't use chamber PID until someone else verifies that your hardware works.
* @section chamber temp
*/
//#define PIDTEMPCHAMBER
//#define CHAMBER_LIMIT_SWITCHING
@@ -1640,7 +1664,7 @@
#if ENABLED(PIDTEMPCHAMBER)
#define MIN_CHAMBER_POWER 0
//#define PID_CHAMBER_DEBUG // Sends debug data to the serial port.
//#define PID_CHAMBER_DEBUG // Print Chamber PID debug data to the serial port.
// Lasko "MyHeat Personal Heater" (200w) modified with a Fotek SSR-10DA to control only the heating element
// and placed inside the small Creality printer enclosure tent.
@@ -1654,7 +1678,6 @@
#endif // PIDTEMPCHAMBER
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
//#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
@@ -1664,7 +1687,7 @@
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of flash)
#endif
// @section extruder
// @section safety
/**
* Prevent extrusion if the temperature is below EXTRUDE_MINTEMP.
@@ -1736,6 +1759,8 @@
#define POLAR_SEGMENTS_PER_SECOND 5
#endif
// @section delta
// Enable for DELTA kinematics and configure below
//#define DELTA
#if ENABLED(DELTA)
@@ -1795,6 +1820,8 @@
//#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 }
#endif
// @section scara
/**
* MORGAN_SCARA was developed by QHARLEY in South Africa in 2012-2013.
* Implemented and slightly reworked by JCERNY in June, 2014.
@@ -1838,6 +1865,8 @@
#endif
// @section tpara
// Enable for TPARA kinematics and configure below
//#define AXEL_TPARA
#if ENABLED(AXEL_TPARA)
@@ -1864,6 +1893,8 @@
#define PSI_HOMING_OFFSET 0
#endif
// @section machine
// Articulated robot (arm). Joints are directly mapped to axes with no kinematics.
//#define ARTICULATED_ROBOT_ARM
@@ -1875,7 +1906,7 @@
//============================== Endstop Settings ===========================
//===========================================================================
// @section homing
// @section endstops
// Specify here all the endstop connectors that are connected to any endstop or probe.
// Almost all printers will be using one per axis. Probes will use one or more of the
@@ -2723,7 +2754,7 @@
#define DISABLE_E false // For all extruders
#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled
// @section machine
// @section motion
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
@@ -2863,7 +2894,7 @@
//#define V_HOME_DIR -1
//#define W_HOME_DIR -1
// @section machine
// @section geometry
// The size of the print bed
@@ -3296,6 +3327,15 @@
#define LEVELING_BED_TEMP 50
#endif
/**
* Bed Distance Sensor
*
* Measures the distance from bed to nozzle with accuracy of 0.01mm.
* For information about this sensor https://github.com/markniu/Bed_Distance_sensor
* Uses I2C port, so it requires I2C library markyue/Panda_SoftMasterI2C.
*/
//#define BD_SENSOR
/**
* Enable detailed logging of G28, G29, M48, etc.
* Turn on with the command 'M111 S32'.
@@ -3592,7 +3632,7 @@
//============================= Additional Features ===========================
//=============================================================================
// @section extras
// @section eeprom
/**
* EEPROM
@@ -3614,6 +3654,8 @@
//#define EEPROM_INIT_NOW // Init EEPROM on first boot after a new build.
#endif
// @section host
//
// Host Keepalive
//
@@ -3652,6 +3694,8 @@
#define PREHEAT_2_TEMP_CHAMBER 35
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
// @section motion
/**
* Nozzle Park
*
@@ -3757,6 +3801,8 @@
#endif
// @section host
/**
* Print Job Timer
*
@@ -3803,6 +3849,8 @@
#endif
#endif
// @section security
/**
* Password
*
@@ -3870,7 +3918,7 @@
//============================= LCD and SD support ============================
//=============================================================================
// @section lcd
// @section interface
/**
* LCD LANGUAGE
@@ -3991,6 +4039,16 @@
//
//#define REVERSE_SELECT_DIRECTION
//
// Encoder EMI Noise Filter
//
// This option increases encoder samples to filter out phantom encoder clicks caused by EMI noise.
//
//#define ENCODER_NOISE_FILTER
#if ENABLED(ENCODER_NOISE_FILTER)
#define ENCODER_SAMPLES 10
#endif
//
// Individual Axis Homing
//
@@ -4024,6 +4082,7 @@
//======================== LCD / Controller Selection =========================
//======================== (Character-based LCDs) =========================
//=============================================================================
// @section lcd
//
// RepRapDiscount Smart Controller.
@@ -4635,6 +4694,7 @@
//
//#define DWIN_CREALITY_LCD // Creality UI
//#define DWIN_LCD_PROUI // Pro UI by MRiscoC
//#define DWIN_CREALITY_LCD_JYERSUI // Jyers UI by Jacob Myers
//#define DWIN_MARLINUI_PORTRAIT // MarlinUI (portrait orientation)
//#define DWIN_MARLINUI_LANDSCAPE // MarlinUI (landscape orientation)
@@ -4681,7 +4741,7 @@
//=============================== Extra Features ==============================
//=============================================================================
// @section extras
// @section fans
// Set number of user-controlled fans. Disable to use all board-defined fans.
// :[1,2,3,4,5,6,7,8]
@@ -4706,14 +4766,18 @@
// duty cycle is attained.
//#define SOFT_PWM_DITHER
// @section extras
// Support for the BariCUDA Paste Extruder
//#define BARICUDA
// @section lights
// Temperature status LEDs that display the hotend and bed temperature.
// If all hotends, bed temperature, and target temperature are under 54C
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
//#define TEMP_STAT_LEDS
// Support for the BariCUDA Paste Extruder
//#define BARICUDA
// Support for BlinkM/CyzRgb
//#define BLINKM
@@ -4798,6 +4862,8 @@
#define PRINTER_EVENT_LEDS
#endif
// @section servos
/**
* Number of servos
*
+102 -21
View File
@@ -32,6 +32,24 @@
*/
#define CONFIGURATION_ADV_H_VERSION 02010100
// @section develop
/**
* Configuration Export
*
* Export the configuration as part of the build. (See signature.py)
* Output files are saved with the build (e.g., .pio/build/mega2560).
*
* See `build_all_examples --ini` as an example of config.ini archiving.
*
* 1 = marlin_config.json - Dictionary containing the configuration.
* This file is also generated for CONFIGURATION_EMBEDDING.
* 2 = config.ini - File format for PlatformIO preprocessing.
* 3 = schema.json - The entire configuration schema. (13 = pattern groups)
* 4 = schema.yml - The entire configuration schema.
*/
//#define CONFIG_EXPORT 2 // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml']
//===========================================================================
//============================= Thermal Settings ============================
//===========================================================================
@@ -982,9 +1000,12 @@
#define Z_STEPPER_AUTO_ALIGN
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
// Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]]
// If not defined, probe limits will be used.
// Override with 'M422 S<index> X<pos> Y<pos>'
/**
* Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]]
* These positions are machine-relative and do not shift with the M206 home offset!
* If not defined, probe limits will be used.
* Override with 'M422 S<index> X<pos> Y<pos>'.
*/
//#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } }
/**
@@ -1417,7 +1438,7 @@
#endif // HAS_MARLINUI_MENU
#if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI)
#if ANY(HAS_DISPLAY, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
//#define SOUND_MENU_ITEM // Add a mute option to the LCD menu
#define SOUND_ON_DEFAULT // Buzzer/speaker default enabled state
#endif
@@ -1647,6 +1668,9 @@
* Endstops must be activated for this option to work.
*/
//#define SD_ABORT_ON_ENDSTOP_HIT
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
//#define SD_ABORT_ON_ENDSTOP_HIT_GCODE "G28XY" // G-code to run on endstop hit (e.g., "G28XY" or "G27")
#endif
//#define SD_REPRINT_LAST_SELECTED_FILE // On print completion open the LCD Menu and select the same file
@@ -1686,6 +1710,8 @@
//#define USE_UHS2_USB
//#define USE_UHS3_USB
#define DISABLE_DUE_SD_MMC // Disable USB Host access to USB Drive to prevent hangs on block access for DUE platform
/**
* Native USB Host supported by some boards (USB OTG)
*/
@@ -2142,9 +2168,7 @@
*
* See https://marlinfw.org/docs/features/lin_advance.html for full instructions.
*/
#if NONE(MachineCR10Orig, SKRMiniE3V2, LowMemoryBoard, MachineCR10SPro, MachineCR10Max, SKR13, SKR14, SKR14Turbo, MachineCR10SV2, CrealitySilentBoard, MachineCR5) || ENABLED(OrigLA) || (ANY(SKR13, SKR14, SKR14Turbo, SKRPRO11) && ENABLED(SKR_UART))
#define LIN_ADVANCE
#endif
#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.0 // Unit: mm compression per 1mm/s extruder speed
@@ -2680,6 +2704,8 @@
#endif
#endif // HAS_MULTI_EXTRUDER
// @section advanced pause
/**
* Advanced Pause for Filament Change
* - Adds the G-code M600 Filament Change to initiate a filament change.
@@ -2758,13 +2784,12 @@
#endif
#endif
// @section tmc
/**
* TMC26X Stepper Driver options
*
* The TMC26XStepper library is required for this stepper driver.
* https://github.com/trinamic/TMC26XStepper
* @section tmc/tmc26x
*/
#if HAS_DRIVER(TMC26X)
@@ -2902,8 +2927,6 @@
#endif // TMC26X
// @section tmc_smart
/**
* To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 stepper drivers in SPI mode
* connect your SPI pins to the hardware SPI interface on your board and define
@@ -2919,6 +2942,7 @@
*
* TMCStepper library is required to use TMC stepper drivers.
* https://github.com/teemuatlut/TMCStepper
* @section tmc/config
*/
#if HAS_TRINAMIC_CONFIG
@@ -3142,6 +3166,8 @@
//#define E7_HOLD_MULTIPLIER 0.5
#endif
// @section tmc/spi
/**
* Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here.
* The default pins can be found in your board's pins file.
@@ -3181,6 +3207,8 @@
//#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1
// @section tmc/serial
/**
* Four TMC2209 drivers can use the same HW/SW serial port with hardware configured addresses.
* Set the address using jumpers on pins MS1 and MS2.
@@ -3223,6 +3251,8 @@
//#define E7_SLAVE_ADDRESS 0
#endif
// @section tmc/smart
/**
* Software enable
*
@@ -3231,6 +3261,8 @@
*/
//#define SOFTWARE_DRIVER_ENABLE
// @section tmc/stealthchop
/**
* TMC2130, TMC2160, TMC2208, TMC2209, TMC5130 and TMC5160 only
* Use Trinamic's ultra quiet stepping mode.
@@ -3285,6 +3317,8 @@
//#define CHOPPER_TIMING_E6 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E7 CHOPPER_TIMING_E
// @section tmc/status
/**
* Monitor Trinamic drivers
* for error conditions like overtemperature and short to ground.
@@ -3306,6 +3340,8 @@
#define STOP_ON_ERROR
#endif
// @section tmc/hybrid
/**
* TMC2130, TMC2160, TMC2208, TMC2209, TMC5130 and TMC5160 only
* The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD.
@@ -3362,6 +3398,7 @@
* homing and adds a guard period for endstop triggering.
*
* Comment *_STALL_SENSITIVITY to disable sensorless homing for that axis.
* @section tmc/stallguard
*/
//#define SENSORLESS_HOMING // StallGuard capable drivers only
@@ -3385,6 +3422,8 @@
//#define IMPROVE_HOMING_RELIABILITY
#endif
// @section tmc/config
/**
* TMC Homing stepper phase.
*
@@ -3426,7 +3465,6 @@
#endif // HAS_TRINAMIC_CONFIG
// @section i2cbus
//
@@ -3468,7 +3506,7 @@
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif
// @section extras
// @section photo
/**
* Photo G-code
@@ -3511,6 +3549,8 @@
#endif
#endif
// @section cnc
/**
* Spindle & Laser control
*
@@ -3714,6 +3754,8 @@
#define COOLANT_FLOOD_INVERT false // Set "true" if the on/off function is reversed
#endif
// @section filament width
/**
* Filament Width Sensor
*
@@ -3747,6 +3789,8 @@
//#define FILAMENT_LCD_DISPLAY
#endif
// @section power
/**
* Power Monitor
* Monitor voltage (V) and/or current (A), and -when possible- power (W)
@@ -3770,6 +3814,8 @@
#define POWER_MONITOR_VOLTAGE_OFFSET 0 // Offset (in volts) applied to the calculated voltage
#endif
// @section safety
/**
* Stepper Driver Anti-SNAFU Protection
*
@@ -3779,6 +3825,8 @@
*/
//#define DISABLE_DRIVER_SAFE_POWER_PROTECT
// @section cnc
/**
* CNC Coordinate Systems
*
@@ -3787,6 +3835,8 @@
*/
//#define CNC_COORDINATE_SYSTEMS
// @section reporting
/**
* Auto-report fan speed with M123 S<seconds>
* Requires fans with tachometer pins
@@ -3818,6 +3868,8 @@
#endif
#endif
// @section security
/**
* Expected Printer Check
* Add the M16 G-code to compare a string to the MACHINE_NAME.
@@ -3825,6 +3877,8 @@
*/
//#define EXPECTED_PRINTER_CHECK
// @section volumetrics
/**
* Disable all Volumetric extrusion options
*/
@@ -3853,14 +3907,7 @@
#endif
#endif
/**
* Enable this option for a leaner build of Marlin that removes all
* workspace offsets, simplifying coordinate transformations, leveling, etc.
*
* - M206 and M428 are disabled.
* - G92 will revert to its behavior from Marlin 1.0.
*/
//#define NO_WORKSPACE_OFFSETS
// @section reporting
// Extra options for the M114 "Current Position" report
//#define M114_DETAIL // Use 'M114` for details to check planner calculations
@@ -3869,6 +3916,8 @@
//#define REPORT_FAN_CHANGE // Report the new fan speed when changed by M106 (and others)
// @section gcode
/**
* Spend 28 bytes of SRAM to optimize the G-code parser
*/
@@ -3888,6 +3937,15 @@
//#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW
/**
* Enable this option for a leaner build of Marlin that removes all
* workspace offsets, simplifying coordinate transformations, leveling, etc.
*
* - M206 and M428 are disabled.
* - G92 will revert to its behavior from Marlin 1.0.
*/
//#define NO_WORKSPACE_OFFSETS
/**
* CNC G-code options
* Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc.
@@ -3903,6 +3961,8 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
// @section gcode
/**
* Startup commands
*
@@ -3982,6 +4042,8 @@
//#define MAIN_MENU_ITEM_5_CONFIRM // Show a confirmation dialog before this action
#endif
// @section custom config menu
// Custom Menu: Configuration Menu
//#define CUSTOM_MENU_CONFIG
#if ENABLED(CUSTOM_MENU_CONFIG)
@@ -4012,6 +4074,8 @@
//#define CONFIG_MENU_ITEM_5_CONFIRM
#endif
// @section custom buttons
/**
* User-defined buttons to run custom G-code.
* Up to 25 may be defined.
@@ -4043,6 +4107,8 @@
#endif
#endif
// @section host
/**
* Host Action Commands
*
@@ -4070,6 +4136,8 @@
//#define HOST_SHUTDOWN_MENU_ITEM // Add a menu item that tells the host to shut down
#endif
// @section extras
/**
* Cancel Objects
*
@@ -4093,6 +4161,7 @@
* Alternative Supplier: https://reliabuild3d.com/
*
* Reliabuild encoders have been modified to improve reliability.
* @section i2c encoders
*/
//#define I2C_POSITION_ENCODERS
@@ -4164,6 +4233,7 @@
/**
* Analog Joystick(s)
* @section joystick
*/
//#define JOYSTICK
#if ENABLED(JOYSTICK)
@@ -4188,6 +4258,7 @@
* Modern replacement for the Prusa TMC_Z_CALIBRATION.
* Adds capability to work with any adjustable current drivers.
* Implemented as G34 because M915 is deprecated.
* @section calibrate
*/
//#define MECHANICAL_GANTRY_CALIBRATION
#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
@@ -4205,6 +4276,7 @@
/**
* Instant freeze / unfreeze functionality
* Potentially useful for emergency stop that allows being resumed.
* @section interface
*/
//#define FREEZE_FEATURE
#if ENABLED(FREEZE_FEATURE)
@@ -4217,6 +4289,7 @@
*
* Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display.
* Requires 3 signal wires. Some useful debug options are included to demonstrate its usage.
* @section debug matrix
*/
//#define MAX7219_DEBUG
#if ENABLED(MAX7219_DEBUG)
@@ -4255,6 +4328,7 @@
* Support for Synchronized Z moves when used with NanoDLP. G0/G1 axis moves will
* output a "Z_move_comp" string to enable synchronization with DLP projector exposure.
* This feature allows you to use [[WaitForDoneMessage]] instead of M400 commands.
* @section nanodlp
*/
//#define NANODLP_Z_SYNC
#if ENABLED(NANODLP_Z_SYNC)
@@ -4263,6 +4337,7 @@
/**
* Ethernet. Use M552 to enable and set the IP address.
* @section network
*/
#if HAS_ETHERNET
#define MAC_ADDRESS { 0xDE, 0xAD, 0xBE, 0xEF, 0xF0, 0x0D } // A MAC address unique to your network
@@ -4290,6 +4365,8 @@
//#include "Configuration_Secure.h" // External file with WiFi SSID / Password
#endif
// @section multi-material
/**
* Průša Multi-Material Unit (MMU)
* Enable in Configuration.h
@@ -4395,6 +4472,7 @@
/**
* Advanced Print Counter settings
* @section stats
*/
#if ENABLED(PRINTCOUNTER)
#define SERVICE_WARNING_BUZZES 3
@@ -4425,6 +4503,9 @@
//#define PINS_DEBUGGING
//#endif
// Enable Tests that will run at startup and produce a report
//#define MARLIN_TEST_BUILD
// Enable Marlin dev mode which adds some special commands
//#define MARLIN_DEV_MODE
+211
View File
@@ -0,0 +1,211 @@
#
# Marlin Firmware
# config.ini - Options to apply before the build
#
[config:base]
ini_use_config = none
# Load all config: sections in this file
;ini_use_config = all
# Load config file relative to Marlin/
;ini_use_config = another.ini
# Download configurations from GitHub
;ini_use_config = example/Creality/Ender-5 Plus @ bugfix-2.1.x
# Download configurations from your server
;ini_use_config = https://me.myserver.com/path/to/configs
# Evaluate config:base and do a config dump
;ini_use_config = base
;config_export = 2
[config:minimal]
motherboard = BOARD_RAMPS_14_EFB
serial_port = 0
baudrate = 250000
use_watchdog = on
thermal_protection_hotends = on
thermal_protection_hysteresis = 4
thermal_protection_period = 40
bufsize = 4
block_buffer_size = 16
max_cmd_size = 96
extruders = 1
temp_sensor_0 = 1
temp_hysteresis = 3
heater_0_mintemp = 5
heater_0_maxtemp = 275
preheat_1_temp_hotend = 180
bang_max = 255
pidtemp = on
pid_k1 = 0.95
pid_max = BANG_MAX
pid_functional_range = 10
default_kp = 22.20
default_ki = 1.08
default_kd = 114.00
x_driver_type = A4988
y_driver_type = A4988
z_driver_type = A4988
e0_driver_type = A4988
x_bed_size = 200
x_min_pos = 0
x_max_pos = X_BED_SIZE
y_bed_size = 200
y_min_pos = 0
y_max_pos = Y_BED_SIZE
z_min_pos = 0
z_max_pos = 200
x_home_dir = -1
y_home_dir = -1
z_home_dir = -1
use_xmin_plug = on
use_ymin_plug = on
use_zmin_plug = on
x_min_endstop_inverting = false
y_min_endstop_inverting = false
z_min_endstop_inverting = false
default_axis_steps_per_unit = { 80, 80, 400, 500 }
axis_relative_modes = { false, false, false, false }
default_max_feedrate = { 300, 300, 5, 25 }
default_max_acceleration = { 3000, 3000, 100, 10000 }
homing_feedrate_mm_m = { (50*60), (50*60), (4*60) }
homing_bump_divisor = { 2, 2, 4 }
x_enable_on = 0
y_enable_on = 0
z_enable_on = 0
e_enable_on = 0
invert_x_dir = false
invert_y_dir = true
invert_z_dir = false
invert_e0_dir = false
invert_e_step_pin = false
invert_x_step_pin = false
invert_y_step_pin = false
invert_z_step_pin = false
disable_x = false
disable_y = false
disable_z = false
disable_e = false
proportional_font_ratio = 1.0
default_nominal_filament_dia = 1.75
junction_deviation_mm = 0.013
default_acceleration = 3000
default_travel_acceleration = 3000
default_retract_acceleration = 3000
default_minimumfeedrate = 0.0
default_mintravelfeedrate = 0.0
minimum_planner_speed = 0.05
min_steps_per_segment = 6
default_minsegmenttime = 20000
[config:basic]
bed_overshoot = 10
busy_while_heating = on
default_ejerk = 5.0
default_keepalive_interval = 2
default_leveling_fade_height = 0.0
disable_inactive_extruder = on
display_charset_hd44780 = JAPANESE
eeprom_boot_silent = on
eeprom_chitchat = on
endstoppullups = on
extrude_maxlength = 200
extrude_mintemp = 170
host_keepalive_feature = on
hotend_overshoot = 15
jd_handle_small_segments = on
lcd_info_screen_style = 0
lcd_language = en
max_bed_power = 255
mesh_inset = 0
min_software_endstops = on
max_software_endstops = on
min_software_endstop_x = on
min_software_endstop_y = on
min_software_endstop_z = on
max_software_endstop_x = on
max_software_endstop_y = on
max_software_endstop_z = on
preheat_1_fan_speed = 0
preheat_1_label = "PLA"
preheat_1_temp_bed = 70
prevent_cold_extrusion = on
prevent_lengthy_extrude = on
printjob_timer_autostart = on
probing_margin = 10
show_bootscreen = on
soft_pwm_scale = 0
string_config_h_author = "(none, default config)"
temp_bed_hysteresis = 3
temp_bed_residency_time = 10
temp_bed_window = 1
temp_residency_time = 10
temp_window = 1
validate_homing_endstops = on
xy_probe_feedrate = (133*60)
z_clearance_between_probes = 5
z_clearance_deploy_probe = 10
z_clearance_multi_probe = 5
[config:advanced]
arc_support = on
auto_report_temperatures = on
autotemp = on
autotemp_oldweight = 0.98
bed_check_interval = 5000
default_stepper_deactive_time = 120
default_volumetric_extruder_limit = 0.00
disable_inactive_e = true
disable_inactive_x = true
disable_inactive_y = true
disable_inactive_z = true
e0_auto_fan_pin = -1
encoder_100x_steps_per_sec = 80
encoder_10x_steps_per_sec = 30
encoder_rate_multiplier = on
extended_capabilities_report = on
extruder_auto_fan_speed = 255
extruder_auto_fan_temperature = 50
fanmux0_pin = -1
fanmux1_pin = -1
fanmux2_pin = -1
faster_gcode_parser = on
homing_bump_mm = { 5, 5, 2 }
max_arc_segment_mm = 1.0
min_arc_segment_mm = 0.1
min_circle_segments = 72
n_arc_correction = 25
serial_overrun_protection = on
slowdown = on
slowdown_divisor = 2
temp_sensor_bed = 0
thermal_protection_bed_hysteresis = 2
thermocouple_max_errors = 15
tx_buffer_size = 0
watch_bed_temp_increase = 2
watch_bed_temp_period = 60
watch_temp_increase = 2
watch_temp_period = 20
+11 -3
View File
@@ -35,11 +35,19 @@
|| X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \
|| X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
|| BTN_EN1 == N || BTN_EN2 == N \
)
#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts.
#if CONF_SERIAL_IS(0)
// D0-D1. No known conflicts.
#endif
#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
#if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
#endif
#else
#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11))
#error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
#endif
#endif
#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
#error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
+112 -104
View File
@@ -9,119 +9,127 @@ from __future__ import print_function
import pioutil
if pioutil.is_pio_build():
target_filename = "FIRMWARE.CUR"
target_drive = "REARM"
target_filename = "FIRMWARE.CUR"
target_drive = "REARM"
import os,getpass,platform
import platform
current_OS = platform.system()
Import("env")
current_OS = platform.system()
Import("env")
def print_error(e):
print('\nUnable to find destination disk (%s)\n' \
'Please select it in platformio.ini using the upload_port keyword ' \
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \
%(e, env.get('PIOENV')))
def print_error(e):
print('\nUnable to find destination disk (%s)\n' \
'Please select it in platformio.ini using the upload_port keyword ' \
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \
%(e, env.get('PIOENV')))
def before_upload(source, target, env):
try:
#
# Find a disk for upload
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
if current_OS == 'Windows':
#
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# Windows - doesn't care about the disk's name, only cares about the drive letter
import subprocess,string
from ctypes import windll
def before_upload(source, target, env):
try:
from pathlib import Path
#
# Find a disk for upload
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
if current_OS == 'Windows':
#
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# Windows - doesn't care about the disk's name, only cares about the drive letter
import subprocess,string
from ctypes import windll
from pathlib import PureWindowsPath
# getting list of drives
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
# getting list of drives
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
for drive in drives:
final_drive_name = drive + ':\\'
# print ('disc check: {}'.format(final_drive_name))
try:
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
except Exception as e:
print ('error:{}'.format(e))
continue
else:
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = final_drive_name
if target_filename in volume_info:
if not target_file_found:
upload_disk = final_drive_name
target_file_found = True
for drive in drives:
final_drive_name = drive + ':'
# print ('disc check: {}'.format(final_drive_name))
try:
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
except Exception as e:
print ('error:{}'.format(e))
continue
else:
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = PureWindowsPath(final_drive_name)
if target_filename in volume_info:
if not target_file_found:
upload_disk = PureWindowsPath(final_drive_name)
target_file_found = True
elif current_OS == 'Linux':
#
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
if target_drive in drives: # If target drive is found, use it.
target_drive_found = True
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
else:
for drive in drives:
try:
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
except:
continue
else:
if target_filename in files:
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
target_file_found = True
break
#
# set upload_port to drive if found
#
elif current_OS == 'Linux':
#
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
#
import getpass
user = getpass.getuser()
mpath = Path('media', user)
drives = [ x for x in mpath.iterdir() if x.is_dir() ]
if target_drive in drives: # If target drive is found, use it.
target_drive_found = True
upload_disk = mpath / target_drive
else:
for drive in drives:
try:
fpath = mpath / drive
filenames = [ x.name for x in fpath.iterdir() if x.is_file() ]
except:
continue
else:
if target_filename in filenames:
upload_disk = mpath / drive
target_file_found = True
break
#
# set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(
UPLOAD_FLAGS="-P$UPLOAD_PORT"
)
if target_file_found or target_drive_found:
env.Replace(
UPLOAD_FLAGS="-P$UPLOAD_PORT"
)
elif current_OS == 'Darwin': # MAC
#
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir('/Volumes') # human readable names
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = '/Volumes/' + target_drive + '/'
for drive in drives:
try:
filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected
except:
continue
else:
if target_filename in filenames:
if not target_file_found:
upload_disk = '/Volumes/' + drive + '/'
target_file_found = True
elif current_OS == 'Darwin': # MAC
#
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
dpath = Path('/Volumes') # human readable names
drives = [ x for x in dpath.iterdir() if x.is_dir() ]
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = dpath / target_drive
for drive in drives:
try:
fpath = dpath / drive # will get an error if the drive is protected
filenames = [ x.name for x in fpath.iterdir() if x.is_file() ]
except:
continue
else:
if target_filename in filenames:
upload_disk = dpath / drive
target_file_found = True
break
#
# Set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(UPLOAD_PORT=upload_disk)
print('\nUpload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
#
# Set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(UPLOAD_PORT=str(upload_disk))
print('\nUpload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
except Exception as e:
print_error(str(e))
except Exception as e:
print_error(str(e))
env.AddPreAction("upload", before_upload)
env.AddPreAction("upload", before_upload)
+1 -1
View File
@@ -51,7 +51,7 @@ enum XPTCoordinate : uint8_t {
XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
};
#if !defined(XPT2046_Z1_THRESHOLD)
#ifndef XPT2046_Z1_THRESHOLD
#define XPT2046_Z1_THRESHOLD 10
#endif
@@ -27,3 +27,8 @@
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif
// Some STM32F4 boards may lose steps when saving to EEPROM during print (PR #17946)
#if defined(STM32F4xx) && PRINTCOUNTER_SAVE_INTERVAL > 0
#define PRINTCOUNTER_SYNC 1
#endif
-5
View File
@@ -37,11 +37,6 @@
#error "SDCARD_EEPROM_EMULATION requires SDSUPPORT. Enable SDSUPPORT or choose another EEPROM emulation."
#endif
#if defined(STM32F4xx) && BOTH(PRINTCOUNTER, FLASH_EEPROM_EMULATION)
#warning "FLASH_EEPROM_EMULATION may cause long delays when writing and should not be used while printing."
#error "Disable PRINTCOUNTER or choose another EEPROM emulation."
#endif
#if !defined(STM32F4xx) && ENABLED(FLASH_EEPROM_LEVELING)
#error "FLASH_EEPROM_LEVELING is currently only supported on STM32F4 hardware."
#endif
+1 -1
View File
@@ -147,7 +147,7 @@ uint32_t TFT_FSMC::ReadID(tft_data_t Reg) {
}
bool TFT_FSMC::isBusy() {
#if defined(STM32F1xx)
#ifdef STM32F1xx
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
#elif defined(STM32F4xx)
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
+2 -2
View File
@@ -372,9 +372,9 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
if (MemoryIncrease == DMA_PINC_ENABLE) {
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
Data += width * height;
} else {
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
}
else
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
y_cur += height;
}
+1 -1
View File
@@ -179,7 +179,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
}
bool TFT_SPI::isBusy() {
#if defined(STM32F1xx)
#ifdef STM32F1xx
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
#elif defined(STM32F4xx)
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
+26 -9
View File
@@ -39,17 +39,13 @@
#endif
#include <math.h>
#include "core/utility.h"
#include "module/endstops.h"
#include "module/motion.h"
#include "module/planner.h"
#include "module/endstops.h"
#include "module/temperature.h"
#include "module/settings.h"
#include "module/printcounter.h" // PrintCounter or Stopwatch
#include "module/settings.h"
#include "module/stepper.h"
#include "module/stepper/indirection.h"
#include "module/temperature.h"
#include "gcode/gcode.h"
#include "gcode/parser.h"
@@ -76,6 +72,8 @@
#include "lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "lcd/e3v2/jyersui/dwin.h"
#endif
#endif
@@ -123,6 +121,10 @@
#include "feature/bltouch.h"
#endif
#if ENABLED(BD_SENSOR)
#include "feature/bedlevel/bdl/bdl.h"
#endif
#if ENABLED(POLL_JOG)
#include "feature/joystick.h"
#endif
@@ -246,6 +248,10 @@
#include "feature/easythreed_ui.h"
#endif
#if ENABLED(MARLIN_TEST_BUILD)
#include "tests/marlin_tests.h"
#endif
PGMSTR(M112_KILL_STR, "M112 Shutdown");
MarlinState marlin_state = MF_INITIALIZING;
@@ -777,6 +783,9 @@ void idle(bool no_stepper_sleep/*=false*/) {
if (++idle_depth > 5) SERIAL_ECHOLNPGM("idle() call depth: ", idle_depth);
#endif
// Bed Distance Sensor task
TERN_(BD_SENSOR, bdl.process());
// Core Marlin activities
manage_inactivity(no_stepper_sleep);
@@ -1218,10 +1227,10 @@ void setup() {
SETUP_RUN(hal.init());
// Init and disable SPI thermocouples; this is still needed
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E0))
#if TEMP_SENSOR_IS_MAX_TC(0) || (TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E0))
OUT_WRITE(TEMP_0_CS_PIN, HIGH); // Disable
#endif
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if TEMP_SENSOR_IS_MAX_TC(1) || (TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E1))
OUT_WRITE(TEMP_1_CS_PIN, HIGH);
#endif
@@ -1630,9 +1639,15 @@ void setup() {
SETUP_RUN(test_tmc_connection());
#endif
#if ENABLED(BD_SENSOR)
SETUP_RUN(bdl.init(I2C_BD_SDA_PIN, I2C_BD_SCL_PIN, I2C_BD_DELAY));
#endif
marlin_state = MF_RUNNING;
SETUP_LOG("setup() completed.");
TERN_(MARLIN_TEST_BUILD, runStartupTests());
}
/**
@@ -1667,5 +1682,7 @@ void loop() {
TERN_(HAS_TFT_LVGL_UI, printer_state_polling());
TERN_(MARLIN_TEST_BUILD, runPeriodicTests());
} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}
+34 -34
View File
@@ -387,40 +387,40 @@
#define BOARD_RUMBA32_BTT 4204 // RUMBA32 STM32F446VE based controller from BIGTREETECH
#define BOARD_BLACK_STM32F407VE 4205 // BLACK_STM32F407VE
#define BOARD_BLACK_STM32F407ZE 4206 // BLACK_STM32F407ZE
#define BOARD_BTT_SKR_PRO_V1_1 4208 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
#define BOARD_BTT_SKR_PRO_V1_2 4209 // BigTreeTech SKR Pro v1.2 (STM32F407ZG)
#define BOARD_BTT_BTT002_V1_0 4210 // BigTreeTech BTT002 v1.0 (STM32F407VG)
#define BOARD_BTT_E3_RRF 4211 // BigTreeTech E3 RRF (STM32F407VG)
#define BOARD_BTT_SKR_V2_0_REV_A 4212 // BigTreeTech SKR v2.0 Rev A (STM32F407VG)
#define BOARD_BTT_SKR_V2_0_REV_B 4213 // BigTreeTech SKR v2.0 Rev B (STM32F407VG/STM32F429VG)
#define BOARD_BTT_GTR_V1_0 4214 // BigTreeTech GTR v1.0 (STM32F407IGT)
#define BOARD_BTT_OCTOPUS_V1_0 4215 // BigTreeTech Octopus v1.0 (STM32F446ZE)
#define BOARD_BTT_OCTOPUS_V1_1 4216 // BigTreeTech Octopus v1.1 (STM32F446ZE)
#define BOARD_BTT_OCTOPUS_PRO_V1_0 4217 // BigTreeTech Octopus Pro v1.0 (STM32F446ZE / STM32F429ZG)
#define BOARD_LERDGE_K 4218 // Lerdge K (STM32F407ZG)
#define BOARD_LERDGE_S 4219 // Lerdge S (STM32F407VE)
#define BOARD_LERDGE_X 4220 // Lerdge X (STM32F407VE)
#define BOARD_VAKE403D 4221 // VAkE 403D (STM32F446VE)
#define BOARD_FYSETC_S6 4222 // FYSETC S6 (STM32F446VE)
#define BOARD_FYSETC_S6_V2_0 4223 // FYSETC S6 v2.0 (STM32F446VE)
#define BOARD_FYSETC_SPIDER 4224 // FYSETC Spider (STM32F446VE)
#define BOARD_FLYF407ZG 4225 // FLYmaker FLYF407ZG (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4226 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_MKS_ROBIN_PRO_V2 4227 // MKS Robin Pro V2 (STM32F407VE)
#define BOARD_MKS_ROBIN_NANO_V3 4228 // MKS Robin Nano V3 (STM32F407VG)
#define BOARD_MKS_ROBIN_NANO_V3_1 4229 // MKS Robin Nano V3.1 (STM32F407VE)
#define BOARD_MKS_MONSTER8_V1 4230 // MKS Monster8 V1 (STM32F407VE)
#define BOARD_MKS_MONSTER8_V2 4231 // MKS Monster8 V2 (STM32F407VE)
#define BOARD_ANET_ET4 4232 // ANET ET4 V1.x (STM32F407VG)
#define BOARD_ANET_ET4P 4233 // ANET ET4P V1.x (STM32F407VG)
#define BOARD_FYSETC_CHEETAH_V20 4234 // FYSETC Cheetah V2.0 (STM32F401RC)
#define BOARD_TH3D_EZBOARD_V2 4235 // TH3D EZBoard v2.0 (STM32F405RG)
#define BOARD_OPULO_LUMEN_REV3 4236 // Opulo Lumen PnP Controller REV3 (STM32F407VE / STM32F407VG)
#define BOARD_MKS_ROBIN_NANO_V1_3_F4 4237 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE)
#define BOARD_MKS_EAGLE 4238 // MKS Eagle (STM32F407VE)
#define BOARD_ARTILLERY_RUBY 4239 // Artillery Ruby (STM32F401RC)
#define BOARD_FYSETC_SPIDER_V2_2 4240 // FYSETC Spider V2.2 (STM32F446VE)
#define BOARD_CREALITY_V24S1_301F4 4241 // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4
#define BOARD_BTT_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
#define BOARD_BTT_SKR_PRO_V1_2 4208 // BigTreeTech SKR Pro v1.2 (STM32F407ZG)
#define BOARD_BTT_BTT002_V1_0 4209 // BigTreeTech BTT002 v1.0 (STM32F407VG)
#define BOARD_BTT_E3_RRF 4210 // BigTreeTech E3 RRF (STM32F407VG)
#define BOARD_BTT_SKR_V2_0_REV_A 4211 // BigTreeTech SKR v2.0 Rev A (STM32F407VG)
#define BOARD_BTT_SKR_V2_0_REV_B 4212 // BigTreeTech SKR v2.0 Rev B (STM32F407VG/STM32F429VG)
#define BOARD_BTT_GTR_V1_0 4213 // BigTreeTech GTR v1.0 (STM32F407IGT)
#define BOARD_BTT_OCTOPUS_V1_0 4214 // BigTreeTech Octopus v1.0 (STM32F446ZE)
#define BOARD_BTT_OCTOPUS_V1_1 4215 // BigTreeTech Octopus v1.1 (STM32F446ZE)
#define BOARD_BTT_OCTOPUS_PRO_V1_0 4216 // BigTreeTech Octopus Pro v1.0 (STM32F446ZE / STM32F429ZG)
#define BOARD_LERDGE_K 4217 // Lerdge K (STM32F407ZG)
#define BOARD_LERDGE_S 4218 // Lerdge S (STM32F407VE)
#define BOARD_LERDGE_X 4219 // Lerdge X (STM32F407VE)
#define BOARD_VAKE403D 4220 // VAkE 403D (STM32F446VE)
#define BOARD_FYSETC_S6 4221 // FYSETC S6 (STM32F446VE)
#define BOARD_FYSETC_S6_V2_0 4222 // FYSETC S6 v2.0 (STM32F446VE)
#define BOARD_FYSETC_SPIDER 4223 // FYSETC Spider (STM32F446VE)
#define BOARD_FLYF407ZG 4224 // FLYmaker FLYF407ZG (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4225 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_MKS_ROBIN_PRO_V2 4226 // MKS Robin Pro V2 (STM32F407VE)
#define BOARD_MKS_ROBIN_NANO_V3 4227 // MKS Robin Nano V3 (STM32F407VG)
#define BOARD_MKS_ROBIN_NANO_V3_1 4228 // MKS Robin Nano V3.1 (STM32F407VE)
#define BOARD_MKS_MONSTER8_V1 4229 // MKS Monster8 V1 (STM32F407VE)
#define BOARD_MKS_MONSTER8_V2 4230 // MKS Monster8 V2 (STM32F407VE)
#define BOARD_ANET_ET4 4231 // ANET ET4 V1.x (STM32F407VG)
#define BOARD_ANET_ET4P 4232 // ANET ET4P V1.x (STM32F407VG)
#define BOARD_FYSETC_CHEETAH_V20 4233 // FYSETC Cheetah V2.0 (STM32F401RC)
#define BOARD_TH3D_EZBOARD_V2 4234 // TH3D EZBoard v2.0 (STM32F405RG)
#define BOARD_OPULO_LUMEN_REV3 4235 // Opulo Lumen PnP Controller REV3 (STM32F407VE / STM32F407VG)
#define BOARD_MKS_ROBIN_NANO_V1_3_F4 4236 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE)
#define BOARD_MKS_EAGLE 4237 // MKS Eagle (STM32F407VE)
#define BOARD_ARTILLERY_RUBY 4238 // Artillery Ruby (STM32F401RC)
#define BOARD_FYSETC_SPIDER_V2_2 4239 // FYSETC Spider V2.2 (STM32F446VE)
#define BOARD_CREALITY_V24S1_301F4 4240 // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4
//
// ARM Cortex M7
+6 -1
View File
@@ -21,7 +21,7 @@
*/
#pragma once
#if !defined(__has_include)
#ifndef __has_include
#define __has_include(...) 1
#endif
@@ -730,3 +730,8 @@
#define __MAPLIST() _MAPLIST
#define MAPLIST(OP,V...) EVAL(_MAPLIST(OP,V))
// Temperature Sensor Config
#define _HAS_E_TEMP(N) || (TEMP_SENSOR_##N != 0)
#define HAS_E_TEMP_SENSOR (0 REPEAT(EXTRUDERS, _HAS_E_TEMP))
#define TEMP_SENSOR_IS_MAX_TC(T) (TEMP_SENSOR_##T == -5 || TEMP_SENSOR_##T == -3 || TEMP_SENSOR_##T == -2)
+5 -1
View File
@@ -688,7 +688,7 @@ struct XYZEval {
FI const T& operator[](const int n) const { return pos[n]; }
// Assignment operator overrides do the expected thing
FI XYZEval<T>& operator= (const T v) { set(LIST_N_1(NUM_AXES, v)); return *this; }
FI XYZEval<T>& operator= (const T v) { set(LOGICAL_AXIS_LIST_1(v)); return *this; }
FI XYZEval<T>& operator= (const XYval<T> &rs) { set(rs.x, rs.y); return *this; }
FI XYZEval<T>& operator= (const XYZval<T> &rs) { set(NUM_AXIS_ELEM(rs)); return *this; }
@@ -752,8 +752,12 @@ struct XYZEval {
// Exact comparisons. For floats a "NEAR" operation may be better.
FI bool operator==(const XYZval<T> &rs) { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
FI bool operator==(const XYZval<T> &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
FI bool operator==(const XYZEval<T> &rs) { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
FI bool operator==(const XYZEval<T> &rs) const { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); }
FI bool operator!=(const XYZval<T> &rs) { return !operator==(rs); }
FI bool operator!=(const XYZval<T> &rs) const { return !operator==(rs); }
FI bool operator!=(const XYZEval<T> &rs) { return !operator==(rs); }
FI bool operator!=(const XYZEval<T> &rs) const { return !operator==(rs); }
};
#undef _RECIP
+2 -1
View File
@@ -51,7 +51,7 @@ void safe_delay(millis_t ms) {
#include "../module/probe.h"
#include "../module/motion.h"
#include "../module/stepper.h"
#include "../module/planner.h"
#include "../libs/numtostr.h"
#include "../feature/bedlevel/bedlevel.h"
@@ -70,6 +70,7 @@ void safe_delay(millis_t ms) {
TERN_(NOZZLE_AS_PROBE, "NOZZLE_AS_PROBE")
TERN_(FIX_MOUNTED_PROBE, "FIX_MOUNTED_PROBE")
TERN_(HAS_Z_SERVO_PROBE, TERN(BLTOUCH, "BLTOUCH", "SERVO PROBE"))
TERN_(BD_SENSOR, "BD_SENSOR")
TERN_(TOUCH_MI_PROBE, "TOUCH_MI_PROBE")
TERN_(Z_PROBE_SLED, "Z_PROBE_SLED")
TERN_(Z_PROBE_ALLEN_KEY, "Z_PROBE_ALLEN_KEY")
+5
View File
@@ -59,6 +59,11 @@ void safe_delay(millis_t ms); // Delay ensuring that temperatures are
#define log_machine_info() NOOP
#endif
/**
* A restorer instance remembers a variable's value before setting a
* new value, then restores the old value when it goes out of scope.
* Put operator= on your type to get extended behavior on value change.
*/
template<typename T>
class restorer {
T& ref_;
+12
View File
@@ -54,6 +54,18 @@ void Babystep::add_mm(const AxisEnum axis, const_float_t mm) {
add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]);
}
#if ENABLED(BD_SENSOR)
void Babystep::set_mm(const AxisEnum axis, const_float_t mm) {
//if (DISABLED(BABYSTEP_WITHOUT_HOMING) && axes_should_home(_BV(axis))) return;
const int16_t distance = mm * planner.settings.axis_steps_per_mm[axis];
accum = distance; // Count up babysteps for the UI
steps[BS_AXIS_IND(axis)] = distance;
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] = distance);
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
}
#endif
void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
if (DISABLED(BABYSTEP_WITHOUT_HOMING) && axes_should_home(_BV(axis))) return;
+4
View File
@@ -63,6 +63,10 @@ public:
static void add_steps(const AxisEnum axis, const int16_t distance);
static void add_mm(const AxisEnum axis, const_float_t mm);
#if ENABLED(BD_SENSOR)
static void set_mm(const AxisEnum axis, const_float_t mm);
#endif
static bool has_steps() {
return steps[BS_AXIS_IND(X_AXIS)] || steps[BS_AXIS_IND(Y_AXIS)] || steps[BS_AXIS_IND(Z_AXIS)];
}
+195
View File
@@ -0,0 +1,195 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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/MarlinConfig.h"
#if ENABLED(BD_SENSOR)
#include "../../../MarlinCore.h"
#include "../../../gcode/gcode.h"
#include "../../../module/settings.h"
#include "../../../module/motion.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/probe.h"
#include "../../../module/temperature.h"
#include "../../../module/endstops.h"
#include "../../babystep.h"
// I2C software Master library for segment bed heating and bed distance sensor
#include <Panda_segmentBed_I2C.h>
#include "bdl.h"
BDS_Leveling bdl;
//#define DEBUG_OUT_BD
// M102 S-5 Read raw Calibrate data
// M102 S-6 Start Calibrate
// M102 S4 Set the adjustable Z height value (e.g., 'M102 S4' means it will do adjusting while the Z height <= 0.4mm , disable with 'M102 S0'.)
// M102 S-1 Read sensor information
#define MAX_BD_HEIGHT 4.0f
#define CMD_START_READ_CALIBRATE_DATA 1017
#define CMD_END_READ_CALIBRATE_DATA 1018
#define CMD_START_CALIBRATE 1019
#define CMD_END_CALIBRATE 1021
#define CMD_READ_VERSION 1016
I2C_SegmentBED BD_I2C_SENSOR;
#define BD_SENSOR_I2C_ADDR 0x3C
int8_t BDS_Leveling::config_state;
uint8_t BDS_Leveling::homing;
void BDS_Leveling::echo_name() { SERIAL_ECHOPGM("Bed Distance Leveling"); }
void BDS_Leveling::init(uint8_t _sda, uint8_t _scl, uint16_t delay_s) {
int ret = BD_I2C_SENSOR.i2c_init(_sda, _scl, BD_SENSOR_I2C_ADDR, delay_s);
if (ret != 1) SERIAL_ECHOLNPGM("BD_I2C_SENSOR Init Fail return code:", ret);
config_state = 0;
}
float BDS_Leveling::read() {
const uint16_t tmp = BD_I2C_SENSOR.BD_i2c_read();
float BD_z = NAN;
if (BD_I2C_SENSOR.BD_Check_OddEven(tmp) && (tmp & 0x3FF) < 1020)
BD_z = (tmp & 0x3FF) / 100.0f;
return BD_z;
}
void BDS_Leveling::process() {
//if (config_state == 0) return;
static millis_t next_check_ms = 0; // starting at T=0
static float z_pose = 0.0f;
const millis_t ms = millis();
if (ELAPSED(ms, next_check_ms)) { // timed out (or first run)
next_check_ms = ms + (config_state < 0 ? 1000 : 100); // check at 1Hz or 10Hz
unsigned short tmp = 0;
const float cur_z = planner.get_axis_position_mm(Z_AXIS); //current_position.z
static float old_cur_z = cur_z,
old_buf_z = current_position.z;
tmp = BD_I2C_SENSOR.BD_i2c_read();
if (BD_I2C_SENSOR.BD_Check_OddEven(tmp) && (tmp & 0x3FF) < 1020) {
const float z_sensor = (tmp & 0x3FF) / 100.0f;
if (cur_z < 0) config_state = 0;
//float abs_z = current_position.z > cur_z ? (current_position.z - cur_z) : (cur_z - current_position.z);
if ( cur_z < config_state * 0.1f
&& config_state > 0
&& old_cur_z == cur_z
&& old_buf_z == current_position.z
&& z_sensor < (MAX_BD_HEIGHT)
) {
babystep.set_mm(Z_AXIS, cur_z - z_sensor);
#if ENABLED(DEBUG_OUT_BD)
SERIAL_ECHOLNPGM("BD:", z_sensor, ", Z:", cur_z, "|", current_position.z);
#endif
}
else {
babystep.set_mm(Z_AXIS, 0);
//if (old_cur_z <= cur_z) Z_DIR_WRITE(!INVERT_Z_DIR);
stepper.set_directions();
}
old_cur_z = cur_z;
old_buf_z = current_position.z;
endstops.bdp_state_update(z_sensor <= 0.01f);
//endstops.update();
}
else
stepper.set_directions();
#if ENABLED(DEBUG_OUT_BD)
SERIAL_ECHOLNPGM("BD:", tmp & 0x3FF, ", Z:", cur_z, "|", current_position.z);
if (BD_I2C_SENSOR.BD_Check_OddEven(tmp) == 0) SERIAL_ECHOLNPGM("errorCRC");
#endif
if ((tmp & 0x3FF) > 1020) {
BD_I2C_SENSOR.BD_i2c_stop();
safe_delay(10);
}
// read raw calibrate data
if (config_state == -5) {
BD_I2C_SENSOR.BD_i2c_write(CMD_START_READ_CALIBRATE_DATA);
safe_delay(1000);
for (int i = 0; i < MAX_BD_HEIGHT * 10; i++) {
tmp = BD_I2C_SENSOR.BD_i2c_read();
SERIAL_ECHOLNPGM("Calibrate data:", i, ",", tmp & 0x3FF, ", check:", BD_I2C_SENSOR.BD_Check_OddEven(tmp));
safe_delay(500);
}
config_state = 0;
BD_I2C_SENSOR.BD_i2c_write(CMD_END_READ_CALIBRATE_DATA);
safe_delay(500);
}
else if (config_state <= -6) { // Start Calibrate
safe_delay(100);
if (config_state == -6) {
//BD_I2C_SENSOR.BD_i2c_write(1019); // begin calibrate
//delay(1000);
gcode.stepper_inactive_time = SEC_TO_MS(60 * 5);
gcode.process_subcommands_now(F("M17 Z"));
gcode.process_subcommands_now(F("G1 Z0.0"));
z_pose = 0;
safe_delay(1000);
BD_I2C_SENSOR.BD_i2c_write(CMD_START_CALIBRATE); // Begin calibrate
SERIAL_ECHOLNPGM("Begin calibrate");
safe_delay(2000);
config_state = -7;
}
else if (planner.get_axis_position_mm(Z_AXIS) < 10.0f) {
if (z_pose >= MAX_BD_HEIGHT) {
BD_I2C_SENSOR.BD_i2c_write(CMD_END_CALIBRATE); // End calibrate
SERIAL_ECHOLNPGM("End calibrate data");
z_pose = 7;
config_state = 0;
safe_delay(1000);
}
else {
float tmp_k = 0;
char tmp_1[30];
sprintf_P(tmp_1, PSTR("G1 Z%d.%d"), int(z_pose), int(int(z_pose * 10) % 10));
gcode.process_subcommands_now(tmp_1);
SERIAL_ECHO(tmp_1);
SERIAL_ECHOLNPGM(" ,Z:", current_position.z);
while (tmp_k < (z_pose - 0.1f)) {
tmp_k = planner.get_axis_position_mm(Z_AXIS);
safe_delay(1);
}
safe_delay(800);
tmp = (z_pose + 0.0001f) * 10;
BD_I2C_SENSOR.BD_i2c_write(tmp);
SERIAL_ECHOLNPGM("w:", tmp, ",Zpose:", z_pose);
z_pose += 0.1001f;
//queue.enqueue_now_P(PSTR("G90"));
}
}
}
}
}
#endif // BD_SENSOR
+36
View File
@@ -0,0 +1,36 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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>
class BDS_Leveling {
public:
static int8_t config_state;
static uint8_t homing;
static void echo_name();
static void init(uint8_t _sda, uint8_t _scl, uint16_t delay_s);
static void process();
static float read();
};
extern BDS_Leveling bdl;
+1 -1
View File
@@ -154,7 +154,7 @@ void reset_bed_level() {
#endif
LOOP_L_N(x, sx) {
SERIAL_CHAR(' ');
const float offset = values[x * sx + y];
const float offset = values[x * sy + y];
if (!isnan(offset)) {
if (offset >= 0) SERIAL_CHAR('+');
SERIAL_ECHO_F(offset, int(precision));
@@ -31,7 +31,6 @@
#include "../../../libs/hex_print.h"
#include "../../../module/settings.h"
#include "../../../lcd/marlinui.h"
#include "../../../module/stepper.h"
#include "../../../module/planner.h"
#include "../../../module/motion.h"
#include "../../../module/probe.h"
@@ -26,7 +26,6 @@
#include "../bedlevel.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/motion.h"
#if ENABLED(DELTA)
@@ -11,7 +11,6 @@
#include "dac_dac084s085.h"
#include "../../MarlinCore.h"
#include "../../module/stepper.h"
#include "../../HAL/shared/Delay.h"
dac084s085::dac084s085() { }
+10 -9
View File
@@ -143,14 +143,16 @@ namespace DirectStepping {
// special case for 8-bit, check if rolled back to 0
if (Cfg::DIRECTIONAL || !write_page_size) { // full 256 bytes
if (write_byte_idx) return true;
} else {
if (write_byte_idx < write_page_size) return true;
}
} else if (Cfg::DIRECTIONAL) {
if (write_byte_idx != Cfg::PAGE_SIZE) return true;
} else {
if (write_byte_idx < write_page_size) return true;
else if (write_byte_idx < write_page_size)
return true;
}
else if (Cfg::DIRECTIONAL) {
if (write_byte_idx != Cfg::PAGE_SIZE)
return true;
}
else if (write_byte_idx < write_page_size)
return true;
state = State::CHECKSUM;
return true;
@@ -161,11 +163,10 @@ namespace DirectStepping {
return true;
}
case State::UNFAIL:
if (c == 0) {
if (c == 0)
set_page_state(write_page_idx, PageState::FREE);
} else {
else
fatal_error = true;
}
state = State::MONITOR;
return true;
}
-1
View File
@@ -34,7 +34,6 @@ FWRetract fwretract; // Single instance - this calls the constructor
#include "../module/motion.h"
#include "../module/planner.h"
#include "../module/stepper.h"
#include "../gcode/gcode.h"
+8
View File
@@ -131,6 +131,13 @@ public:
// Accessors
static uint16_t pixels() { return adaneo1.numPixels() * TERN1(NEOPIXEL2_INSERIES, 2); }
static uint32_t pixel_color(const uint16_t n) {
#if ENABLED(NEOPIXEL2_INSERIES)
if (n >= NEOPIXEL_PIXELS) return adaneo2.getPixelColor(n - (NEOPIXEL_PIXELS));
#endif
return adaneo1.getPixelColor(n);
}
static uint8_t brightness() { return adaneo1.getBrightness(); }
static uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED, uint8_t w)) {
@@ -174,6 +181,7 @@ extern Marlin_NeoPixel neo;
// Accessors
static uint16_t pixels() { return adaneo.numPixels();}
static uint32_t pixel_color(const uint16_t n) { return adaneo.getPixelColor(n); }
static uint8_t brightness() { return adaneo.getBrightness(); }
static uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED2, uint8_t w)) {
return adaneo.Color(r, g, b OPTARG(HAS_WHITE_LED2, w));
-1
View File
@@ -44,7 +44,6 @@
#include "max7219.h"
#include "../module/planner.h"
#include "../module/stepper.h"
#include "../MarlinCore.h"
#include "../HAL/shared/Delay.h"
+6 -3
View File
@@ -35,10 +35,13 @@
#include "../gcode/gcode.h"
#include "../module/motion.h"
#include "../module/planner.h"
#include "../module/stepper.h"
#include "../module/printcounter.h"
#include "../module/temperature.h"
#if HAS_EXTRUDERS
#include "../module/stepper.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "bedlevel/bedlevel.h"
#endif
@@ -63,7 +66,7 @@
#include "../lcd/marlinui.h"
#if HAS_BUZZER
#if HAS_SOUND
#include "../libs/buzzer.h"
#endif
@@ -98,7 +101,7 @@ fil_change_settings_t fc_settings[EXTRUDERS];
#define _PMSG(L) L##_LCD
#endif
#if HAS_BUZZER
#if HAS_SOUND
static void impatient_beep(const int8_t max_beep_count, const bool restart=false) {
if (TERN0(HAS_MARLINUI_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return;
+2 -1
View File
@@ -30,7 +30,7 @@
#include "power.h"
#include "../module/planner.h"
#include "../module/stepper.h"
#include "../module/stepper/indirection.h" // for restore_stepper_drivers
#include "../module/temperature.h"
#include "../MarlinCore.h"
@@ -46,6 +46,7 @@ Power powerManager;
bool Power::psu_on;
#if ENABLED(AUTO_POWER_CONTROL)
#include "../module/stepper.h"
#include "../module/temperature.h"
#if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
+7 -3
View File
@@ -67,7 +67,7 @@ cutter_frequency_t SpindleLaser::frequency; // PWM fre
void SpindleLaser::init() {
#if ENABLED(SPINDLE_SERVO)
servo[SPINDLE_SERVO_NR].move(SPINDLE_SERVO_MIN);
#else
#elif PIN_EXISTS(SPINDLE_LASER_ENA)
OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Init spindle to off
#endif
#if ENABLED(SPINDLE_CHANGE_DIR)
@@ -104,12 +104,16 @@ void SpindleLaser::init() {
}
void SpindleLaser::set_ocr(const uint8_t ocr) {
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Cutter ON
#if PIN_EXISTS(SPINDLE_LASER_ENA)
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Cutter ON
#endif
_set_ocr(ocr);
}
void SpindleLaser::ocr_off() {
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF
#if PIN_EXISTS(SPINDLE_LASER_ENA)
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF
#endif
_set_ocr(0);
}
#endif // SPINDLE_LASER_USE_PWM
+14 -13
View File
@@ -197,7 +197,7 @@ public:
* - For CUTTER_MODE_ERROR set the output enable_state flag directly and set power to 0 for any mode.
* This mode allows a global power shutdown action to occur.
*/
static void set_enabled(const bool enable) {
static void set_enabled(bool enable) {
switch (cutter_mode) {
case CUTTER_MODE_STANDARD:
apply_power(enable ? TERN(SPINDLE_LASER_USE_PWM, (power ?: (unitPower ? upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)) : 0)), 255) : 0);
@@ -209,7 +209,7 @@ public:
TERN_(LASER_FEATURE, set_inline_enabled(enable));
break;
case CUTTER_MODE_ERROR: // Error mode, no enable and kill power.
enable_state = false;
enable = false;
apply_power(0);
}
#if SPINDLE_LASER_ENA_PIN
@@ -279,13 +279,14 @@ public:
#if ENABLED(LASER_FEATURE)
// Toggle the laser on/off with menuPower. Apply SPEED_POWER_STARTUP if it was 0 on entry.
static void laser_menu_toggle(const bool state) {
static void menu_set_enabled(const bool state) {
set_enabled(state);
if (state) {
if (!menuPower) menuPower = cpwr_to_upwr(SPEED_POWER_STARTUP);
power = upower_to_ocr(menuPower);
apply_power(power);
}
} else
apply_power(0);
}
/**
@@ -294,11 +295,11 @@ public:
* If not set defaults to 80% power
*/
static void test_fire_pulse() {
TERN_(HAS_BEEPER, buzzer.tone(30, 3000));
cutter_mode = CUTTER_MODE_STANDARD;// Menu needs standard mode.
laser_menu_toggle(true); // Laser On
delay(testPulse); // Delay for time set by user in pulse ms menu screen.
laser_menu_toggle(false); // Laser Off
BUZZ(30, 3000);
cutter_mode = CUTTER_MODE_STANDARD; // Menu needs standard mode.
menu_set_enabled(true); // Laser On
delay(testPulse); // Delay for time set by user in pulse ms menu screen.
menu_set_enabled(false); // Laser Off
}
#endif // LASER_FEATURE
@@ -308,14 +309,14 @@ public:
// Dynamic mode rate calculation
static uint8_t calc_dynamic_power() {
if (feedrate_mm_m > 65535) return 255; // Too fast, go always on
uint16_t rate = uint16_t(feedrate_mm_m); // 16 bits from the G-code parser float input
rate >>= 8; // Take the G-code input e.g. F40000 and shift off the lower bits to get an OCR value from 1-255
if (feedrate_mm_m > 65535) return 255; // Too fast, go always on
uint16_t rate = uint16_t(feedrate_mm_m); // 16 bits from the G-code parser float input
rate >>= 8; // Take the G-code input e.g. F40000 and shift off the lower bits to get an OCR value from 1-255
return uint8_t(rate);
}
// Inline modes of all other functions; all enable planner inline power control
static void set_inline_enabled(const bool enable) { planner.laser_inline.status.isEnabled = enable;}
static void set_inline_enabled(const bool enable) { planner.laser_inline.status.isEnabled = enable; }
// Set the power for subsequent movement blocks
static void inline_power(const cutter_power_t cpwr) {
-5
View File
@@ -33,17 +33,12 @@
#include "../gcode/gcode.h"
#if ENABLED(TMC_DEBUG)
#include "../module/planner.h"
#include "../libs/hex_print.h"
#if ENABLED(MONITOR_DRIVER_STATUS)
static uint16_t report_tmc_status_interval; // = 0
#endif
#endif
#if HAS_MARLINUI_MENU
#include "../module/stepper.h"
#endif
/**
* Check for over temperature or short to ground error flags.
* Report and log warning of overtemperature condition.
-1
View File
@@ -107,7 +107,6 @@
#include "../../MarlinCore.h"
#include "../../module/planner.h"
#include "../../module/stepper.h"
#include "../../module/motion.h"
#include "../../module/tool_change.h"
#include "../../module/temperature.h"
-1
View File
@@ -32,7 +32,6 @@
#include "../../../feature/bedlevel/bedlevel.h"
#include "../../../module/motion.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/probe.h"
#include "../../queue.h"
+1 -1
View File
@@ -36,7 +36,7 @@
#include "../../../libs/buzzer.h"
#include "../../../lcd/marlinui.h"
#include "../../../module/motion.h"
#include "../../../module/stepper.h"
#include "../../../module/planner.h"
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
+9 -2
View File
@@ -24,8 +24,9 @@
#include "../gcode.h"
#include "../../module/stepper.h"
#include "../../module/endstops.h"
#include "../../module/planner.h"
#include "../../module/stepper.h" // for various
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
@@ -35,6 +36,10 @@
#include "../../feature/bedlevel/bedlevel.h"
#endif
#if ENABLED(BD_SENSOR)
#include "../../feature/bedlevel/bdl/bdl.h"
#endif
#if ENABLED(SENSORLESS_HOMING)
#include "../../feature/tmc_util.h"
#endif
@@ -201,7 +206,9 @@ void GcodeSuite::G28() {
DEBUG_SECTION(log_G28, "G28", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) log_machine_info();
/*
TERN_(BD_SENSOR, bdl.config_state = 0);
/**
* Set the laser power to false to stop the planner from processing the current power setting.
*/
#if ENABLED(LASER_FEATURE)
+1 -1
View File
@@ -27,7 +27,7 @@
#include "../gcode.h"
#include "../../module/delta.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
#include "../../module/endstops.h"
#include "../../lcd/marlinui.h"
+4 -1
View File
@@ -26,9 +26,12 @@
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/endstops.h"
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_TRINAMIC_CONFIG)
#include "../../module/stepper.h"
#endif
#if HAS_LEVELING
#include "../../feature/bedlevel/bedlevel.h"
#endif
+4 -2
View File
@@ -224,13 +224,15 @@ void GcodeSuite::G34() {
// Safe clearance even on an incline
if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe);
xy_pos_t &ppos = z_stepper_align.xy[iprobe];
if (DEBUGGING(LEVELING))
DEBUG_ECHOLNPGM_P(PSTR("Probing X"), z_stepper_align.xy[iprobe].x, SP_Y_STR, z_stepper_align.xy[iprobe].y);
DEBUG_ECHOLNPGM_P(PSTR("Probing X"), ppos.x, SP_Y_STR, ppos.y);
// Probe a Z height for each stepper.
// Probing sanity check is disabled, as it would trigger even in normal cases because
// current_position.z has been manually altered in the "dirty trick" above.
const float z_probed_height = probe.probe_at_point(RAW_X_POSITION(z_stepper_align.xy[iprobe].x), RAW_Y_POSITION(z_stepper_align.xy[iprobe].y), raise_after, 0, true, false);
const float z_probed_height = probe.probe_at_point(DIFF_TERN(HAS_HOME_OFFSET, ppos, xy_pos_t(home_offset)), raise_after, 0, true, false);
if (isnan(z_probed_height)) {
SERIAL_ECHOLNPGM("Probing failed");
LCD_MESSAGE(MSG_LCD_PROBING_FAILED);
+1 -1
View File
@@ -25,7 +25,7 @@
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
#include "../gcode.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
/**
* M540: Set whether SD card print should abort on endstop hit (M540 S<0|1>)
+1
View File
@@ -24,6 +24,7 @@
#include "../../MarlinCore.h" // for stepper_inactive_time, disable_e_steppers
#include "../../lcd/marlinui.h"
#include "../../module/motion.h" // for e_axis_mask
#include "../../module/planner.h"
#include "../../module/stepper.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
+1 -1
View File
@@ -26,7 +26,7 @@
#include "../gcode.h"
#include "../../MarlinCore.h" // for pin_is_protected and idle()
#include "../../module/stepper.h"
#include "../../module/planner.h"
void protected_pin_err();
+1 -1
View File
@@ -26,7 +26,7 @@
#include "../gcode.h"
#include "../../feature/spindle_laser.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
/**
* Laser:
+1 -1
View File
@@ -21,7 +21,7 @@
*/
#include "../gcode.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
/**
* M400: Finish all moves
-1
View File
@@ -28,7 +28,6 @@
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/tool_change.h"
#include "../../module/planner.h"
@@ -26,7 +26,6 @@
#include "../../gcode.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#if ENABLED(EXTRA_LIN_ADVANCE_K)
float other_extruder_advance_K[EXTRUDERS];
+13 -8
View File
@@ -31,11 +31,13 @@
* M150: Set Status LED Color - Use R-U-B-W for R-G-B-W
* and Brightness - Use P (for NEOPIXEL only)
*
* Always sets all 3 or 4 components. If a component is left out, set to 0.
* If brightness is left out, no value changed
* Always sets all 3 or 4 components unless the K flag is specified.
* If a component is left out, set to 0.
* If brightness is left out, no value changed.
*
* With NEOPIXEL_LED:
* I<index> Set the NeoPixel index to affect. Default: All
* K Keep all unspecified values unchanged instead of setting to 0.
*
* With NEOPIXEL2_SEPARATE:
* S<index> The NeoPixel strip to set. Default: All.
@@ -51,16 +53,19 @@
* M150 P ; Set LED full brightness
* M150 I1 R ; Set NEOPIXEL index 1 to red
* M150 S1 I1 R ; Set SEPARATE index 1 to red
* M150 K R127 ; Set LED red to 50% without changing blue or green
*/
void GcodeSuite::M150() {
int32_t old_color = 0;
#if ENABLED(NEOPIXEL_LED)
const pixel_index_t index = parser.intval('I', -1);
#if ENABLED(NEOPIXEL2_SEPARATE)
int8_t brightness = neo.brightness(), unit = parser.intval('S', -1);
switch (unit) {
case -1: neo2.neoindex = index; // fall-thru
case 0: neo.neoindex = index; break;
case 1: neo2.neoindex = index; brightness = neo2.brightness(); break;
case 0: neo.neoindex = index; old_color = parser.seen('K') ? neo.pixel_color(index >= 0 ? index : 0) : 0; break;
case 1: neo2.neoindex = index; brightness = neo2.brightness(); old_color = parser.seen('K') ? neo2.pixel_color(index >= 0 ? index : 0) : 0; break;
}
#else
const uint8_t brightness = neo.brightness();
@@ -69,10 +74,10 @@ void GcodeSuite::M150() {
#endif
const LEDColor color = LEDColor(
parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : 0,
parser.seen('U') ? (parser.has_value() ? parser.value_byte() : 255) : 0,
parser.seen('B') ? (parser.has_value() ? parser.value_byte() : 255) : 0
OPTARG(HAS_WHITE_LED, parser.seen('W') ? (parser.has_value() ? parser.value_byte() : 255) : 0)
parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 16) & 0xFF,
parser.seen('U') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 8) & 0xFF,
parser.seen('B') ? (parser.has_value() ? parser.value_byte() : 255) : old_color & 0xFF
OPTARG(HAS_WHITE_LED, parser.seen('W') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 24) & 0xFF)
OPTARG(NEOPIXEL_LED, parser.seen('P') ? (parser.has_value() ? parser.value_byte() : 255) : brightness)
);
+6 -6
View File
@@ -71,12 +71,12 @@ void GcodeSuite::M125() {
if (parser.seenval('X')) park_point.x = RAW_X_POSITION(parser.linearval('X')),
if (parser.seenval('Y')) park_point.y = RAW_Y_POSITION(parser.linearval('Y')),
NOOP,
if (parser.seenval(AXIS4_NAME)) park_point.i = RAW_X_POSITION(parser.linearval(AXIS4_NAME)),
if (parser.seenval(AXIS5_NAME)) park_point.j = RAW_X_POSITION(parser.linearval(AXIS5_NAME)),
if (parser.seenval(AXIS6_NAME)) park_point.k = RAW_X_POSITION(parser.linearval(AXIS6_NAME)),
if (parser.seenval(AXIS7_NAME)) park_point.u = RAW_X_POSITION(parser.linearval(AXIS7_NAME)),
if (parser.seenval(AXIS8_NAME)) park_point.v = RAW_X_POSITION(parser.linearval(AXIS8_NAME)),
if (parser.seenval(AXIS9_NAME)) park_point.w = RAW_X_POSITION(parser.linearval(AXIS9_NAME))
if (parser.seenval(AXIS4_NAME)) park_point.i = RAW_I_POSITION(parser.linearval(AXIS4_NAME)),
if (parser.seenval(AXIS5_NAME)) park_point.j = RAW_J_POSITION(parser.linearval(AXIS5_NAME)),
if (parser.seenval(AXIS6_NAME)) park_point.k = RAW_K_POSITION(parser.linearval(AXIS6_NAME)),
if (parser.seenval(AXIS7_NAME)) park_point.u = RAW_U_POSITION(parser.linearval(AXIS7_NAME)),
if (parser.seenval(AXIS8_NAME)) park_point.v = RAW_V_POSITION(parser.linearval(AXIS8_NAME)),
if (parser.seenval(AXIS9_NAME)) park_point.w = RAW_W_POSITION(parser.linearval(AXIS9_NAME))
);
// Lift Z axis
@@ -35,6 +35,8 @@
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../../../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented
#endif
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
@@ -69,6 +71,8 @@ void GcodeSuite::M1000() {
ui.goto_screen(menu_job_recovery);
#elif HAS_DWIN_E3V2_BASIC
recovery.dwin_flag = true;
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
CrealityDWIN.Popup_Handler(Resume);
#elif ENABLED(EXTENSIBLE_UI)
ExtUI::onPowerLossResume();
#else
+1 -1
View File
@@ -26,7 +26,7 @@
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
#include "../../../module/stepper/indirection.h"
#include "../../../module/stepper/indirection.h" // for restore_stepper_drivers
/**
* M122: Debug TMC drivers
+6 -2
View File
@@ -233,7 +233,7 @@ void GcodeSuite::get_destination_from_command() {
if (WITHIN(parser.codenum, 1, TERN(ARC_SUPPORT, 3, 1)) || TERN0(BEZIER_CURVE_SUPPORT, parser.codenum == 5)) {
planner.laser_inline.status.isPowered = true;
if (parser.seen('I')) cutter.set_enabled(true); // This is set for backward LightBurn compatibility.
if (parser.seen('S')) {
if (parser.seenval('S')) {
const float v = parser.value_float(),
u = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v));
cutter.menuPower = cutter.unitPower = u;
@@ -577,6 +577,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 100: M100(); break; // M100: Free Memory Report
#endif
#if ENABLED(BD_SENSOR)
case 102: M102(); break; // M102: Configure Bed Distance Sensor
#endif
#if HAS_EXTRUDERS
case 104: M104(); break; // M104: Set hot end temperature
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
@@ -765,7 +769,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 290: M290(); break; // M290: Babystepping
#endif
#if HAS_BUZZER
#if HAS_SOUND
case 300: M300(); break; // M300: Play beep tone
#endif
+8 -1
View File
@@ -132,6 +132,8 @@
*
* M100 - Watch Free Memory (for debugging) (Requires M100_FREE_MEMORY_WATCHER)
*
* M102 - Configure Bed Distance Sensor. (Requires BD_SENSOR)
*
* M104 - Set extruder target temp.
* M105 - Report current temperatures.
* M106 - Set print fan speed.
@@ -705,6 +707,11 @@ private:
static void M100();
#endif
#if ENABLED(BD_SENSOR)
static void M102();
static void M102_report(const bool forReplay=true);
#endif
#if HAS_EXTRUDERS
static void M104_M109(const bool isM109);
FORCE_INLINE static void M104() { M104_M109(false); }
@@ -914,7 +921,7 @@ private:
static void M290();
#endif
#if HAS_BUZZER
#if HAS_SOUND
static void M300();
#endif
-2
View File
@@ -25,8 +25,6 @@
#if ENABLED(CNC_COORDINATE_SYSTEMS)
#include "../../module/stepper.h"
//#define DEBUG_M53
/**
-1
View File
@@ -22,7 +22,6 @@
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#if ENABLED(I2C_POSITION_ENCODERS)
#include "../../feature/encoder_i2c.h"
+2 -2
View File
@@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h"
#if HAS_BUZZER
#if HAS_SOUND
#include "../gcode.h"
@@ -42,4 +42,4 @@ void GcodeSuite::M300() {
BUZZ(duration, frequency);
}
#endif // HAS_BUZZER
#endif // HAS_SOUND
+1 -1
View File
@@ -32,7 +32,7 @@
#include "../../sd/cardreader.h"
#if ENABLED(NANODLP_Z_SYNC)
#include "../../module/stepper.h"
#include "../../module/planner.h"
#endif
extern xyze_pos_t destination;
+2
View File
@@ -364,6 +364,8 @@ void plan_arc(
if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints))
break;
hints.curve_radius = radius;
}
}
+1 -1
View File
@@ -21,7 +21,7 @@
*/
#include "../gcode.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
#include "../../lcd/marlinui.h"
/**
+12 -14
View File
@@ -256,22 +256,20 @@ public:
// Float removes 'E' to prevent scientific notation interpretation
static float value_float() {
if (value_ptr) {
char *e = value_ptr;
for (;;) {
const char c = *e;
if (c == '\0' || c == ' ') break;
if (c == 'E' || c == 'e') {
*e = '\0';
const float ret = strtof(value_ptr, nullptr);
*e = c;
return ret;
}
++e;
if (!value_ptr) return 0;
char *e = value_ptr;
for (;;) {
const char c = *e;
if (c == '\0' || c == ' ') break;
if (c == 'E' || c == 'e' || c == 'X' || c == 'x') {
*e = '\0';
const float ret = strtof(value_ptr, nullptr);
*e = c;
return ret;
}
return strtof(value_ptr, nullptr);
++e;
}
return 0;
return strtof(value_ptr, nullptr);
}
// Code value as a long or ulong
+43 -29
View File
@@ -33,7 +33,11 @@
#include "../../feature/probe_temp_comp.h"
#endif
#if ENABLED(DWIN_LCD_PROUI)
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/marlinui.h"
#endif
@@ -49,6 +53,11 @@
*/
void GcodeSuite::G30() {
#if HAS_MULTI_HOTEND
const uint8_t old_tool_index = active_extruder;
tool_change(0);
#endif
const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x),
parser.linearval('Y', current_position.y + probe.offset_xy.y) };
@@ -57,40 +66,45 @@ void GcodeSuite::G30() {
SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT));
LCD_MESSAGE(MSG_ZPROBE_OUT);
#endif
return;
}
else {
// Disable leveling so the planner won't mess with us
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
// Disable leveling so the planner won't mess with us
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
remember_feedrate_scaling_off();
remember_feedrate_scaling_off();
TERN_(DWIN_LCD_PROUI, process_subcommands_now(F("G28O")));
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
TERN_(HAS_PTC, ptc.set_enabled(true));
if (!isnan(measured_z)) {
SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
#if ENABLED(DWIN_LCD_PROUI)
char msg[31], str_1[6], str_2[6], str_3[6];
sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"),
dtostrf(pos.x, 1, 1, str_1),
dtostrf(pos.y, 1, 1, str_2),
dtostrf(measured_z, 1, 2, str_3)
);
ui.set_status(msg);
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
process_subcommands_now(F("G28O"));
#endif
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
TERN_(HAS_PTC, ptc.set_enabled(true));
if (!isnan(measured_z)) {
SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
char msg[31], str_1[6], str_2[6], str_3[6];
sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"),
dtostrf(pos.x, 1, 1, str_1),
dtostrf(pos.y, 1, 1, str_2),
dtostrf(measured_z, 1, 2, str_3)
);
ui.set_status(msg);
#endif
}
restore_feedrate_and_scaling();
if (raise_after == PROBE_PT_STOW)
probe.move_z_after_probing();
report_current_position();
}
restore_feedrate_and_scaling();
if (raise_after == PROBE_PT_STOW)
probe.move_z_after_probing();
report_current_position();
// Restore the active tool
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index));
}
#endif // HAS_BED_PROBE
+1 -1
View File
@@ -28,7 +28,7 @@
#include "../../module/endstops.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
inline void G38_single_probe(const uint8_t move_value) {
+57
View File
@@ -0,0 +1,57 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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/>.
*
*/
/**
* M102.cpp - Configure Bed Distance Sensor
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(BD_SENSOR)
#include "../gcode.h"
#include "../../feature/bedlevel/bdl/bdl.h"
/**
* M102: Configure the Bed Distance Sensor
*
* M102 S<10ths> : Set adjustable Z height in 10ths of a mm (e.g., 'M102 S4' enables adjusting for Z <= 0.4mm.)
* M102 S0 : Disable adjustable Z height.
*
* Negative S values are commands:
* M102 S-1 : Read sensor information
* M102 S-5 : Read raw Calibration data
* M102 S-6 : Start Calibration
*/
void GcodeSuite::M102() {
if (parser.seenval('S'))
bdl.config_state = parser.value_int();
else
M102_report();
}
void GcodeSuite::M102_report(const bool forReplay/*=true*/) {
report_heading(forReplay, F("Bed Distance Sensor"));
SERIAL_ECHOLNPGM(" M102 S", bdl.config_state);
}
#endif // BD_SENSOR
+1 -1
View File
@@ -48,7 +48,7 @@
void GcodeSuite::M303() {
#if ANY(PID_DEBUG, PID_BED_DEBUG, PID_CHAMBER_DEBUG)
#if HAS_PID_DEBUG
if (parser.seen_test('D')) {
thermalManager.pid_debug_flag ^= true;
SERIAL_ECHO_START();
+65 -5
View File
@@ -477,6 +477,8 @@
// Aliases for LCD features
#if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI)
#define HAS_DWIN_E3V2_BASIC 1
#endif
#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
#define HAS_DWIN_E3V2 1
#endif
#if ENABLED(DWIN_LCD_PROUI)
@@ -506,7 +508,7 @@
#endif
#endif
#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI)
#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
#define HAS_DISPLAY 1
#endif
@@ -526,7 +528,7 @@
#define HAS_MANUAL_MOVE_MENU 1
#endif
#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI)
#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI)
#define CAN_SHOW_REMAINING_TIME 1
#endif
@@ -666,6 +668,31 @@
#define E_MANUAL EXTRUDERS
#endif
#if E_STEPPERS <= 7
#undef INVERT_E7_DIR
#if E_STEPPERS <= 6
#undef INVERT_E6_DIR
#if E_STEPPERS <= 5
#undef INVERT_E5_DIR
#if E_STEPPERS <= 4
#undef INVERT_E4_DIR
#if E_STEPPERS <= 3
#undef INVERT_E3_DIR
#if E_STEPPERS <= 2
#undef INVERT_E2_DIR
#if E_STEPPERS <= 1
#undef INVERT_E1_DIR
#if E_STEPPERS == 0
#undef INVERT_E0_DIR
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
/**
* Number of Linear Axes (e.g., XYZIJKUVW)
* All the logical axes except for the tool (E) axis
@@ -766,6 +793,9 @@
#undef Y_MIN_POS
#undef Y_MAX_POS
#undef MANUAL_Y_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_Y
#undef MAX_SOFTWARE_ENDSTOP_Y
#undef SAFE_BED_LEVELING_START_Y
#endif
#if !HAS_Z_AXIS
@@ -783,6 +813,9 @@
#undef Z_MIN_POS
#undef Z_MAX_POS
#undef MANUAL_Z_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_Z
#undef MAX_SOFTWARE_ENDSTOP_Z
#undef SAFE_BED_LEVELING_START_Z
#endif
#if !HAS_I_AXIS
@@ -797,6 +830,9 @@
#undef I_MIN_POS
#undef I_MAX_POS
#undef MANUAL_I_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_I
#undef MAX_SOFTWARE_ENDSTOP_I
#undef SAFE_BED_LEVELING_START_I
#endif
#if !HAS_J_AXIS
@@ -811,6 +847,9 @@
#undef J_MIN_POS
#undef J_MAX_POS
#undef MANUAL_J_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_J
#undef MAX_SOFTWARE_ENDSTOP_J
#undef SAFE_BED_LEVELING_START_J
#endif
#if !HAS_K_AXIS
@@ -825,6 +864,9 @@
#undef K_MIN_POS
#undef K_MAX_POS
#undef MANUAL_K_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_K
#undef MAX_SOFTWARE_ENDSTOP_K
#undef SAFE_BED_LEVELING_START_K
#endif
#if !HAS_U_AXIS
@@ -839,6 +881,9 @@
#undef U_MIN_POS
#undef U_MAX_POS
#undef MANUAL_U_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_U
#undef MAX_SOFTWARE_ENDSTOP_U
#undef SAFE_BED_LEVELING_START_U
#endif
#if !HAS_V_AXIS
@@ -853,6 +898,9 @@
#undef V_MIN_POS
#undef V_MAX_POS
#undef MANUAL_V_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_V
#undef MAX_SOFTWARE_ENDSTOP_V
#undef SAFE_BED_LEVELING_START_V
#endif
#if !HAS_W_AXIS
@@ -867,6 +915,9 @@
#undef W_MIN_POS
#undef W_MAX_POS
#undef MANUAL_W_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_W
#undef MAX_SOFTWARE_ENDSTOP_W
#undef SAFE_BED_LEVELING_START_W
#endif
#ifdef X2_DRIVER_TYPE
@@ -1052,7 +1103,7 @@
#if ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, SOLENOID_PROBE, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4, MAG_MOUNTED_PROBE)
#define HAS_STOWABLE_PROBE 1
#endif
#if ANY(HAS_STOWABLE_PROBE, HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE)
#if ANY(HAS_STOWABLE_PROBE, HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, BD_SENSOR, NOZZLE_AS_PROBE)
#define HAS_BED_PROBE 1
#endif
@@ -1380,6 +1431,10 @@
#define EXTRUDE_MINTEMP 170
#endif
#if ANY(PID_DEBUG, PID_BED_DEBUG, PID_CHAMBER_DEBUG)
#define HAS_PID_DEBUG 1
#endif
/**
* TFT Displays
*
@@ -1451,8 +1506,13 @@
#elif ENABLED(TFT_RES_1024x600)
#define TFT_WIDTH 1024
#define TFT_HEIGHT 600
#define GRAPHICAL_TFT_UPSCALE 6
#define TFT_PIXEL_OFFSET_X 120
#if ENABLED(TOUCH_SCREEN)
#define GRAPHICAL_TFT_UPSCALE 6
#define TFT_PIXEL_OFFSET_X 120
#else
#define GRAPHICAL_TFT_UPSCALE 8
#define TFT_PIXEL_OFFSET_X 0
#endif
#endif
// FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi|ltdc).h
+30 -9
View File
@@ -117,6 +117,31 @@
#undef STEALTHCHOP_E
#endif
#if HOTENDS <= 7
#undef E7_AUTO_FAN_PIN
#if HOTENDS <= 6
#undef E6_AUTO_FAN_PIN
#if HOTENDS <= 5
#undef E5_AUTO_FAN_PIN
#if HOTENDS <= 4
#undef E4_AUTO_FAN_PIN
#if HOTENDS <= 3
#undef E3_AUTO_FAN_PIN
#if HOTENDS <= 2
#undef E2_AUTO_FAN_PIN
#if HOTENDS <= 1
#undef E1_AUTO_FAN_PIN
#if HOTENDS == 0
#undef E0_AUTO_FAN_PIN
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
/**
* Temperature Sensors; define what sensor(s) we have.
*/
@@ -155,8 +180,7 @@
#define REDUNDANT_TEMP_MATCH(...) 0
#endif
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
#define TEMP_SENSOR_0_IS_MAX_TC 1
#if TEMP_SENSOR_IS_MAX_TC(0)
#if TEMP_SENSOR_0 == -5
#define TEMP_SENSOR_0_IS_MAX31865 1
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
@@ -192,8 +216,7 @@
#undef HEATER_0_MAXTEMP
#endif
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
#define TEMP_SENSOR_1_IS_MAX_TC 1
#if TEMP_SENSOR_IS_MAX_TC(1)
#if TEMP_SENSOR_1 == -5
#define TEMP_SENSOR_1_IS_MAX31865 1
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
@@ -239,9 +262,7 @@
#undef HEATER_1_MAXTEMP
#endif
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
#if TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
#if TEMP_SENSOR_REDUNDANT == -5
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
@@ -283,7 +304,7 @@
#endif
#endif
#if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
#if (TEMP_SENSOR_IS_MAX_TC(0) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_IS_MAX_TC(1) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
#if TEMP_SENSOR_REDUNDANT == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -3
@@ -305,7 +326,7 @@
#endif
#endif
#if TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC
#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
#define HAS_MAX_TC 1
#endif
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
+15 -11
View File
@@ -681,7 +681,7 @@
#if HAS_MAX_TC
// Translate old _SS, _CS, _SCK, _DO, _DI, _MISO, and _MOSI PIN defines.
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if TEMP_SENSOR_IS_MAX_TC(0) || (TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if !PIN_EXISTS(TEMP_0_CS) // SS, CS
#if PIN_EXISTS(MAX6675_SS)
@@ -748,9 +748,9 @@
#endif
#endif
#endif // TEMP_SENSOR_0_IS_MAX_TC
#endif // TEMP_SENSOR_IS_MAX_TC(0)
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if TEMP_SENSOR_IS_MAX_TC(1) || (TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if !PIN_EXISTS(TEMP_1_CS) // SS2, CS2
#if PIN_EXISTS(MAX6675_SS2)
@@ -817,7 +817,7 @@
#endif
#endif
#endif // TEMP_SENSOR_1_IS_MAX_TC
#endif // TEMP_SENSOR_IS_MAX_TC(1)
//
// User-defined thermocouple libraries
@@ -2656,7 +2656,7 @@
//
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
//
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && NONE(TEMP_SENSOR_##P##_IS_MAX_TC, TEMP_SENSOR_##P##_IS_DUMMY))
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && !TEMP_SENSOR_IS_MAX_TC(P) && !TEMP_SENSOR_##P##_IS_DUMMY)
#if HOTENDS > 0 && HAS_ADC_TEST(0)
#define HAS_TEMP_ADC_0 1
#endif
@@ -2700,7 +2700,7 @@
#define HAS_TEMP_ADC_REDUNDANT 1
#endif
#define HAS_TEMP(N) ANY(HAS_TEMP_ADC_##N, TEMP_SENSOR_##N##_IS_MAX_TC, TEMP_SENSOR_##N##_IS_DUMMY)
#define HAS_TEMP(N) (TEMP_SENSOR_IS_MAX_TC(N) || EITHER(HAS_TEMP_ADC_##N, TEMP_SENSOR_##N##_IS_DUMMY))
#if HAS_HOTEND && HAS_TEMP(0)
#define HAS_TEMP_HOTEND 1
#endif
@@ -3430,7 +3430,7 @@
* Advanced Pause - Filament Change
*/
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
#define M600_PURGE_MORE_RESUMABLE 1
#endif
#ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH
@@ -3564,8 +3564,11 @@
#if PIN_EXISTS(BEEPER)
#define HAS_BEEPER 1
#endif
#if ANY(HAS_BEEPER, LCD_USE_I2C_BUZZER, PCA9632_BUZZER)
#define HAS_BUZZER 1
#if ANY(IS_TFTGLCD_PANEL, PCA9632_BUZZER, LCD_USE_I2C_BUZZER)
#define USE_MARLINUI_BUZZER 1
#endif
#if EITHER(HAS_BEEPER, USE_MARLINUI_BUZZER)
#define HAS_SOUND 1
#endif
#if ENABLED(LCD_USE_I2C_BUZZER)
@@ -3575,7 +3578,7 @@
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
#endif
#elif HAS_BUZZER
#elif HAS_SOUND
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 5000
#endif
@@ -3584,12 +3587,13 @@
#endif
#endif
#if HAS_BUZZER
#if HAS_SOUND
#if LCD_FEEDBACK_FREQUENCY_DURATION_MS && LCD_FEEDBACK_FREQUENCY_HZ
#define HAS_CHIRP 1
#endif
#else
#undef SOUND_MENU_ITEM // No buzzer menu item without a buzzer
#undef SOUND_ON_DEFAULT
#endif
/**
+22 -18
View File
@@ -902,7 +902,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
#endif
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, HAS_DWIN_E3V2, IS_DWIN_MARLINUI)
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI."
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI."
#endif
#if ENABLED(USE_M73_REMAINING_TIME) && DISABLED(LCD_SET_PROGRESS_MANUALLY)
@@ -913,6 +913,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "SD_REPRINT_LAST_SELECTED_FILE currently requires a Marlin-native LCD menu."
#endif
#if ANY(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, EXTENSIBLE_UI) && !defined(MANUAL_FEEDRATE)
#error "MANUAL_FEEDRATE is required for MarlinUI, ExtUI, or FTDI EVE Touch UI."
#endif
/**
* Custom Boot and Status screens
*/
@@ -1715,8 +1719,8 @@ 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) \
+ 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, MAGLEV4, MAG_MOUNTED_PROBE)
#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, MAGLEV4, MAG_MOUNTED_PROBE or Z Servo."
+ COUNT_ENABLED(PROBE_MANUALLY, BLTOUCH, BD_SENSOR, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4, MAG_MOUNTED_PROBE)
#error "Please enable only one probe option: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, BD_SENSOR, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, MAGLEV4, MAG_MOUNTED_PROBE or Z Servo."
#endif
#if HAS_BED_PROBE
@@ -2225,13 +2229,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
*/
#if HAS_AUTO_FAN
#if HAS_FAN0
#if E0_AUTO_FAN_PIN == FAN_PIN
#if PIN_EXISTS(E0_AUTO_FAN) && E0_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN."
#elif E1_AUTO_FAN_PIN == FAN_PIN
#elif PIN_EXISTS(E1_AUTO_FAN) && E1_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set E1_AUTO_FAN_PIN equal to FAN_PIN."
#elif E2_AUTO_FAN_PIN == FAN_PIN
#elif PIN_EXISTS(E2_AUTO_FAN) && E2_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set E2_AUTO_FAN_PIN equal to FAN_PIN."
#elif E3_AUTO_FAN_PIN == FAN_PIN
#elif PIN_EXISTS(E3_AUTO_FAN) && E3_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set E3_AUTO_FAN_PIN equal to FAN_PIN."
#endif
#endif
@@ -2331,7 +2335,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
* Redundant temperature sensor config
*/
#if HAS_TEMP_REDUNDANT
#if !defined(TEMP_SENSOR_REDUNDANT_SOURCE)
#ifndef TEMP_SENSOR_REDUNDANT_SOURCE
#error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_SOURCE."
#elif !defined(TEMP_SENSOR_REDUNDANT_TARGET)
#error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_TARGET."
@@ -2383,9 +2387,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be COOLER without TEMP_COOLER_PIN defined."
#endif
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E0) && !PIN_EXISTS(TEMP_0_CS)
#if TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E0) && !PIN_EXISTS(TEMP_0_CS)
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE E0 requires TEMP_0_CS_PIN."
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1) && !PIN_EXISTS(TEMP_1_CS)
#elif TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E1) && !PIN_EXISTS(TEMP_1_CS)
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE E1 requires TEMP_1_CS_PIN."
#endif
#endif
@@ -2398,7 +2402,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board."
#elif HAS_EXTRUDERS && !HAS_HEATER_0
#error "HEATER_0_PIN not defined for this board."
#elif TEMP_SENSOR_0_IS_MAX_TC && !PIN_EXISTS(TEMP_0_CS)
#elif TEMP_SENSOR_IS_MAX_TC(0) && !PIN_EXISTS(TEMP_0_CS)
#error "TEMP_SENSOR_0 MAX thermocouple requires TEMP_0_CS_PIN."
#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
#error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
@@ -2407,7 +2411,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#if HAS_MULTI_HOTEND
#if TEMP_SENSOR_1_IS_MAX_TC && !PIN_EXISTS(TEMP_1_CS)
#if TEMP_SENSOR_IS_MAX_TC(1) && !PIN_EXISTS(TEMP_1_CS)
#error "TEMP_SENSOR_1 MAX thermocouple requires TEMP_1_CS_PIN."
#elif TEMP_SENSOR_1 == 0
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
@@ -2941,7 +2945,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
+ COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) \
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE, DGUS_LCD_UI_CREALITY_TOUCH) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE, DGUS_LCD_UI_CREALITY_TOUCH) \
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
@@ -3030,8 +3034,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#endif
#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 6)
#error "GRAPHICAL_TFT_UPSCALE must be between 2 and 6."
#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 8)
#error "GRAPHICAL_TFT_UPSCALE must be between 2 and 8."
#endif
#if BOTH(CHIRON_TFT_STANDARD, CHIRON_TFT_NEW)
@@ -3039,7 +3043,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#if ENABLED(ANYCUBIC_LCD_CHIRON)
#if !defined(BEEPER_PIN)
#ifndef BEEPER_PIN
#error "ANYCUBIC_LCD_CHIRON requires BEEPER_PIN"
#elif DISABLED(SDSUPPORT)
#error "ANYCUBIC_LCD_CHIRON requires SDSUPPORT"
@@ -3967,8 +3971,8 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
#define _PIN_CONFLICT(P) (PIN_EXISTS(P) && P##_PIN == SPINDLE_LASER_PWM_PIN)
#if BOTH(SPINDLE_FEATURE, LASER_FEATURE)
#error "Enable only one of SPINDLE_FEATURE or LASER_FEATURE."
#elif !PIN_EXISTS(SPINDLE_LASER_ENA) && DISABLED(SPINDLE_SERVO)
#error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
#elif NONE(SPINDLE_SERVO, SPINDLE_LASER_USE_PWM) && !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_USE_PWM, or SPINDLE_SERVO to control the power."
#elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR."
#elif ENABLED(SPINDLE_LASER_USE_PWM)
+1 -1
View File
@@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2022-07-17"
#define STRING_DISTRIBUTION_DATE "2022-08-20"
#endif
/**
+7
View File
@@ -773,3 +773,10 @@
#if MB(BTT_BTT002_V1_0, EINSY_RAMBO) && DISABLED(NO_MK3_FAN_PINS_WARNING)
#warning "Define MK3_FAN_PINS to swap hotend and part cooling fan pins. (Define NO_MK3_FAN_PINS_WARNING to suppress this warning.)"
#endif
/**
* BD Sensor should always include BABYSTEPPING
*/
#if ENABLED(BD_SENSOR) && DISABLED(BABYSTEPPING)
#warning "BABYSTEPPING is recommended with BD_SENSOR."
#endif
+3 -2
View File
@@ -120,10 +120,11 @@ static void createChar_P(const char c, const byte * const ptr) {
#endif
#if ENABLED(LCD_USE_I2C_BUZZER)
void MarlinUI::buzz(const long duration, const uint16_t freq) {
if (!sound_on) return;
lcd.buzz(duration, freq);
if (sound_on) lcd.buzz(duration, freq);
}
#endif
void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARSET_INFO*/) {
+3 -5
View File
@@ -36,7 +36,7 @@
#include "../../marlinui.h"
#include "../../../HAL/shared/Delay.h"
#if HAS_BUZZER
#if HAS_SOUND
#include "../../../libs/buzzer.h"
#endif
@@ -50,9 +50,7 @@ ENCODER_Rate EncoderRate;
// TODO: Replace with ui.quick_feedback
void Encoder_tick() {
#if PIN_EXISTS(BEEPER)
if (ui.sound_on) buzzer.click(10);
#endif
TERN_(HAS_BEEPER, if (ui.sound_on) buzzer.click(10));
}
// Encoder initialization
@@ -66,7 +64,7 @@ void Encoder_Configuration() {
#if BUTTON_EXISTS(ENC)
SET_INPUT_PULLUP(BTN_ENC);
#endif
#if PIN_EXISTS(BEEPER)
#if HAS_BEEPER
SET_OUTPUT(BEEPER_PIN); // TODO: Use buzzer.h which already inits this
#endif
}
+7 -9
View File
@@ -2625,15 +2625,13 @@ void Draw_HomeOff_Menu() {
#include "../../../libs/buzzer.h"
void HMI_AudioFeedback(const bool success=true) {
#if HAS_BUZZER
if (success) {
buzzer.tone(100, 659);
buzzer.tone(10, 0);
buzzer.tone(100, 698);
}
else
buzzer.tone(40, 440);
#endif
if (success) {
BUZZ(100, 659);
BUZZ(10, 0);
BUZZ(100, 698);
}
else
BUZZ(40, 440);
}
// Prepare
+7
View File
@@ -0,0 +1,7 @@
# DWIN for Creality Ender 3 v2
Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-3%20V2).
## Easy Install
Copy the `DWIN_SET` folder onto a Micro-SD card and insert the card into the slot on the DWIN screen. Cycle the machine and wait for the screen to go from blue to orange. Turn the machine off and remove the SD card. When you turn on the machine the screen will display a "Creality" loading screen.
File diff suppressed because it is too large Load Diff
+245
View File
@@ -0,0 +1,245 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 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
/**
* lcd/e3v2/jyersui/dwin.h
*/
#include "dwin_lcd.h"
#include "../common/dwin_set.h"
#include "../common/dwin_font.h"
#include "../common/dwin_color.h"
#include "../common/encoder.h"
#include "../../../libs/BL24CXX.h"
#include "../../../inc/MarlinConfigPre.h"
//#define DWIN_CREALITY_LCD_CUSTOM_ICONS
enum processID : uint8_t {
Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait
};
enum PopupID : uint8_t {
Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot,
Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, Resuming, ManualProbing,
FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom
};
enum menuID : uint8_t {
MainMenu,
Prepare,
Move,
HomeMenu,
ManualLevel,
ZOffset,
Preheat,
ChangeFilament,
MenuCustom,
Control,
TempMenu,
PID,
HotendPID,
BedPID,
#if HAS_PREHEAT
#define _PREHEAT_ID(N) Preheat##N,
REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID)
#endif
Motion,
HomeOffsets,
MaxSpeed,
MaxAcceleration,
MaxJerk,
Steps,
Visual,
ColorSettings,
Advanced,
ProbeMenu,
Info,
Leveling,
LevelManual,
LevelView,
MeshViewer,
LevelSettings,
ManualMesh,
UBLMesh,
InfoMain,
Tune,
PreheatHotend
};
// Custom icons
#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS)
// index of every custom icon should be >= CUSTOM_ICON_START
#define CUSTOM_ICON_START ICON_Checkbox_F
#define ICON_Checkbox_F 200
#define ICON_Checkbox_T 201
#define ICON_Fade 202
#define ICON_Mesh 203
#define ICON_Tilt 204
#define ICON_Brightness 205
#define ICON_AxisD 249
#define ICON_AxisBR 250
#define ICON_AxisTR 251
#define ICON_AxisBL 252
#define ICON_AxisTL 253
#define ICON_AxisC 254
#else
#define ICON_Fade ICON_Version
#define ICON_Mesh ICON_Version
#define ICON_Tilt ICON_Version
#define ICON_Brightness ICON_Version
#define ICON_AxisD ICON_Axis
#define ICON_AxisBR ICON_Axis
#define ICON_AxisTR ICON_Axis
#define ICON_AxisBL ICON_Axis
#define ICON_AxisTL ICON_Axis
#define ICON_AxisC ICON_Axis
#endif
enum colorID : uint8_t {
Default, White, Green, Cyan, Blue, Magenta, Red, Orange, Yellow, Brown, Black
};
#define Custom_Colors 10
#define Color_Aqua RGB(0x00,0x3F,0x1F)
#define Color_Light_White 0xBDD7
#define Color_Green RGB(0x00,0x3F,0x00)
#define Color_Light_Green 0x3460
#define Color_Cyan 0x07FF
#define Color_Light_Cyan 0x04F3
#define Color_Blue 0x015F
#define Color_Light_Blue 0x3A6A
#define Color_Magenta 0xF81F
#define Color_Light_Magenta 0x9813
#define Color_Light_Red 0x8800
#define Color_Orange 0xFA20
#define Color_Light_Orange 0xFBC0
#define Color_Light_Yellow 0x8BE0
#define Color_Brown 0xCC27
#define Color_Light_Brown 0x6204
#define Color_Black 0x0000
#define Color_Grey 0x18E3
#define Check_Color 0x4E5C // Check-box check color
#define Confirm_Color 0x34B9
#define Cancel_Color 0x3186
class CrealityDWINClass {
public:
static constexpr size_t eeprom_data_size = 48;
static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes
bool time_format_textual : 1;
#if ENABLED(AUTO_BED_LEVELING_UBL)
uint8_t tilt_grid_size : 3;
#endif
uint16_t corner_pos : 10;
uint8_t cursor_color : 4;
uint8_t menu_split_line : 4;
uint8_t menu_top_bg : 4;
uint8_t menu_top_txt : 4;
uint8_t highlight_box : 4;
uint8_t progress_percent : 4;
uint8_t progress_time : 4;
uint8_t status_bar_text : 4;
uint8_t status_area_text : 4;
uint8_t coordinates_text : 4;
uint8_t coordinates_split_line : 4;
} eeprom_settings;
static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" };
static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" };
static void Clear_Screen(uint8_t e=3);
static void Draw_Float(float value, uint8_t row, bool selected=false, uint8_t minunit=10);
static void Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected=false, bool color=false);
static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false);
static void Draw_Checkbox(uint8_t row, bool value);
static void Draw_Title(const char * title);
static void Draw_Title(FSTR_P const title);
static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, bool more=false, bool centered=false);
static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, bool more=false, bool centered=false);
static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0);
static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false);
static void Redraw_Screen();
static void Main_Menu_Icons();
static void Draw_Main_Menu(uint8_t select=0);
static void Print_Screen_Icons();
static void Draw_Print_Screen();
static void Draw_Print_Filename(const bool reset=false);
static void Draw_Print_ProgressBar();
#if ENABLED(USE_M73_REMAINING_TIME)
static void Draw_Print_ProgressRemain();
#endif
static void Draw_Print_ProgressElapsed();
static void Draw_Print_confirm();
static void Draw_SD_Item(uint8_t item, uint8_t row);
static void Draw_SD_List(bool removed=false);
static void Draw_Status_Area(bool icons=false);
static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0);
static void Popup_Select();
static void Update_Status_Bar(bool refresh=false);
#if ENABLED(AUTO_BED_LEVELING_UBL)
static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7);
static void Set_Mesh_Viewer_Status();
#endif
static FSTR_P Get_Menu_Title(uint8_t menu);
static uint8_t Get_Menu_Size(uint8_t menu);
static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true);
static void Popup_Handler(PopupID popupid, bool option = false);
static void Confirm_Handler(PopupID popupid);
static void Main_Menu_Control();
static void Menu_Control();
static void Value_Control();
static void Option_Control();
static void File_Control();
static void Print_Screen_Control();
static void Popup_Control();
static void Confirm_Control();
static void Setup_Value(float value, float min, float max, float unit, uint8_t type);
static void Modify_Value(float &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(uint8_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(uint16_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(int16_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(uint32_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(int8_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Option(uint8_t value, const char * const * options, uint8_t max);
static void Update_Status(const char * const text);
static void Start_Print(bool sd);
static void Stop_Print();
static void Update();
static void State_Update();
static void Screen_Update();
static void AudioFeedback(const bool success=true);
static void Save_Settings(char *buff);
static void Load_Settings(const char *buff);
static void Reset_Settings();
};
extern CrealityDWINClass CrealityDWIN;
+64
View File
@@ -0,0 +1,64 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 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/>.
*
*/
/********************************************************************************
* @file lcd/e3v2/jyersui/dwin_lcd.cpp
* @brief DWIN screen control functions
********************************************************************************/
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "dwin_lcd.h"
/*-------------------------------------- System variable function --------------------------------------*/
void DWIN_Startup() {}
/*---------------------------------------- Drawing functions ----------------------------------------*/
// Draw the degree (°) symbol
// Color: color
// x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
DWIN_Draw_Point(Color, 1, 1, x + 1, y);
DWIN_Draw_Point(Color, 1, 1, x + 2, y);
DWIN_Draw_Point(Color, 1, 1, x, y + 1);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
DWIN_Draw_Point(Color, 1, 1, x, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
}
/*---------------------------------------- Picture related functions ----------------------------------------*/
// Draw an Icon
// libID: Icon library ID
// picID: Icon ID
// x/y: Upper-left point
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
}
#endif // DWIN_CREALITY_LCD_JYERSUI
+34
View File
@@ -0,0 +1,34 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 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
/********************************************************************************
* @file lcd/e3v2/jyersui/dwin_lcd.h
* @brief DWIN screen control functions
********************************************************************************/
#include "../common/dwin_api.h"
// Draw the degree (°) symbol
// Color: color
// x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y);
+2 -1
View File
@@ -99,7 +99,7 @@
#define HAS_ONESTEP_LEVELING 1
#endif
#if HAS_MESH || HAS_ONESTEP_LEVELING
#if HAS_MESH || (HAS_LEVELING && HAS_ZOFFSET_ITEM)
#include "../../../feature/bedlevel/bedlevel.h"
#include "bedlevel_tools.h"
#endif
@@ -3823,6 +3823,7 @@ void Draw_Steps_Menu() {
#endif // AUTO_BED_LEVELING_UBL
#if HAS_MESH
void Draw_MeshSet_Menu() {
checkkey = Menu;
if (SetMenu(MeshMenu, GET_TEXT_F(MSG_MESH_LEVELING), 15)) {
-1
View File
@@ -39,7 +39,6 @@
enum DGUSLCD_Screens : uint8_t;
//#define DEBUG_DGUSLCD
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
#include "../../../core/debug_out.h"
+26 -29
View File
@@ -152,10 +152,10 @@ void DGUSScreenHandler::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) {
// Send an uint8_t between 0 and 100 to a variable scale to 0..255
void DGUSScreenHandler::DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr) {
if (var.memadr) {
uint16_t value = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPGM("FAN value get:", value);
const uint16_t value = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("Got percent:", value);
*(uint8_t*)var.memadr = map(constrain(value, 0, 100), 0, 100, 0, 255);
DEBUG_ECHOLNPGM("FAN value change:", *(uint8_t*)var.memadr);
DEBUG_ECHOLNPGM("Set uint8:", *(uint8_t*)var.memadr);
}
}
@@ -264,10 +264,10 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
static uint16_t period = 0;
static uint16_t index = 0;
//DEBUG_ECHOPGM(" DGUSLCD_SendWaitingStatusToDisplay ", var.VP);
//DEBUG_ECHOLNPGM(" data ", swap16(index));
//DEBUG_ECHOLNPGM(" data ", BE16_P(&index));
if (period++ > DGUS_UI_WAITING_STATUS_PERIOD) {
dgusdisplay.WriteVariable(var.VP, index);
//DEBUG_ECHOLNPGM(" data ", swap16(index));
//DEBUG_ECHOLNPGM(" data ", BE16_P(&index));
if (++index >= DGUS_UI_WAITING_STATUS) index = 0;
period = 0;
}
@@ -306,7 +306,7 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
void DGUSScreenHandler::DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable& var, void *val_ptr) {
auto old_top = top_file;
const int16_t scroll = (int16_t)swap16(*(uint16_t*)val_ptr);
const int16_t scroll = (int16_t)BE16_P(val_ptr);
if (scroll) {
top_file += scroll;
DEBUG_ECHOPGM("new topfile calculated:", top_file);
@@ -391,7 +391,7 @@ void DGUSScreenHandler::HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr
}
void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) {
celsius_t newvalue = swap16(*(uint16_t*)val_ptr);
celsius_t newvalue = BE16_P(val_ptr);
celsius_t acceptedvalue;
switch (var.VP) {
@@ -426,7 +426,7 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va
void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) {
#if HAS_EXTRUDERS
uint16_t newvalue = swap16(*(uint16_t*)val_ptr);
const uint16_t newvalue = BE16_P(val_ptr);
uint8_t target_extruder;
switch (var.VP) {
default: return;
@@ -446,7 +446,7 @@ void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_p
void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleManualExtrude");
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
const int16_t movevalue = BE16_P(val_ptr);
float target = movevalue * 0.01f;
ExtUI::extruder_t target_extruder;
@@ -468,19 +468,19 @@ void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
void DGUSScreenHandler::HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleManualMoveOption");
*(uint16_t*)var.memadr = swap16(*(uint16_t*)val_ptr);
*(uint16_t*)var.memadr = BE16_P(val_ptr);
}
#endif
void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleMotorLockUnlock");
const int16_t lock = swap16(*(uint16_t*)val_ptr);
const int16_t lock = BE16_P(val_ptr);
queue.enqueue_one_now(lock ? F("M18") : F("M17"));
}
void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleSettings");
uint16_t value = swap16(*(uint16_t*)val_ptr);
const uint16_t value = BE16_P(val_ptr);
switch (value) {
default: break;
case 1:
@@ -494,11 +494,9 @@ void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
}
void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPGM("value_raw:", value_raw);
float value = (float)value_raw / 10;
const uint16_t value_raw = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("HandleStepPerMMChanged:", value_raw);
const float value = (float)value_raw / 10;
ExtUI::axis_t axis;
switch (var.VP) {
case VP_X_STEP_PER_MM: axis = ExtUI::axis_t::X; break;
@@ -510,15 +508,12 @@ void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_
ExtUI::setAxisSteps_per_mm(value, axis);
DEBUG_ECHOLNPGM("value_set:", ExtUI::getAxisSteps_per_mm(axis));
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
}
void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPGM("value_raw:", value_raw);
float value = (float)value_raw / 10;
const uint16_t value_raw = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged:", value_raw);
const float value = (float)value_raw / 10;
ExtUI::extruder_t extruder;
switch (var.VP) {
default: return;
@@ -575,7 +570,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
void DGUSScreenHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleProbeOffsetZChanged");
const float offset = float(int16_t(swap16(*(uint16_t*)val_ptr))) / 100.0f;
const float offset = float(int16_t(BE16_P(val_ptr))) / 100.0f;
ExtUI::setZOffset_mm(offset);
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
@@ -606,9 +601,11 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
break;
#endif
case VP_BED_CONTROL:
preheat_temp = PREHEAT_1_TEMP_BED;
break;
#if HAS_HEATED_BED
case VP_BED_CONTROL:
preheat_temp = PREHEAT_1_TEMP_BED;
break;
#endif
}
*(int16_t*)var.memadr = *(int16_t*)var.memadr > 0 ? 0 : preheat_temp;
@@ -619,7 +616,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandlePreheat");
const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
const uint16_t preheat_option = BE16_P(val_ptr);
switch (preheat_option) {
default:
switch (var.VP) {
@@ -642,7 +639,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
#if ENABLED(POWER_LOSS_RECOVERY)
void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value = swap16(*(uint16_t*)val_ptr);
uint16_t value = BE16_P(val_ptr);
if (value) {
queue.inject(F("M1000"));
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), 32, true);
@@ -42,6 +42,10 @@
#endif
// endianness swap
#define BE16_P(V) ( ((uint8_t*)(V))[0] << 8U | ((uint8_t*)(V))[1] )
#define BE32_P(V) ( ((uint8_t*)(V))[0] << 24U | ((uint8_t*)(V))[1] << 16U | ((uint8_t*)(V))[2] << 8U | ((uint8_t*)(V))[3] )
#if ENABLED(DGUS_LCD_UI_ORIGIN)
#include "origin/DGUSScreenHandler.h"
#elif ENABLED(DGUS_LCD_UI_MKS)
@@ -54,9 +54,6 @@
bool DGUSAutoTurnOff = false;
MKS_Language mks_language_index; // Initialized by settings.load()
// endianness swap
uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
#if 0
void DGUSScreenHandlerMKS::sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) {
dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
@@ -108,10 +105,10 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var)
void DGUSScreenHandlerMKS::DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr) {
if (var.memadr) {
const uint16_t value = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPGM("FAN value get:", value);
const uint16_t value = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("Got uint8:", value);
*(uint8_t*)var.memadr = map(constrain(value, 0, 255), 0, 255, 0, 255);
DEBUG_ECHOLNPGM("FAN value change:", *(uint8_t*)var.memadr);
DEBUG_ECHOLNPGM("Set uint8:", *(uint8_t*)var.memadr);
}
}
@@ -152,7 +149,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
#if ENABLED(SDSUPPORT)
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
uint16_t touched_nr = (int16_t)BE16_P(val_ptr) + top_file;
if (touched_nr != 0x0F && touched_nr > filelist.count()) return;
if (!filelist.seek(touched_nr) && touched_nr != 0x0F) return;
@@ -191,7 +188,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
switch (swap16(*(uint16_t*)val_ptr)) {
switch (BE16_P(val_ptr)) {
case 0: { // Resume
auto cs = getCurrentScreen();
if (runout_mks.runout_status != RUNOUT_WAITING_STATUS && runout_mks.runout_status != UNRUNOUT_STATUS) {
@@ -268,7 +265,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
#else
void DGUSScreenHandlerMKS::PrintReturn(DGUS_VP_Variable& var, void *val_ptr) {
uint16_t value = swap16(*(uint16_t*)val_ptr);
const uint16_t value = BE16_P(val_ptr);
if (value == 0x0F) GotoScreen(DGUSLCD_SCREEN_MAIN);
}
#endif // SDSUPPORT
@@ -316,7 +313,7 @@ void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
}
void DGUSScreenHandlerMKS::ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t target = swap16(*(uint16_t *)val_ptr);
const uint16_t target = BE16_P(val_ptr);
DEBUG_ECHOLNPGM(" back = 0x%x", target);
switch (target) {
}
@@ -332,7 +329,7 @@ void DGUSScreenHandlerMKS::ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr)
void DGUSScreenHandlerMKS::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("GetTurnOffCtrl\n");
const uint16_t value = swap16(*(uint16_t *)val_ptr);
const uint16_t value = BE16_P(val_ptr);
switch (value) {
case 0 ... 1: DGUSAutoTurnOff = (bool)value; break;
default: break;
@@ -341,7 +338,7 @@ void DGUSScreenHandlerMKS::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr)
void DGUSScreenHandlerMKS::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("GetMinExtrudeTemp");
const uint16_t value = swap16(*(uint16_t *)val_ptr);
const uint16_t value = BE16_P(val_ptr);
TERN_(PREVENT_COLD_EXTRUSION, thermalManager.extrude_min_temp = value);
mks_min_extrusion_temp = value;
settings.save();
@@ -349,7 +346,7 @@ void DGUSScreenHandlerMKS::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_pt
void DGUSScreenHandlerMKS::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("GetZoffsetDistance");
const uint16_t value = swap16(*(uint16_t *)val_ptr);
const uint16_t value = BE16_P(val_ptr);
float val_distance = 0;
switch (value) {
case 0: val_distance = 0.01; break;
@@ -363,11 +360,11 @@ void DGUSScreenHandlerMKS::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_p
void DGUSScreenHandlerMKS::GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("\nGetManualMovestep");
*(uint16_t *)var.memadr = swap16(*(uint16_t *)val_ptr);
*(uint16_t *)var.memadr = BE16_P(val_ptr);
}
void DGUSScreenHandlerMKS::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t eep_flag = swap16(*(uint16_t *)val_ptr);
const uint16_t eep_flag = BE16_P(val_ptr);
switch (eep_flag) {
case 0:
settings.save();
@@ -385,7 +382,7 @@ void DGUSScreenHandlerMKS::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
}
void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t z_value = swap16(*(uint16_t *)val_ptr);
const uint16_t z_value = BE16_P(val_ptr);
switch (z_value) {
case 0: Z_distance = 0.01; break;
case 1: Z_distance = 0.1; break;
@@ -397,22 +394,22 @@ void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr)
void DGUSScreenHandlerMKS::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) {
#if HAS_BED_PROBE
int32_t value = swap32(*(int32_t *)val_ptr);
float Offset = value / 100.0f;
const int32_t value = BE32_P(val_ptr);
const float Offset = value / 100.0f;
DEBUG_ECHOLNPGM("\nget int6 offset >> ", value, 6);
#endif
switch (var.VP) {
case VP_OFFSET_X: TERN_(HAS_BED_PROBE, probe.offset.x = Offset); break;
case VP_OFFSET_Y: TERN_(HAS_BED_PROBE, probe.offset.y = Offset); break;
case VP_OFFSET_Z: TERN_(HAS_BED_PROBE, probe.offset.z = Offset); break;
default: break;
}
settings.save();
switch (var.VP) {
default: break;
case VP_OFFSET_X: probe.offset.x = Offset; break;
case VP_OFFSET_Y: probe.offset.y = Offset; break;
case VP_OFFSET_Z: probe.offset.z = Offset; break;
}
settings.save();
#endif
}
void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t lag_flag = swap16(*(uint16_t *)val_ptr);
const uint16_t lag_flag = BE16_P(val_ptr);
switch (lag_flag) {
case MKS_SimpleChinese:
DGUS_LanguageDisplay(MKS_SimpleChinese);
@@ -437,10 +434,10 @@ void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr)
#endif
void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t lev_but = swap16(*(uint16_t *)val_ptr);
#if ENABLED(MESH_BED_LEVELING)
auto cs = getCurrentScreen();
#endif
const uint16_t lev_but = BE16_P(val_ptr);
switch (lev_but) {
case 0:
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -484,7 +481,7 @@ void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) {
}
void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t mesh_dist = swap16(*(uint16_t *)val_ptr);
const uint16_t mesh_dist = BE16_P(val_ptr);
switch (mesh_dist) {
case 0: mesh_adj_distance = 0.01; break;
case 1: mesh_adj_distance = 0.1; break;
@@ -495,7 +492,7 @@ void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *
void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
#if ENABLED(MESH_BED_LEVELING)
const uint16_t mesh_value = swap16(*(uint16_t *)val_ptr);
const uint16_t mesh_value = BE16_P(val_ptr);
// static uint8_t a_first_level = 1;
char cmd_buf[30];
float offset = mesh_adj_distance;
@@ -593,8 +590,8 @@ void DGUSScreenHandlerMKS::SD_FileBack(DGUS_VP_Variable&, void*) {
}
void DGUSScreenHandlerMKS::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
const uint16_t lcd_value = BE16_P(val_ptr);
lcd_default_light = constrain(lcd_value, 10, 100);
const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light };
@@ -602,7 +599,7 @@ void DGUSScreenHandlerMKS::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr)
}
void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) {
const int16_t point_value = swap16(*(uint16_t *)val_ptr);
const int16_t point_value = BE16_P(val_ptr);
// Insist on leveling first time at this screen
static bool first_level_flag = false;
@@ -656,7 +653,7 @@ void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val
#define mks_max(a, b) ((a) > (b)) ? (a) : (b)
void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
#if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP)
const uint16_t tmc_value = swap16(*(uint16_t*)val_ptr);
const uint16_t tmc_value = BE16_P(val_ptr);
#endif
switch (var.VP) {
@@ -749,7 +746,7 @@ void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleManualMove");
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
int16_t movevalue = BE16_P(val_ptr);
// Choose Move distance
if (manualMoveStep == 0x01) manualMoveStep = 10;
@@ -894,7 +891,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
}
void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) {
const int16_t value_pos = swap16(*(int16_t*)val_ptr);
const int16_t value_pos = BE16_P(val_ptr);
switch (var.VP) {
case VP_X_PARK_POS: mks_park_pos.x = value_pos; break;
@@ -908,7 +905,7 @@ void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) {
void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleChangeLevelPoint");
const int16_t value_raw = swap16(*(int16_t*)val_ptr);
const int16_t value_raw = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("value_raw:", value_raw);
*(int16_t*)var.memadr = value_raw;
@@ -920,7 +917,7 @@ void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *v
void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const uint16_t value_raw = BE16_P(val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPGM("value_raw:", value_raw);
@@ -942,7 +939,7 @@ void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *v
void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const uint16_t value_raw = BE16_P(val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPGM("value_raw:", value_raw);
@@ -967,7 +964,7 @@ void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var,
void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleMaxSpeedChange");
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const uint16_t value_raw = BE16_P(val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPGM("value_raw:", value_raw);
@@ -989,7 +986,7 @@ void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val
void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleExtruderMaxSpeedChange");
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const uint16_t value_raw = BE16_P(val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPGM("value_raw:", value_raw);
@@ -1014,7 +1011,7 @@ void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, v
void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleMaxAccChange");
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const uint16_t value_raw = BE16_P(val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPGM("value_raw:", value_raw);
@@ -1036,7 +1033,7 @@ void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_p
void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleExtruderAccChange");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
uint16_t value_raw = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("value_raw:", value_raw);
float value = (float)value_raw;
ExtUI::extruder_t extruder;
@@ -1057,32 +1054,32 @@ void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void *
}
void DGUSScreenHandlerMKS::HandleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_travel = swap16(*(uint16_t*)val_ptr);
uint16_t value_travel = BE16_P(val_ptr);
planner.settings.travel_acceleration = (float)value_travel;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
void DGUSScreenHandlerMKS::HandleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_t = swap16(*(uint16_t*)val_ptr);
uint16_t value_t = BE16_P(val_ptr);
planner.settings.min_feedrate_mm_s = (float)value_t;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
void DGUSScreenHandlerMKS::HandleMin_T_F(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_t_f = swap16(*(uint16_t*)val_ptr);
uint16_t value_t_f = BE16_P(val_ptr);
planner.settings.min_travel_feedrate_mm_s = (float)value_t_f;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_acc = swap16(*(uint16_t*)val_ptr);
uint16_t value_acc = BE16_P(val_ptr);
planner.settings.acceleration = (float)value_acc;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
#if ENABLED(PREVENT_COLD_EXTRUSION)
void DGUSScreenHandlerMKS::HandleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t value_ex_min_temp = swap16(*(uint16_t*)val_ptr);
const uint16_t value_ex_min_temp = BE16_P(val_ptr);
thermalManager.extrude_min_temp = value_ex_min_temp;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
@@ -1090,7 +1087,7 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr)
#if HAS_PID_HEATING
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
const uint16_t rawvalue = BE16_P(val_ptr);
DEBUG_ECHOLNPGM("V1:", rawvalue);
const float value = 1.0f * rawvalue;
DEBUG_ECHOLNPGM("V2:", value);
@@ -1126,9 +1123,9 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr)
#if ENABLED(BABYSTEPPING)
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
float step = ZOffset_distance;
const float step = ZOffset_distance;
uint16_t flag = swap16(*(uint16_t*)val_ptr);
const uint16_t flag = BE16_P(val_ptr);
switch (flag) {
case 0:
if (step == 0.01)
@@ -1160,34 +1157,26 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr)
z_offset_add += ZOffset_distance;
break;
default:
break;
default: break;
}
ForceCompleteUpdate();
}
#endif // BABYSTEPPING
void DGUSScreenHandlerMKS::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("GetManualFilament");
const uint16_t value_len = BE16_P(val_ptr);
const float value = (float)value_len;
uint16_t value_len = swap16(*(uint16_t*)val_ptr);
float value = (float)value_len;
DEBUG_ECHOLNPGM("Get Filament len value:", value);
DEBUG_ECHOLNPGM("GetManualFilament:", value);
distanceFilament = value;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
void DGUSScreenHandlerMKS::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("GetManualFilamentSpeed");
uint16_t value_len = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPGM("filamentSpeed_mm_s value:", value_len);
const uint16_t value_len = BE16_P(val_ptr);
filamentSpeed_mm_s = value_len;
DEBUG_ECHOLNPGM("GetManualFilamentSpeed:", value_len);
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}
@@ -1206,7 +1195,7 @@ void DGUSScreenHandlerMKS::FilamentLoadUnload(DGUS_VP_Variable &var, void *val_p
if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
return;
const uint16_t val_t = swap16(*(uint16_t*)val_ptr);
const uint16_t val_t = BE16_P(val_ptr);
switch (val_t) {
default: break;
case 0:
@@ -1292,7 +1281,7 @@ void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
uint8_t e_temp = 0;
filament_data.heated = false;
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
uint16_t preheat_option = BE16_P(val_ptr);
if (preheat_option >= 10) { // Unload filament type
preheat_option -= 10;
filament_data.action = 2;
@@ -21,7 +21,10 @@
*/
#pragma once
/* DGUS implementation written by coldtobi in 2019 for Marlin */
/**
* DGUS implementation written by coldtobi in 2019.
* Updated for STM32G0B1RE by Protomosh in 2022.
*/
#include "config/DGUS_Screen.h"
#include "config/DGUS_Control.h"
@@ -30,11 +33,13 @@
#include "../../../inc/MarlinConfigPre.h"
#include "../../../MarlinCore.h"
#define DEBUG_DGUSLCD // Uncomment for debug messages
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
#include "../../../core/debug_out.h"
#define Swap16(val) ((uint16_t)(((uint16_t)(val) >> 8) |\
((uint16_t)(val) << 8)))
// New endianness swap for 32bit mcu (tested with STM32G0B1RE)
#define BE16_P(V) ( ((uint8_t*)(V))[0] << 8U | ((uint8_t*)(V))[1] )
#define BE32_P(V) ( ((uint8_t*)(V))[0] << 24U | ((uint8_t*)(V))[1] << 16U | ((uint8_t*)(V))[2] << 8U | ((uint8_t*)(V))[3] )
// Low-Level access to the display.
class DGUSDisplay {
@@ -215,7 +215,7 @@ void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) {
void DGUSRxHandler::Feedrate(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);
const int16_t feedrate = Swap16(*(int16_t*)data_ptr);
const int16_t feedrate = BE16_P(data_ptr);
ExtUI::setFeedrate_percent(feedrate);
@@ -223,7 +223,7 @@ void DGUSRxHandler::Feedrate(DGUS_VP &vp, void *data_ptr) {
}
void DGUSRxHandler::Flowrate(DGUS_VP &vp, void *data_ptr) {
const int16_t flowrate = Swap16(*(int16_t*)data_ptr);
const int16_t flowrate = BE16_P(data_ptr);
switch (vp.addr) {
default: return;
@@ -246,7 +246,7 @@ void DGUSRxHandler::Flowrate(DGUS_VP &vp, void *data_ptr) {
void DGUSRxHandler::BabystepSet(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);
const int16_t data = Swap16(*(int16_t*)data_ptr);
const int16_t data = BE16_P(data_ptr);
const float offset = dgus_display.FromFixedPoint<int16_t, float, 2>(data);
const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z);
@@ -315,7 +315,7 @@ void DGUSRxHandler::TempPreset(DGUS_VP &vp, void *data_ptr) {
}
void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) {
const int16_t temp = Swap16(*(int16_t*)data_ptr);
const int16_t temp = BE16_P(data_ptr);
switch (vp.addr) {
default: return;
@@ -338,7 +338,7 @@ void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) {
void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);
const DGUS_Data::Heater heater = (DGUS_Data::Heater)Swap16(*(uint16_t*)data_ptr);
const DGUS_Data::Heater heater = (DGUS_Data::Heater)BE16_P(data_ptr);
switch (heater) {
default: return;
@@ -397,7 +397,7 @@ void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) {
return;
}
const int16_t data = Swap16(*(int16_t*)data_ptr);
const int16_t data = BE16_P(data_ptr);
const float offset = dgus_display.FromFixedPoint<int16_t, float, 2>(data);
const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z);
@@ -546,7 +546,7 @@ void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) {
void DGUSRxHandler::FilamentSelect(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);
const DGUS_Data::Extruder extruder = (DGUS_Data::Extruder)Swap16(*(uint16_t*)data_ptr);
const DGUS_Data::Extruder extruder = (DGUS_Data::Extruder)BE16_P(data_ptr);
switch (extruder) {
default: return;
@@ -563,7 +563,7 @@ void DGUSRxHandler::FilamentSelect(DGUS_VP &vp, void *data_ptr) {
void DGUSRxHandler::FilamentLength(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);
const uint16_t length = Swap16(*(uint16_t*)data_ptr);
const uint16_t length = BE16_P(data_ptr);
dgus_screen_handler.filament_length = constrain(length, 0, EXTRUDE_MAXLENGTH);
@@ -644,7 +644,7 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) {
}
void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) {
const int16_t data = Swap16(*(int16_t*)data_ptr);
const int16_t data = BE16_P(data_ptr);
const float position = dgus_display.FromFixedPoint<int16_t, float, 1>(data);
ExtUI::axis_t axis;
@@ -816,7 +816,7 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) {
void DGUSRxHandler::PIDSelect(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);
const DGUS_Data::Heater heater = (DGUS_Data::Heater)Swap16(*(uint16_t*)data_ptr);
const DGUS_Data::Heater heater = (DGUS_Data::Heater)BE16_P(data_ptr);
switch (heater) {
default: return;
@@ -846,7 +846,7 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) {
return;
}
uint16_t temp = Swap16(*(uint16_t*)data_ptr);
uint16_t temp = BE16_P(data_ptr);
switch (dgus_screen_handler.pid_heater) {
default: return;
@@ -107,7 +107,7 @@ namespace DGUSRxHandler {
break;
}
case 2: {
const uint16_t data = Swap16(*(uint16_t*)data_ptr);
const uint16_t data = BE16_P(data_ptr);
*(T*)vp.extra = (T)data;
break;
}
@@ -24,6 +24,8 @@
#include "DGUSDisplay.h"
#include "definition/DGUS_VP.h"
#define Swap16(val) ((uint16_t)(((uint16_t)(val) >> 8) | ((uint16_t)(val) << 8)))
namespace DGUSTxHandler {
#if ENABLED(SDSUPPORT)
@@ -97,7 +97,7 @@
#elif defined(TOUCH_UI_800x480)
namespace FTDI {
#if defined(TOUCH_UI_800x480_GENERIC)
#ifdef TOUCH_UI_800x480_GENERIC
constexpr uint8_t Pclk = 2;
constexpr uint16_t Hsize = 800;
constexpr uint16_t Vsize = 480;
@@ -112,10 +112,10 @@ class ComputeBoundingBox:
if s:
m = re.search('viewBox="([0-9-.]+) ([0-9-.]+) ([0-9-.]+) ([0-9-.]+)"', svg)
if m:
self.x_min = float(m.group(1))
self.y_min = float(m.group(2))
self.x_max = float(m.group(3))
self.y_max = float(m.group(4))
self.x_min = float(m[1])
self.y_min = float(m[2])
self.x_max = float(m[3])
self.y_max = float(m[4])
return True
return False
@@ -205,18 +205,18 @@ class Parser:
pass # Just eat the spaces
elif self.eat_token('([LMHVZlmhvz])'):
cmd = self.m.group(1)
cmd = self.m[1]
# The following commands take no arguments
if cmd == "Z" or cmd == "z":
self.process_svg_path_data_cmd(id, cmd, 0, 0)
elif self.eat_token('([CScsQqTtAa])'):
print("Unsupported path data command:", self.m.group(1), "in path", id, "\n", file=sys.stderr)
print("Unsupported path data command:", self.m[1], "in path", id, "\n", file=sys.stderr)
quit()
elif self.eat_token('([ ,]*[-0-9e.]+)+'):
# Process list of coordinates following command
coords = re.split('[ ,]+', self.m.group(0))
coords = re.split('[ ,]+', self.m[0])
# The following commands take two arguments
if cmd == "L" or cmd == "l":
while coords:
@@ -245,7 +245,7 @@ class Parser:
id = "<none>"
m = re.search(' id="(.*)"', path)
if m:
id = m.group(1)
id = m[1]
m = re.search(' transform="(.*)"', path)
if m:
@@ -254,7 +254,7 @@ class Parser:
m = re.search(' d="(.*)"', path)
if m:
self.process_svg_path_data(id, m.group(1))
self.process_svg_path_data(id, m[1])
self.op.path_finished(id)
self.reset()
@@ -171,9 +171,9 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10;
if (mydata.t_tag && !t_ok) {
if (mydata.t_tag && !t_ok)
cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
} else if (getActualTemp_celsius(e) > 100) {
else if (getActualTemp_celsius(e) > 100) {
cmd.cmd(COLOR_RGB(0xFF0000))
.text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION))
.colors(normal_btn)
@@ -111,16 +111,17 @@ void FilesScreen::drawFileButton(int x, int y, int w, int h, const char *filenam
cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
cmd.font(font_medium).rectangle(bx, by, bw, bh);
cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
#if ENABLED(SCROLL_LONG_FILENAMES)
if (is_highlighted) {
if (TERN0(SCROLL_LONG_FILENAMES, is_highlighted)) {
#if ENABLED(SCROLL_LONG_FILENAMES)
cmd.cmd(SAVE_CONTEXT());
cmd.cmd(SCISSOR_XY(x,y));
cmd.cmd(SCISSOR_SIZE(w,h));
cmd.cmd(MACRO(0));
cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
} else
#endif
draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
#endif
}
else
draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX);
#if ENABLED(SCROLL_LONG_FILENAMES)
if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());
+14 -5
View File
@@ -31,7 +31,7 @@
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *fw_type, *board;
static lv_obj_t *fw_type, *board, *website, *uuid, *protocol;
enum { ID_A_RETURN = 1 };
@@ -48,11 +48,20 @@ void lv_draw_about() {
scr = lv_screen_create(ABOUT_UI);
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);
fw_type = lv_label_create(scr, "Firmware: Marlin " SHORT_BUILD_VERSION);
lv_obj_align(fw_type, nullptr, LV_ALIGN_CENTER, 0, -20);
board = lv_label_create(scr, BOARD_INFO_NAME);
lv_obj_align(board, nullptr, LV_ALIGN_CENTER, 0, -80);
board = lv_label_create(scr, "Board: " BOARD_INFO_NAME);
lv_obj_align(board, nullptr, LV_ALIGN_CENTER, 0, -60);
fw_type = lv_label_create(scr, "Marlin " SHORT_BUILD_VERSION " (" STRING_DISTRIBUTION_DATE ")");
lv_obj_align(fw_type, nullptr, LV_ALIGN_CENTER, 0, -50);
website = lv_label_create(scr, WEBSITE_URL);
lv_obj_align(website, nullptr, LV_ALIGN_CENTER, 0, -20);
uuid = lv_label_create(scr, "UUID: " DEFAULT_MACHINE_UUID);
lv_obj_align(uuid, nullptr, LV_ALIGN_CENTER, 0, 10);
protocol = lv_label_create(scr, "Protocol: " PROTOCOL_VERSION);
lv_obj_align(protocol, nullptr, LV_ALIGN_CENTER, 0, 40);
}
void lv_clear_about() {
@@ -53,42 +53,45 @@ void WifiSerial::init(PinName _rx, PinName _tx) {
WifiSerial::WifiSerial(void *peripheral) {
// If PIN_SERIALy_RX is not defined assume half-duplex
_serial.pin_rx = NC;
if (false) {
// for else if / else below...
}
// If Serial is defined in variant set
// the Rx/Tx pins for com port if defined
#if defined(Serial) && defined(PIN_SERIAL_TX)
if ((void *)this == (void *)&Serial) {
else if ((void *)this == (void *)&Serial) {
#ifdef PIN_SERIAL_RX
setRx(PIN_SERIAL_RX);
#endif
setTx(PIN_SERIAL_TX);
} else
}
#endif
#if defined(PIN_SERIAL1_TX) && defined(USART1_BASE)
if (peripheral == USART1) {
else if (peripheral == USART1) {
#ifdef PIN_SERIAL1_RX
setRx(PIN_SERIAL1_RX);
#endif
setTx(PIN_SERIAL1_TX);
} else
}
#endif
#if defined(PIN_SERIAL2_TX) && defined(USART2_BASE)
if (peripheral == USART2) {
else if (peripheral == USART2) {
#ifdef PIN_SERIAL2_RX
setRx(PIN_SERIAL2_RX);
#endif
setTx(PIN_SERIAL2_TX);
} else
}
#endif
#if defined(PIN_SERIAL3_TX) && defined(USART3_BASE)
if (peripheral == USART3) {
else if (peripheral == USART3) {
#ifdef PIN_SERIAL3_RX
setRx(PIN_SERIAL3_RX);
#endif
setTx(PIN_SERIAL3_TX);
} else
}
#endif
#ifdef PIN_SERIAL4_TX
if (false
else if (false
#ifdef USART4_BASE
|| peripheral == USART4
#elif defined(UART4_BASE)
@@ -99,10 +102,10 @@ WifiSerial::WifiSerial(void *peripheral) {
setRx(PIN_SERIAL4_RX);
#endif
setTx(PIN_SERIAL4_TX);
} else
}
#endif
#ifdef PIN_SERIAL5_TX
if (false
else if (false
#ifdef USART5_BASE
|| peripheral == USART5
#elif defined(UART5_BASE)
@@ -113,18 +116,18 @@ WifiSerial::WifiSerial(void *peripheral) {
setRx(PIN_SERIAL5_RX);
#endif
setTx(PIN_SERIAL5_TX);
} else
}
#endif
#if defined(PIN_SERIAL6_TX) && defined(USART6_BASE)
if (peripheral == USART6) {
else if (peripheral == USART6) {
#ifdef PIN_SERIAL6_RX
setRx(PIN_SERIAL6_RX);
#endif
setTx(PIN_SERIAL6_TX);
} else
}
#endif
#ifdef PIN_SERIAL7_TX
if (false
else if (false
#ifdef USART7_BASE
|| peripheral == USART7
#elif defined(UART7_BASE)
@@ -135,10 +138,10 @@ WifiSerial::WifiSerial(void *peripheral) {
setRx(PIN_SERIAL7_RX);
#endif
setTx(PIN_SERIAL7_TX);
} else
}
#endif
#ifdef PIN_SERIAL8_TX
if (false
else if (false
#ifdef USART8_BASE
|| peripheral == USART8
#elif defined(UART8_BASE)
@@ -149,18 +152,18 @@ WifiSerial::WifiSerial(void *peripheral) {
setRx(PIN_SERIAL8_RX);
#endif
setTx(PIN_SERIAL8_TX);
} else
}
#endif
#if defined(PIN_SERIAL9_TX) && defined(UART9_BASE)
if (peripheral == UART9) {
else if (peripheral == UART9) {
#ifdef PIN_SERIAL9_RX
setRx(PIN_SERIAL9_RX);
#endif
setTx(PIN_SERIAL9_TX);
} else
}
#endif
#ifdef PIN_SERIAL10_TX
if (false
else if (false
#ifdef USART10_BASE
|| peripheral == USART10
#elif defined(UART10_BASE)
@@ -171,18 +174,18 @@ WifiSerial::WifiSerial(void *peripheral) {
setRx(PIN_SERIAL10_RX);
#endif
setTx(PIN_SERIAL10_TX);
} else
}
#endif
#if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE)
if (peripheral == LPUART1) {
else if (peripheral == LPUART1) {
#ifdef PIN_SERIALLP1_RX
setRx(PIN_SERIALLP1_RX);
#endif
setTx(PIN_SERIALLP1_TX);
} else
}
#endif
// else get the pins of the first peripheral occurrence in PinMap
{
else {
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
}
+1 -1
View File
@@ -1073,7 +1073,7 @@ namespace ExtUI {
void coolDown() { thermalManager.cooldown(); }
bool awaitingUserConfirm() {
return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused();
return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || TERN0(HOST_KEEPALIVE_FEATURE, getHostKeepaliveIsPaused());
}
void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
+1 -1
View File
@@ -199,7 +199,7 @@ namespace ExtUI {
#endif
inline void simulateUserClick() {
#if EITHER(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI)
ui.lcd_clicked = true;
#endif
}

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