Skip to content

Instantly share code, notes, and snippets.

@Enverex
Created May 28, 2019 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Enverex/d11bb0846a48edba95c2c656ab0e5d34 to your computer and use it in GitHub Desktop.
Save Enverex/d11bb0846a48edba95c2c656ab0e5d34 to your computer and use it in GitHub Desktop.
Marlin Original vs QQ Fork
diff --git a/marlin-original-clean/Marlin/Configuration.h b/marlin-qq-clean/Marlin/Configuration.h
index 2b6dbb0..97934a8 100644
--- a/marlin-original-clean/Marlin/Configuration.h
+++ b/marlin-qq-clean/Marlin/Configuration.h
@@ -73,10 +73,10 @@
// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
-#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
+#define STRING_CONFIG_H_AUTHOR "@berghauz, flsun qq-s on mks robin mini with 12864 emulation" // Who made the changes.
#define SHOW_BOOTSCREEN
#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1
-#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2
+#define STRING_SPLASH_LINE2 "Welcome to QQ-Sx" // will be shown during bootup in line 2
/**
* *** VENDORS PLEASE READ ***
@@ -104,7 +104,7 @@
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
-#define SERIAL_PORT 0
+#define SERIAL_PORT 3
/**
* Select a secondary serial port on the board to use for communication with the host.
@@ -113,7 +113,8 @@
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
-//#define SERIAL_PORT_2 -1
+#define SERIAL_PORT_2 1
+#define NUM_SERIAL 2
/**
* This setting determines the communication speed of the printer.
@@ -132,12 +133,12 @@
// The following define selects which electronics board you have.
// Please choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
- #define MOTHERBOARD BOARD_RAMPS_14_EFB
+ #define MOTHERBOARD BOARD_MKS_ROBIN_MINI
#endif
// Optional custom name for your RepStrap or other custom machine
// Displayed in the LCD "Ready" message
-//#define CUSTOM_MACHINE_NAME "3D Printer"
+#define CUSTOM_MACHINE_NAME "FLSUN QQ-Sx"
// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
@@ -150,7 +151,7 @@
#define EXTRUDERS 1
// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.
-#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0
+#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75
// For Cyclops or any "multi-extruder" that shares a single nozzle.
//#define SINGLENOZZLE
@@ -321,6 +322,7 @@
#define AUTO_POWER_FANS // Turn on PSU if fans need power
#define AUTO_POWER_E_FANS
#define AUTO_POWER_CONTROLLERFAN
+ #define AUTO_POWER_CHAMBER_FAN
#define POWER_TIMEOUT 30
#endif
@@ -377,11 +379,13 @@
* 147 : Pt100 with 4k7 pullup
* 110 : Pt100 with 1k pullup (non standard)
*
+ * 1000 : Custom - Specify parameters in Configuration_adv.h
+ *
* Use these for Testing or Development purposes. NEVER for production machine.
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
*
- * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" }
+ * :{ '0':"Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595", '998':"Dummy 1", '999':"Dummy 2", '1000':"Custom thermistor params" }
*/
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
@@ -389,7 +393,9 @@
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0
#define TEMP_SENSOR_5 0
-#define TEMP_SENSOR_BED 0
+
+#define TEMP_SENSOR_BED 1
+
#define TEMP_SENSOR_CHAMBER 0
// Dummy thermistor constant temperature readings, for use with 998 and 999
@@ -428,7 +434,7 @@
#define HEATER_3_MAXTEMP 275
#define HEATER_4_MAXTEMP 275
#define HEATER_5_MAXTEMP 275
-#define BED_MAXTEMP 150
+#define BED_MAXTEMP 120
//===========================================================================
//============================= PID Settings ================================
@@ -441,22 +447,22 @@
#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#define PID_K1 0.95 // Smoothing factor within any PID loop
#if ENABLED(PIDTEMP)
- //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
- //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
+ #define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
+ #define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // 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_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
- #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
+ #define PID_FUNCTIONAL_RANGE 300 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
// Ultimaker
- #define DEFAULT_Kp 22.2
- #define DEFAULT_Ki 1.08
- #define DEFAULT_Kd 114
+ //#define DEFAULT_Kp 22.2
+ //#define DEFAULT_Ki 1.08
+ //#define DEFAULT_Kd 114
// MakerGear
//#define DEFAULT_Kp 7.0
@@ -468,6 +474,11 @@
//#define DEFAULT_Ki 2.25
//#define DEFAULT_Kd 440
+ // FLSUN QQ-S - run 'M106 S255' & 'M303 E0 C10 S200'
+ #define DEFAULT_Kp 10.07
+ #define DEFAULT_Ki 0.56
+ #define DEFAULT_Kd 45.01
+
#endif // PIDTEMP
//===========================================================================
@@ -487,7 +498,8 @@
* 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.
*/
-//#define PIDTEMPBED
+
+#define PIDTEMPBED
//#define BED_LIMIT_SWITCHING
@@ -505,9 +517,9 @@
//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)
- #define DEFAULT_bedKp 10.00
- #define DEFAULT_bedKi .023
- #define DEFAULT_bedKd 305.4
+ //#define DEFAULT_bedKp 10.00
+ //#define DEFAULT_bedKi .023
+ //#define DEFAULT_bedKd 305.4
//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
@@ -515,8 +527,12 @@
//#define DEFAULT_bedKi 1.41
//#define DEFAULT_bedKd 1675.16
- // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
-#endif // PIDTEMPBED
+ // FIND YOUR OWN: "M303 E-1 C8 S80" to run autotune on the bed at 80 degreesC for 8 cycles.
+ // FLSUN QQ-S stock 1.6mm aluminium heater with 4mm lattice glass
+ #define DEFAULT_bedKp 325.10
+ #define DEFAULT_bedKi 63.35
+ #define DEFAULT_bedKd 417.10
+ #endif // PIDTEMPBED
// @section extruder
@@ -535,7 +551,7 @@
* Note: For Bowden Extruders make this large enough to allow load/unload.
*/
#define PREVENT_LENGTHY_EXTRUDE
-#define EXTRUDE_MAXLENGTH 200
+#define EXTRUDE_MAXLENGTH 750
//===========================================================================
//======================== Thermal Runaway Protection =======================
@@ -556,7 +572,7 @@
#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
-#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
+//#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
//===========================================================================
//============================= Mechanical Settings =========================
@@ -573,6 +589,70 @@
//#define COREZX
//#define COREZY
+//===========================================================================
+//============================== Delta Settings =============================
+//===========================================================================
+// Enable DELTA kinematics and most of the default configuration for Deltas
+#define DELTA
+
+#if ENABLED(DELTA)
+
+ // Make delta curves from many straight lines (linear interpolation).
+ // This is a trade-off between visible corners (not enough segments)
+ // and processor overload (too many expensive sqrt calls).
+ #define DELTA_SEGMENTS_PER_SECOND 200
+
+ // After homing move down to a height where XY movement is unconstrained
+ //#define DELTA_HOME_TO_SAFE_ZONE
+
+ // Delta calibration menu
+ // uncomment to add three points calibration menu option.
+ // See http://minow.blogspot.com/index.html#4918805519571907051
+ #define DELTA_CALIBRATION_MENU
+
+ // uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results)
+
+ #define DELTA_AUTO_CALIBRATION
+
+
+ // NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them
+
+ #if ENABLED(DELTA_AUTO_CALIBRATION)
+ // set the default number of probe points : n*n (1 -> 7)
+ #define DELTA_CALIBRATION_DEFAULT_POINTS 7
+ #endif
+
+ #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
+ // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
+ #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - MIN_PROBE_EDGE // (mm)
+ // Set the steprate for papertest probing
+ #define PROBE_MANUALLY_STEP 0.05 // (mm)
+ #endif
+
+ // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).
+ #define DELTA_PRINTABLE_RADIUS 130.0 // (mm)
+
+ // Center-to-center distance of the holes in the diagonal push rods.
+ #define DELTA_DIAGONAL_ROD 280.0 // (mm)
+ // Distance between bed and nozzle Z home position !!! YOU MUST DETERMINE THIS VALUE BY YOURSELF DURING G33 AND FOLLOWED Z-MIN-OFFSET TUNING !!!
+ // !!! THIS VALUE IS NOT A CONSTANT AND DEPEND ON DOZEN OF THINGS !!!
+ #define DELTA_HEIGHT 400.00 // (mm) Get this value from G33 auto calibrate
+
+ #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate
+
+ // Horizontal distance bridged by diagonal push rods when effector is centered.
+ #define DELTA_RADIUS 140.8 // (mm) Get this value from G33 auto calibrate
+ // Trim adjustments for individual towers
+ // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
+ // measured in degrees anticlockwise looking from above the printer
+ #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate
+
+ // Delta radius and diagonal rod adjustments (mm)
+ //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 }
+ //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 }
+
+#endif
+
//===========================================================================
//============================== Endstop Settings ===========================
//===========================================================================
@@ -582,12 +662,12 @@
// 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
// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.
-#define USE_XMIN_PLUG
-#define USE_YMIN_PLUG
-#define USE_ZMIN_PLUG
-//#define USE_XMAX_PLUG
-//#define USE_YMAX_PLUG
-//#define USE_ZMAX_PLUG
+//#define USE_XMIN_PLUG
+//#define USE_YMIN_PLUG
+#define USE_ZMIN_PLUG // a Z probe
+#define USE_XMAX_PLUG
+#define USE_YMAX_PLUG
+#define USE_ZMAX_PLUG
// Enable pullup for all endstops to prevent a floating state
#define ENDSTOPPULLUPS
@@ -618,11 +698,11 @@
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
#define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
-#define Z_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
+#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
-#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe.
+#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe.
/**
* Stepper Drivers
@@ -639,14 +719,14 @@
* TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
-//#define X_DRIVER_TYPE A4988
-//#define Y_DRIVER_TYPE A4988
-//#define Z_DRIVER_TYPE A4988
+#define X_DRIVER_TYPE A4988
+#define Y_DRIVER_TYPE A4988
+#define Z_DRIVER_TYPE A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
-//#define E0_DRIVER_TYPE A4988
+#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
@@ -676,6 +756,7 @@
//=============================================================================
// @section motion
+// delta speeds must be the same on xyz
/**
* Default Settings
*
@@ -696,14 +777,22 @@
* Override with M92
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
*/
-#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 4000, 500 }
+// variables to calculate steps
+#define XYZ_FULL_STEPS_PER_ROTATION 200
+#define XYZ_MICROSTEPS 16
+#define XYZ_BELT_PITCH 2
+#define XYZ_PULLEY_TEETH 16
+
+// delta speeds must be the same on xyz
+#define DEFAULT_XYZ_STEPS_PER_UNIT ((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH))
+#define DEFAULT_AXIS_STEPS_PER_UNIT { DEFAULT_XYZ_STEPS_PER_UNIT, DEFAULT_XYZ_STEPS_PER_UNIT, DEFAULT_XYZ_STEPS_PER_UNIT, 395 } // default steps per unit
/**
* Default Max Feed Rate (mm/s)
* Override with M203
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
*/
-#define DEFAULT_MAX_FEEDRATE { 300, 300, 5, 25 }
+#define DEFAULT_MAX_FEEDRATE { 200, 200, 200, 200}
/**
* Default Max Acceleration (change/s) change = mm/s
@@ -711,7 +800,7 @@
* Override with M201
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
*/
-#define DEFAULT_MAX_ACCELERATION { 3000, 3000, 100, 10000 }
+#define DEFAULT_MAX_ACCELERATION { 3000, 3000, 3000, 3000 }
/**
* Default Acceleration (change/s) change = mm/s
@@ -721,14 +810,14 @@
* M204 R Retract Acceleration
* M204 T Travel Acceleration
*/
-#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves
-#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
-#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
+#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves
+#define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration for retracts
+#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration for travel (non printing) moves
//
// Use Junction Deviation instead of traditional Jerk Limiting
//
-//#define JUNCTION_DEVIATION
+#define JUNCTION_DEVIATION
#if ENABLED(JUNCTION_DEVIATION)
#define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge
#endif
@@ -742,12 +831,12 @@
* value set here, it may happen instantaneously.
*/
#if DISABLED(JUNCTION_DEVIATION)
- #define DEFAULT_XJERK 10.0
- #define DEFAULT_YJERK 10.0
- #define DEFAULT_ZJERK 0.3
+ #define DEFAULT_XJERK 10.0
+ #define DEFAULT_YJERK DEFAULT_XJERK
+ #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta
#endif
-#define DEFAULT_EJERK 5.0 // May be used by Linear Advance
+#define DEFAULT_EJERK 10.0 // May be used by Linear Advance
/**
* S-Curve Acceleration
@@ -757,7 +846,7 @@
*
* See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained
*/
-//#define S_CURVE_ACCELERATION
+#define S_CURVE_ACCELERATION
//===========================================================================
//============================= Z Probe Options =============================
@@ -806,13 +895,13 @@
* or (with LCD_BED_LEVELING) the LCD controller.
*/
//#define PROBE_MANUALLY
-//#define MANUAL_PROBE_START_Z 0.2
+//#define MANUAL_PROBE_START_Z 1.5
/**
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
* (e.g., an inductive probe or a nozzle-based probe-switch.)
*/
-//#define FIX_MOUNTED_PROBE
+#define FIX_MOUNTED_PROBE
/**
* Z Servo Probe, such as an endstop switch on a rotating arm.
@@ -825,18 +914,14 @@
*/
//#define BLTOUCH
#if ENABLED(BLTOUCH)
- //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
+ //#define BLTOUCH_DELAY 500 // Minimum Command delay (ms). Enable and increase if needed
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
- //#define BLTOUCH_V3
- #if ENABLED(BLTOUCH_V3)
- //#define BLTOUCH_FORCE_5V_MODE
- //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE
- #endif
+ //#define BLTOUCH_FORCE_5V_MODE
#endif
// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN)
@@ -853,9 +938,52 @@
#define Z_PROBE_RETRACT_X X_MAX_POS
#endif
-//
-// For Z_PROBE_ALLEN_KEY see the Delta example configurations.
-//
+/**
+ * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe
+ * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN.
+ */
+//#define Z_PROBE_ALLEN_KEY
+
+#if ENABLED(Z_PROBE_ALLEN_KEY)
+ // 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29,
+ // if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe.
+
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_1_X 30.0
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Y DELTA_PRINTABLE_RADIUS
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Z 100.0
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_SPEED
+
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_2_X 0.0
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Y DELTA_PRINTABLE_RADIUS
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10
+
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
+ #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED
+
+ #define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0 // Move the probe into position
+ #define Z_PROBE_ALLEN_KEY_STOW_1_Y 56.0
+ #define Z_PROBE_ALLEN_KEY_STOW_1_Z 23.0
+ #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_SPEED
+
+ #define Z_PROBE_ALLEN_KEY_STOW_2_X -64.0 // Push it down
+ #define Z_PROBE_ALLEN_KEY_STOW_2_Y 56.0
+ #define Z_PROBE_ALLEN_KEY_STOW_2_Z 3.0
+ #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_SPEED)/10
+
+ #define Z_PROBE_ALLEN_KEY_STOW_3_X -64.0 // Move it up to clear
+ #define Z_PROBE_ALLEN_KEY_STOW_3_Y 56.0
+ #define Z_PROBE_ALLEN_KEY_STOW_3_Z 50.0
+ #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED
+
+ #define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0
+ #define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0
+ #define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z
+ #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED
+
+#endif // Z_PROBE_ALLEN_KEY
/**
* Z Probe to nozzle (X,Y) offset, relative to (0, 0).
@@ -876,26 +1004,26 @@
* O-- FRONT --+
* (0,0)
*/
-#define X_PROBE_OFFSET_FROM_EXTRUDER 10 // X offset: -left +right [of the nozzle]
-#define Y_PROBE_OFFSET_FROM_EXTRUDER 10 // Y offset: -front +behind [the nozzle]
-#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle]
+#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left +right [of the nozzle]
+#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front +behind [the nozzle]
+#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle]
// Certain types of probes need to stay away from edges
-#define MIN_PROBE_EDGE 10
+#define MIN_PROBE_EDGE 20
// X and Y axis travel speed (mm/m) between probes
-#define XY_PROBE_SPEED 8000
+#define XY_PROBE_SPEED 4000
// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2)
#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
// Feedrate (mm/m) for the "accurate" probe of each point
-#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
+#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 6)
// The number of probes to perform at each point.
// Set to 2 for a fast/slow probe, using the second probe result.
// Set to 3 or more for slow probes, averaging the results.
-//#define MULTIPLE_PROBING 2
+#define MULTIPLE_PROBING 3
/**
* Z probes require clearance when deploying, stowing, and moving between
@@ -911,10 +1039,10 @@
* Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle.
* But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle.
*/
-#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow
-#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points
-#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
-//#define Z_AFTER_PROBING 5 // Z position after probing is done
+#define Z_CLEARANCE_DEPLOY_PROBE 30 // Z Clearance for Deploy/Stow
+#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points
+#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
+#define Z_AFTER_PROBING 30 // Z position after probing is done
#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping
@@ -923,13 +1051,10 @@
#define Z_PROBE_OFFSET_RANGE_MAX 20
// Enable the M48 repeatability test to test probe accuracy
-//#define Z_MIN_PROBE_REPEATABILITY_TEST
+#define Z_MIN_PROBE_REPEATABILITY_TEST
// Before deploy/stow pause for user confirmation
//#define PAUSE_BEFORE_DEPLOY_STOW
-#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
- //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe
-#endif
/**
* Enable one or more of the following if probing seems unreliable.
@@ -944,7 +1069,7 @@
#endif
//#define PROBING_FANS_OFF // Turn fans off when probing
//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing
-//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors
+#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
// :{ 0:'Low', 1:'High' }
@@ -971,13 +1096,13 @@
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false
-#define INVERT_Y_DIR true
+#define INVERT_Y_DIR false
#define INVERT_Z_DIR false
// @section extruder
// For direct drive extruder v9 set to true, for geared extruder set to false.
-#define INVERT_E0_DIR false
+#define INVERT_E0_DIR true
#define INVERT_E1_DIR false
#define INVERT_E2_DIR false
#define INVERT_E3_DIR false
@@ -995,23 +1120,23 @@
// Direction of endstops when homing; 1=MAX, -1=MIN
// :[-1,1]
-#define X_HOME_DIR -1
-#define Y_HOME_DIR -1
-#define Z_HOME_DIR -1
+#define X_HOME_DIR 1 // deltas always home to max
+#define Y_HOME_DIR 1
+#define Z_HOME_DIR 1
// @section machine
// The size of the print bed
-#define X_BED_SIZE 200
-#define Y_BED_SIZE 200
+#define X_BED_SIZE ((DELTA_PRINTABLE_RADIUS) * 2)
+#define Y_BED_SIZE ((DELTA_PRINTABLE_RADIUS) * 2)
// Travel limits (mm) after homing, corresponding to endstop positions.
-#define X_MIN_POS 0
-#define Y_MIN_POS 0
+#define X_MIN_POS -(DELTA_PRINTABLE_RADIUS)
+#define Y_MIN_POS -(DELTA_PRINTABLE_RADIUS)
#define Z_MIN_POS 0
-#define X_MAX_POS X_BED_SIZE
-#define Y_MAX_POS Y_BED_SIZE
-#define Z_MAX_POS 200
+#define X_MAX_POS DELTA_PRINTABLE_RADIUS
+#define Y_MAX_POS DELTA_PRINTABLE_RADIUS
+#define Z_MAX_POS MANUAL_Z_HOME_POS
/**
* Software Endstops
@@ -1039,7 +1164,7 @@
#endif
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
- //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD
+ #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD
#endif
/**
@@ -1114,7 +1239,7 @@
*/
//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
-//#define AUTO_BED_LEVELING_BILINEAR
+#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING
@@ -1122,7 +1247,7 @@
* Normally G28 leaves leveling disabled on completion. Enable
* this option to have G28 restore the prior leveling state.
*/
-//#define RESTORE_LEVELING_AFTER_G28
+#define RESTORE_LEVELING_AFTER_G28
/**
* Enable detailed logging of G28, G29, M48, etc.
@@ -1135,7 +1260,7 @@
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
- #define ENABLE_LEVELING_FADE_HEIGHT
+ //#define ENABLE_LEVELING_FADE_HEIGHT
// For Cartesian machines, instead of dividing moves on mesh boundaries,
// split up moves into short segments like a Delta. This follows the
@@ -1146,12 +1271,12 @@
/**
* Enable the G26 Mesh Validation Pattern tool.
*/
- //#define G26_MESH_VALIDATION
+ #define G26_MESH_VALIDATION
#if ENABLED(G26_MESH_VALIDATION)
#define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle.
- #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool.
- #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool.
- #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool.
+ #define MESH_TEST_LAYER_HEIGHT 0.3 // (mm) Default layer height for the G26 Mesh Validation Tool.
+ #define MESH_TEST_HOTEND_TEMP 240 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool.
+ #define MESH_TEST_BED_TEMP 80 // (°C) Default bed temperature for the G26 Mesh Validation Tool.
#define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool.
#endif
@@ -1160,14 +1285,15 @@
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension.
- #define GRID_MAX_POINTS_X 3
+ // Works best with 5 or more points in each dimension.
+ #define GRID_MAX_POINTS_X 9
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
// Set the boundaries for probing (where the probe can reach).
- //#define LEFT_PROBE_BED_POSITION MIN_PROBE_EDGE
- //#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - (MIN_PROBE_EDGE))
- //#define FRONT_PROBE_BED_POSITION MIN_PROBE_EDGE
- //#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - (MIN_PROBE_EDGE))
+ #define LEFT_PROBE_BED_POSITION -(DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE))
+ #define RIGHT_PROBE_BED_POSITION DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE)
+ #define FRONT_PROBE_BED_POSITION -(DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE))
+ #define BACK_PROBE_BED_POSITION DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE)
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
@@ -1226,23 +1352,24 @@
* Points to probe for all 3-point Leveling procedures.
* Override if the automatically selected points are inadequate.
*/
+// ADJUST THIS FOR FLSUN QQ-S IF HAVE PLANS TO USE IT!!!
#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL)
- //#define PROBE_PT_1_X 15
- //#define PROBE_PT_1_Y 180
- //#define PROBE_PT_2_X 15
- //#define PROBE_PT_2_Y 20
- //#define PROBE_PT_3_X 170
- //#define PROBE_PT_3_Y 20
+ #define PROBE_PT_1_X -40
+ #define PROBE_PT_1_Y 60
+ #define PROBE_PT_2_X 40
+ #define PROBE_PT_2_Y 60
+ #define PROBE_PT_3_X 0
+ #define PROBE_PT_3_Y -70
#endif
/**
* Add a bed leveling sub-menu for ABL or MBL.
* Include a guided procedure if manual probing is enabled.
*/
-//#define LCD_BED_LEVELING
+#define LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING)
- #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis.
+ #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis.
#define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment
//#define MESH_EDIT_MENU // Add a menu to edit mesh points
#endif
@@ -1261,19 +1388,19 @@
* Commands to execute at the end of G29 probing.
* Useful to retract or move the Z probe out of the way.
*/
-//#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10"
+#define Z_PROBE_END_SCRIPT "G0 Z30 F12000\n G0 X0 Y0 Z30"
// @section homing
// The center of the bed is at (X=0, Y=0)
-//#define BED_CENTER_AT_0_0
+#define BED_CENTER_AT_0_0
// Manually set the home position. Leave these undefined for automatic settings.
// For DELTA this is the top-center of the Cartesian print volume.
//#define MANUAL_X_HOME_POS 0
//#define MANUAL_Y_HOME_POS 0
-//#define MANUAL_Z_HOME_POS 0
+#define MANUAL_Z_HOME_POS DELTA_HEIGHT // Distance between the nozzle to printbed after homing
// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area.
//
@@ -1291,9 +1418,9 @@
#define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28).
#endif
-// Homing speeds (mm/m)
-#define HOMING_FEEDRATE_XY (50*60)
-#define HOMING_FEEDRATE_Z (4*60)
+// Delta only homes to Z
+// Homing speeds (mm/m)
+#define HOMING_FEEDRATE_Z (50*60)
// Validate that endstops are triggered on homing moves
#define VALIDATE_HOMING_ENDSTOPS
@@ -1361,17 +1488,21 @@
// @section extras
-//
-// EEPROM
-//
-// The microcontroller can store settings in the EEPROM, e.g. max velocity...
-// M500 - stores parameters in EEPROM
-// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
-// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
-//
-//#define EEPROM_SETTINGS // Enable for M500 and M501 commands
-//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
-#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
+/**
+ * EEPROM
+ *
+ * Persistent storage to preserve configurable settings across reboots.
+ *
+ * M500 - Store settings to EEPROM.
+ * M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes)
+ * M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
+ */
+#define EEPROM_SETTINGS // Persistent storage with M500 and M501
+//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
+#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
+#if ENABLED(EEPROM_SETTINGS)
+ //#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
+#endif
//
// Host Keepalive
@@ -1379,9 +1510,9 @@
// When enabled Marlin will send a busy status message to the host
// every couple of seconds when it can't accept commands.
//
-#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
-#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
-#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
+//#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
+//#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
+//#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
//
// M100 Free Memory Watcher
@@ -1402,15 +1533,24 @@
// Preheat Constants
#define PREHEAT_1_LABEL "PLA"
-#define PREHEAT_1_TEMP_HOTEND 180
-#define PREHEAT_1_TEMP_BED 70
+#define PREHEAT_1_TEMP_HOTEND 210
+#define PREHEAT_1_TEMP_BED 60
#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255
-#define PREHEAT_2_LABEL "ABS"
-#define PREHEAT_2_TEMP_HOTEND 240
-#define PREHEAT_2_TEMP_BED 110
+#define PREHEAT_2_LABEL "SBS"
+#define PREHEAT_2_TEMP_HOTEND 220
+#define PREHEAT_2_TEMP_BED 80
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
+#define PREHEAT_3_LABEL "PETG"
+#define PREHEAT_3_TEMP_HOTEND 240
+#define PREHEAT_3_TEMP_BED 80
+#define PREHEAT_3_FAN_SPEED 0 // Value from 0 to 255
+
+#define PREHEAT_4_LABEL "ABS"
+#define PREHEAT_4_TEMP_HOTEND 240
+#define PREHEAT_4_TEMP_BED 110
+#define PREHEAT_4_FAN_SPEED 0 // Value from 0 to 255
/**
* Nozzle Park
*
@@ -1426,9 +1566,9 @@
#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise }
- #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }
+ #define NOZZLE_PARK_POINT { 0, 0, 20 }
#define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis)
- #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers)
+ #define NOZZLE_PARK_Z_FEEDRATE 100 // (mm/s) Z axis feedrate (not used for delta printers)
#endif
/**
@@ -1522,7 +1662,7 @@
*
* View the current statistics with M78.
*/
-//#define PRINTCOUNTER
+#define PRINTCOUNTER
//=============================================================================
//============================= LCD and SD support ============================
@@ -1580,7 +1720,8 @@
* you must uncomment the following option or it won't work.
*
*/
-//#define SDSUPPORT
+#define SDSUPPORT
+#define SDIO_SUPPORT
/**
* SD CARD: SPI SPEED
@@ -1614,7 +1755,7 @@
// This option overrides the default number of encoder pulses needed to
// produce one step. Should be increased for high-resolution encoders.
//
-//#define ENCODER_PULSES_PER_STEP 4
+//#define ENCODER_PULSES_PER_STEP 3
//
// Use this option to override the number of step signals required to
@@ -1968,7 +2109,8 @@
//
// MKS Robin 320x240 color display
//
-//#define MKS_ROBIN_TFT
+#define MKS_ROBIN_TFT
+//#define PRINTER_EVENT_LEDS
//=============================================================================
//============================ Other Controllers ============================
@@ -2009,14 +2151,14 @@
// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not as annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE.
-//#define FAN_SOFT_PWM
+#define FAN_SOFT_PWM
// Incrementing this by 1 will double the software PWM frequency,
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
// However, control resolution will be halved for each increment;
// at zero value, there are 128 effective control positions.
// :[0,1,2,3,4,5,6,7]
-#define SOFT_PWM_SCALE 0
+#define SOFT_PWM_SCALE 1
// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can
// be used to mitigate the associated resolution loss. If enabled,
@@ -2071,10 +2213,10 @@
//#define RGBW_LED
#if EITHER(RGB_LED, RGBW_LED)
- //#define RGB_LED_R_PIN 34
- //#define RGB_LED_G_PIN 43
- //#define RGB_LED_B_PIN 35
- //#define RGB_LED_W_PIN -1
+ #define RGB_LED_R_PIN 34
+ #define RGB_LED_G_PIN 43
+ #define RGB_LED_B_PIN 35
+ #define RGB_LED_W_PIN -1
#endif
// Support for Adafruit Neopixel LED driver
@@ -2127,3 +2269,9 @@
// Allow servo angle to be edited and saved to EEPROM
//#define EDITABLE_SERVO_ANGLES
+
+//Vref PWM control, obsolete, use native marlin HAS_MOTOR_CURRENT_PWM
+
+//#define VREF_XY_VALUE 1000
+//#define VREF_Z_VALUE 1000
+//#define VREF_E1_VALUE 1000
diff --git a/marlin-original-clean/Marlin/Configuration_adv.h b/marlin-qq-clean/Marlin/Configuration_adv.h
index ee60630..d2a0403 100644
--- a/marlin-original-clean/Marlin/Configuration_adv.h
+++ b/marlin-qq-clean/Marlin/Configuration_adv.h
@@ -39,6 +39,57 @@
//=============================Thermal Settings ============================
//===========================================================================
+//
+// Custom Thermistor 1000 parameters
+//
+#if TEMP_SENSOR_0 == 1000
+ #define HOTEND0_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define HOTEND0_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define HOTEND0_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_1 == 1000
+ #define HOTEND1_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define HOTEND1_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define HOTEND1_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_2 == 1000
+ #define HOTEND2_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define HOTEND2_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define HOTEND2_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_3 == 1000
+ #define HOTEND3_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define HOTEND3_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define HOTEND3_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_4 == 1000
+ #define HOTEND4_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define HOTEND4_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define HOTEND4_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_5 == 1000
+ #define HOTEND5_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define HOTEND5_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define HOTEND5_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_BED == 1000
+ #define BED_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define BED_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define BED_BETA 3950 // Beta value
+#endif
+
+#if TEMP_SENSOR_CHAMBER == 1000
+ #define CHAMBER_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
+ #define CHAMBER_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
+ #define CHAMBER_BETA 3950 // Beta value
+#endif
+
//
// Hephestos 2 24V heated bed upgrade kit.
// https://store.bq.com/en/heated-bed-kit-hephestos2
@@ -57,7 +108,6 @@
#define CHAMBER_MINTEMP 5
#define CHAMBER_MAXTEMP 60
#define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target
- #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
//#define CHAMBER_LIMIT_SWITCHING
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
//#define HEATER_CHAMBER_INVERTING false
@@ -237,7 +287,7 @@
// When first starting the main fan, run it at full speed for the
// given number of milliseconds. This gets the fan spinning reliably
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
-//#define FAN_KICKSTART_TIME 100
+#define FAN_KICKSTART_TIME 100
/**
* PWM Fan Scaling
@@ -466,8 +516,8 @@
// Homing hits each endstop, retracts by these distances, then does a slower bump.
#define X_HOME_BUMP_MM 5
#define Y_HOME_BUMP_MM 5
-#define Z_HOME_BUMP_MM 2
-#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
+#define Z_HOME_BUMP_MM 5 // deltas need the same for all three axes
+#define HOMING_BUMP_DIVISOR { 10, 10, 10 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially
//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing
@@ -514,7 +564,7 @@
// Default stepper release if idle. Set to 0 to deactivate.
// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true.
// Time can be set by M18 and M84.
-#define DEFAULT_STEPPER_DEACTIVE_TIME 120
+#define DEFAULT_STEPPER_DEACTIVE_TIME 60
#define DISABLE_INACTIVE_X true
#define DISABLE_INACTIVE_Y true
#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished.
@@ -528,7 +578,8 @@
// @section lcd
#if ENABLED(ULTIPANEL)
- #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
+ #define MANUAL_FEEDRATE_XYZ 50*60
+ #define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // Feedrates for manual moves along X, Y, Z, E from panel
#define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions
#define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder
#endif
@@ -539,7 +590,8 @@
#define DEFAULT_MINSEGMENTTIME 20000
// If defined the movements slow down when the look ahead buffer is only half full
-#define SLOWDOWN
+// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second)
+//#define SLOWDOWN
// Frequency limit
// See nophead's blog for more info
@@ -692,7 +744,6 @@
* A (A shifted) B (B shifted) IC
* Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451
* AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451
- * AZTEEG_X5_MINI 0x2C (0x58) 0x2E (0x5C) MCP4451
* AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451
* MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018
*/
@@ -727,7 +778,7 @@
#endif
// Include a page of printer information in the LCD Main Menu
-//#define LCD_INFO_MENU
+#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
@@ -736,7 +787,7 @@
//#define LCD_DECIMAL_SMALL_XY
// The timeout (in ms) to return to the status screen from sub-menus
-//#define LCD_TIMEOUT_TO_STATUS 15000
+#define LCD_TIMEOUT_TO_STATUS 15000
// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY
@@ -776,7 +827,7 @@
// as SD_DETECT_PIN in your board's pins definitions.
// This setting should be disabled unless you are using a push button, pulling the pin to ground.
// Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER).
- #define SD_DETECT_INVERTED
+ //#define SD_DETECT_INVERTED
#define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place.
@@ -789,7 +840,7 @@
//#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files
- #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
+ //#define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
/**
* Continue after Power-Loss (Creality3D)
@@ -801,8 +852,10 @@
*/
//#define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY)
- //#define POWER_LOSS_PIN 44 // Pin to detect power loss
- //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
+ //#define POWER_LOSS_PIN 44 // Pin to detect power loss
+ //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
+ //#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
+ //#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
// especially with "vase mode" printing. Set too high and vases cannot be continued.
@@ -848,10 +901,10 @@
#endif
// This allows hosts to request long names for files and folders with M33
- //#define LONG_FILENAME_HOST_SUPPORT
+ #define LONG_FILENAME_HOST_SUPPORT
// Enable this option to scroll long filenames in the SD card menu
- //#define SCROLL_LONG_FILENAMES
+ #define SCROLL_LONG_FILENAMES
/**
* This option allows you to abort SD printing when any endstop is triggered.
@@ -1026,18 +1079,18 @@
*
* Warning: Does not respect endstops!
*/
-//#define BABYSTEPPING
+#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
//#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
#define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion.
- //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
+ #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency.
- #define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
+ //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
#if ENABLED(MOVE_Z_WHEN_IDLE)
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.
@@ -1071,10 +1124,11 @@
* See http://marlinfw.org/docs/features/lin_advance.html for full instructions.
* Mention @Sebastianv650 on GitHub to alert the author of any issues.
*/
-//#define LIN_ADVANCE
+#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
- #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
+ //#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
+ #define LIN_ADVANCE_K 0.00 // disabled by default
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
@@ -1344,27 +1398,28 @@
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
// This short retract is done immediately, before parking the nozzle.
- #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast.
+ #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 40 // (mm/s) Unload filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
- #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload.
+ #define FILAMENT_CHANGE_UNLOAD_LENGTH 750 // (mm) The length of filament for a complete unload.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
// Set to 0 for manual unloading.
#define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load.
#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material.
// 0 to disable start loading and skip to fast load only
- #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast.
+ #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 40 // (mm/s) Load filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
- #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle.
+ #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 650 // (mm) Load length of filament, from extruder gear to nozzle.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
- //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.
+ #define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.
#define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
- #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading.
+ #define ADVANCED_PAUSE_PURGE_LENGTH 150 // (mm) Length to extrude after loading.
// Set to 0 for manual extrusion.
// Filament can be extruded repeatedly from the Filament Change menu
// until extrusion is consistent, and to purge old filament.
#define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park.
+ //#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
// Filament Unload does a Retract, Delay, and Purge first:
#define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length.
@@ -1375,10 +1430,10 @@
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
- //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
- //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change
+ #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
+ #define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change
- //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
+ #define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
#endif
diff --git a/marlin-original-clean/Marlin/Makefile b/marlin-original-clean/Marlin/Makefile
deleted file mode 100644
index a62bccd..0000000
--- a/marlin-original-clean/Marlin/Makefile
+++ /dev/null
@@ -1,844 +0,0 @@
-# Marlin Firmware Arduino Project Makefile
-#
-# Makefile Based on:
-# Arduino 0011 Makefile
-# Arduino adaptation by mellis, eighthave, oli.keller
-# Marlin adaption by Daid
-# Marlin 2.0 support and RELOC_WORKAROUND by @marcio-ao
-#
-# This has been tested with Arduino 0022.
-#
-# This makefile allows you to build sketches from the command line
-# without the Arduino environment (or Java).
-#
-# Detailed instructions for using the makefile:
-#
-# 1. Modify the line containing "ARDUINO_INSTALL_DIR" to point to the directory that
-# contains the Arduino installation (for example, under Mac OS X, this
-# might be /Applications/Arduino.app/Contents/Resources/Java).
-#
-# 2. Modify the line containing "UPLOAD_PORT" to refer to the filename
-# representing the USB or serial connection to your Arduino board
-# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
-# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
-#
-# 3. Set the line containing "MCU" to match your board's processor.
-# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
-# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
-# change F_CPU to 8000000. If you are using Gen7 electronics, you
-# probably need to use 20000000. Either way, you must regenerate
-# the speed lookup table with create_speed_lookuptable.py.
-#
-# 4. Type "make" and press enter to compile/verify your program.
-#
-# 5. Type "make upload", reset your Arduino board, and press enter to
-# upload your program to the Arduino board.
-#
-# Note that all settings at the top of this file can be overriden from
-# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
-#
-# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
-#
-# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
-# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
-#
-# To compile and upload simply add "upload" to the end of the line...
-#
-# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
-# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
-#
-# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
-# start upload manually (using stk500) like so:
-#
-# avrdude -C /root/arduino/hardware/tools/avr/etc/avrdude.conf -v -p m2560 -c stk500 \
-# -U flash:w:applet/Marlin.hex:i -P /dev/ttyUSB0
-#
-# Or, try disconnecting USB to power down and then reconnecting before running avrdude.
-#
-
-# This defines the board to compile for (see boards.h for your board's ID)
-HARDWARE_MOTHERBOARD ?= 11
-
-# Arduino source install directory, and version number
-# On most linuxes this will be /usr/share/arduino
-ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
-ARDUINO_VERSION ?= 106
-
-# The installed Libraries are in the User folder
-ARDUINO_USER_DIR ?= ${HOME}/Arduino
-
-# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
-AVR_TOOLS_PATH ?=
-
-#Programmer configuration
-UPLOAD_RATE ?= 57600
-AVRDUDE_PROGRAMMER ?= arduino
-# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
-UPLOAD_PORT ?= /dev/ttyUSB0
-
-#Directory used to build files in, contains all the build files, from object files to the final hex file
-#on linux it is best to put an absolute path like /home/username/tmp .
-BUILD_DIR ?= applet
-
-# This defines whether Liquid_TWI2 support will be built
-LIQUID_TWI2 ?= 0
-
-# this defines if Wire is needed
-WIRE ?= 0
-
-# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
-U8GLIB ?= 1
-
-# this defines whether to include the Trinamic TMCStepper library
-TMC ?= 1
-
-############
-# Try to automatically determine whether RELOC_WORKAROUND is needed based
-# on GCC versions:
-# http://www.avrfreaks.net/comment/1789106#comment-1789106
-
-CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
-CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
-CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ )
-CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) )))
-ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1)
- @echo This version of GCC is likely broken. Enabling relocation workaround.
- RELOC_WORKAROUND = 1
-endif
-
-############################################################################
-# Below here nothing should be changed...
-
-# Here the Arduino variant is selected by the board type
-# HARDWARE_VARIANT = "arduino", "Sanguino", "Gen7", ...
-# MCU = "atmega1280", "Mega2560", "atmega2560", "atmega644p", ...
-
-ifeq ($(HARDWARE_MOTHERBOARD),0)
-
- # No motherboard selected
-
-#
-# RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560
-#
-
-# MEGA/RAMPS up to 1.2
-else ifeq ($(HARDWARE_MOTHERBOARD),3)
-
-# RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
-else ifeq ($(HARDWARE_MOTHERBOARD),33)
-# RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
-else ifeq ($(HARDWARE_MOTHERBOARD),34)
-# RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
-else ifeq ($(HARDWARE_MOTHERBOARD),35)
-# RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
-else ifeq ($(HARDWARE_MOTHERBOARD),36)
-# RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
-else ifeq ($(HARDWARE_MOTHERBOARD),38)
-
-# RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
-else ifeq ($(HARDWARE_MOTHERBOARD),43)
-# RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
-else ifeq ($(HARDWARE_MOTHERBOARD),44)
-# RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
-else ifeq ($(HARDWARE_MOTHERBOARD),45)
-# RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
-else ifeq ($(HARDWARE_MOTHERBOARD),46)
-# RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
-else ifeq ($(HARDWARE_MOTHERBOARD),48)
-
-# RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed)
-else ifeq ($(HARDWARE_MOTHERBOARD),143)
-# RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed)
-else ifeq ($(HARDWARE_MOTHERBOARD),144)
-# RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1)
-else ifeq ($(HARDWARE_MOTHERBOARD),145)
-# RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan)
-else ifeq ($(HARDWARE_MOTHERBOARD),146)
-# RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
-else ifeq ($(HARDWARE_MOTHERBOARD),148)
-
-#
-# RAMPS Derivatives - ATmega1280, ATmega2560
-#
-
-# 3Drag Controller
-else ifeq ($(HARDWARE_MOTHERBOARD),77)
-# Velleman K8200 Controller (derived from 3Drag Controller)
-else ifeq ($(HARDWARE_MOTHERBOARD),78)
-# Velleman K8400 Controller (derived from 3Drag Controller)
-else ifeq ($(HARDWARE_MOTHERBOARD),79)
-# 2PrintBeta BAM&DICE with STK drivers
-else ifeq ($(HARDWARE_MOTHERBOARD),401)
-# 2PrintBeta BAM&DICE Due with STK drivers
-else ifeq ($(HARDWARE_MOTHERBOARD),402)
-# MKS BASE v1.0
-else ifeq ($(HARDWARE_MOTHERBOARD),40)
-# MKS v1.5 with Allegro A4982 stepper drivers
-else ifeq ($(HARDWARE_MOTHERBOARD),405)
-# MKS BASE 1.0 with Heroic HR4982 stepper drivers
-else ifeq ($(HARDWARE_MOTHERBOARD),41)
-# MKS GEN v1.3 or 1.4
-else ifeq ($(HARDWARE_MOTHERBOARD),47)
-# MKS GEN L
-else ifeq ($(HARDWARE_MOTHERBOARD),53)
-# zrib V2.0 control board (Chinese knock off RAMPS replica)
-else ifeq ($(HARDWARE_MOTHERBOARD),504)
-# Felix 2.0+ Electronics Board (RAMPS like)
-else ifeq ($(HARDWARE_MOTHERBOARD),37)
-# Invent-A-Part RigidBoard
-else ifeq ($(HARDWARE_MOTHERBOARD),42)
-# Invent-A-Part RigidBoard V2
-else ifeq ($(HARDWARE_MOTHERBOARD),52)
-# Sainsmart 2-in-1 board
-else ifeq ($(HARDWARE_MOTHERBOARD),49)
-# Ultimaker
-else ifeq ($(HARDWARE_MOTHERBOARD),7)
-# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
-else ifeq ($(HARDWARE_MOTHERBOARD),71)
- MCU ?= atmega1280
-
-# Azteeg X3
-else ifeq ($(HARDWARE_MOTHERBOARD),67)
-# Azteeg X3 Pro
-else ifeq ($(HARDWARE_MOTHERBOARD),68)
-# Ultimainboard 2.x (Uses TEMP_SENSOR 20)
-else ifeq ($(HARDWARE_MOTHERBOARD),72)
-# Rumba
-else ifeq ($(HARDWARE_MOTHERBOARD),80)
-# Raise3D Rumba
-else ifeq ($(HARDWARE_MOTHERBOARD),333)
-# Rapide Lite RL200 Rumba
-else ifeq ($(HARDWARE_MOTHERBOARD),801)
-# Formbot T-Rex 2 Plus
-else ifeq ($(HARDWARE_MOTHERBOARD),95)
-# Formbot T-Rex 3
-else ifeq ($(HARDWARE_MOTHERBOARD),96)
-# Formbot Raptor
-else ifeq ($(HARDWARE_MOTHERBOARD),97)
-# Formbot Raptor 2
-else ifeq ($(HARDWARE_MOTHERBOARD),98)
-# bq ZUM Mega 3D
-else ifeq ($(HARDWARE_MOTHERBOARD),503)
-# MakeBoard Mini v2.1.2 is a control board sold by MicroMake
-else ifeq ($(HARDWARE_MOTHERBOARD),431)
-# TriGorilla Anycubic version 1.3 based on RAMPS EFB
-else ifeq ($(HARDWARE_MOTHERBOARD),343)
-# TriGorilla Anycubic version 1.4 based on RAMPS EFB
-else ifeq ($(HARDWARE_MOTHERBOARD),443)
-# Creality: Ender-4, CR-8
-else ifeq ($(HARDWARE_MOTHERBOARD),243)
-# Creality: CR10S, CR20, CR-X
-else ifeq ($(HARDWARE_MOTHERBOARD),244)
-# Fysetc F6
-else ifeq ($(HARDWARE_MOTHERBOARD),541)
-# Duplicator i3 Plus
-else ifeq ($(HARDWARE_MOTHERBOARD),31)
-# VORON
-else ifeq ($(HARDWARE_MOTHERBOARD),441)
-# TRONXY V3 1.0
-else ifeq ($(HARDWARE_MOTHERBOARD),442)
-
-#
-# Other ATmega1280, ATmega2560
-#
-
-# Cartesio CN Controls V11
-else ifeq ($(HARDWARE_MOTHERBOARD),111)
-# Cartesio CN Controls V12
-else ifeq ($(HARDWARE_MOTHERBOARD),112)
-# Cheaptronic v1.0
-else ifeq ($(HARDWARE_MOTHERBOARD),2)
-# Cheaptronic v2.0
-else ifeq ($(HARDWARE_MOTHERBOARD),21)
-# Makerbot Mightyboard Revision E
-else ifeq ($(HARDWARE_MOTHERBOARD),200)
-# Megatronics
-else ifeq ($(HARDWARE_MOTHERBOARD),70)
-# Megatronics v2.0
-else ifeq ($(HARDWARE_MOTHERBOARD),701)
-# Megatronics v3.0
-else ifeq ($(HARDWARE_MOTHERBOARD),703)
-# Megatronics v3.1
-else ifeq ($(HARDWARE_MOTHERBOARD),704)
-# Rambo
-else ifeq ($(HARDWARE_MOTHERBOARD),301)
-# Mini-Rambo
-else ifeq ($(HARDWARE_MOTHERBOARD),302)
-# Mini-Rambo 1.0a
-else ifeq ($(HARDWARE_MOTHERBOARD),303)
-# Einsy Rambo
-else ifeq ($(HARDWARE_MOTHERBOARD),304)
-# Einsy Retro
-else ifeq ($(HARDWARE_MOTHERBOARD),305)
-# Elefu Ra Board (v3)
-else ifeq ($(HARDWARE_MOTHERBOARD),21)
-# Leapfrog
-else ifeq ($(HARDWARE_MOTHERBOARD),999)
-# Mega controller
-else ifeq ($(HARDWARE_MOTHERBOARD),310)
-# abee Scoovo X9H
-else ifeq ($(HARDWARE_MOTHERBOARD),321)
-# Geeetech GT2560 Rev B for Mecreator2
-else ifeq ($(HARDWARE_MOTHERBOARD),73)
-# Geeetech GT2560 Rev. A
-else ifeq ($(HARDWARE_MOTHERBOARD),74)
-# Geeetech GT2560 Rev. A+ (with auto level probe)
-else ifeq ($(HARDWARE_MOTHERBOARD),75)
-# Geeetech GT2560 Rev B for A10(M/D)
-else ifeq ($(HARDWARE_MOTHERBOARD),76)
-# Geeetech GT2560 Rev B for A20(M/D)
-else ifeq ($(HARDWARE_MOTHERBOARD),86)
-
-#
-# ATmega1281, ATmega2561
-#
-
-else ifeq ($(HARDWARE_MOTHERBOARD),702)
- MCU ?= atmega1281
-else ifeq ($(HARDWARE_MOTHERBOARD),25)
- MCU ?= atmega1281
-
-#
-# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
-#
-
-# Sanguinololu < 1.2
-else ifeq ($(HARDWARE_MOTHERBOARD),6)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-# Sanguinololu 1.2 and above
-else ifeq ($(HARDWARE_MOTHERBOARD),62)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-# Melzi
-else ifeq ($(HARDWARE_MOTHERBOARD),63)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-# Melzi with ATmega1284 (MaKr3d version)
-else ifeq ($(HARDWARE_MOTHERBOARD),66)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-# Melzi Creality3D board (for CR-10 etc)
-else ifeq ($(HARDWARE_MOTHERBOARD),89)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-# Melzi Malyan M150 board
-else ifeq ($(HARDWARE_MOTHERBOARD),92)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-# Tronxy X5S
-else ifeq ($(HARDWARE_MOTHERBOARD),505)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-# STB V1.1
-else ifeq ($(HARDWARE_MOTHERBOARD),64)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-# Azteeg X1
-else ifeq ($(HARDWARE_MOTHERBOARD),65)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-# Anet 1.0 (Melzi clone)
-else ifeq ($(HARDWARE_MOTHERBOARD),69)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega1284p
-
-#
-# Other ATmega644P, ATmega644, ATmega1284P
-#
-
-# Gen3 Monolithic Electronics
-else ifeq ($(HARDWARE_MOTHERBOARD),22)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-# Gen3+
-else ifeq ($(HARDWARE_MOTHERBOARD),9)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-# Gen6
-else ifeq ($(HARDWARE_MOTHERBOARD),5)
- HARDWARE_VARIANT ?= Gen6
- MCU ?= atmega644p
-# Gen6 deluxe
-else ifeq ($(HARDWARE_MOTHERBOARD),51)
- HARDWARE_VARIANT ?= Gen6
- MCU ?= atmega644p
-# Gen7 custom (Alfons3 Version)
-else ifeq ($(HARDWARE_MOTHERBOARD),10)
- HARDWARE_VARIANT ?= Gen7
- MCU ?= atmega644
- F_CPU ?= 20000000
-# Gen7 v1.1, v1.2
-else ifeq ($(HARDWARE_MOTHERBOARD),11)
- HARDWARE_VARIANT ?= Gen7
- MCU ?= atmega644p
- F_CPU ?= 20000000
-# Gen7 v1.3
-else ifeq ($(HARDWARE_MOTHERBOARD),12)
- HARDWARE_VARIANT ?= Gen7
- MCU ?= atmega644p
- F_CPU ?= 20000000
-# Gen7 v1.4
-else ifeq ($(HARDWARE_MOTHERBOARD),13)
- HARDWARE_VARIANT ?= Gen7
- MCU ?= atmega1284p
- F_CPU ?= 20000000
-# Alpha OMCA board
-else ifeq ($(HARDWARE_MOTHERBOARD),90)
- HARDWARE_VARIANT ?= SanguinoA
- MCU ?= atmega644
-# Final OMCA board
-else ifeq ($(HARDWARE_MOTHERBOARD),91)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-# Sethi 3D_1
-else ifeq ($(HARDWARE_MOTHERBOARD),20)
- HARDWARE_VARIANT ?= Sanguino
- MCU ?= atmega644p
-
-#
-# Teensyduino - AT90USB1286, AT90USB1286P
-#
-
-# Teensylu
-else ifeq ($(HARDWARE_MOTHERBOARD),8)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-# Printrboard (AT90USB1286)
-else ifeq ($(HARDWARE_MOTHERBOARD),81)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-# Printrboard Revision F (AT90USB1286)
-else ifeq ($(HARDWARE_MOTHERBOARD),811)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-# Brainwave (AT90USB646)
-else ifeq ($(HARDWARE_MOTHERBOARD),82)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb646
-# Brainwave Pro (AT90USB1286)
-else ifeq ($(HARDWARE_MOTHERBOARD),83)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-# SAV Mk-I (AT90USB1286)
-else ifeq ($(HARDWARE_MOTHERBOARD),84)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-# Teensy++2.0 (AT90USB1286)
-else ifeq ($(HARDWARE_MOTHERBOARD),85)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-# 5DPrint D8 Driver Board
-else ifeq ($(HARDWARE_MOTHERBOARD),88)
- HARDWARE_VARIANT ?= Teensy
- MCU ?= at90usb1286
-
-# UltiMachine Archim1 (with DRV8825 drivers)
-else ifeq ($(HARDWARE_MOTHERBOARD),1591)
- HARDWARE_VARIANT ?= archim
- MCPU = cortex-m3
- F_CPU = 84000000L
- IS_MCU = 0
-# UltiMachine Archim2 (with TMC2130 drivers)
-else ifeq ($(HARDWARE_MOTHERBOARD),1592)
- HARDWARE_VARIANT ?= archim
- MCPU = cortex-m3
- F_CPU = 84000000L
- IS_MCU = 0
-endif
-
-# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
-# if you are setting this to something other than 16MHz
-# Set to 16Mhz if not yet set.
-F_CPU ?= 16000000
-
-# Set to microcontroller if IS_MCU not yet set
-IS_MCU ?= 1
-
-ifeq ($(IS_MCU),1)
- # Set to arduino, ATmega2560 if not yet set.
- HARDWARE_VARIANT ?= arduino
- MCU ?= atmega2560
-
- TOOL_PREFIX = avr
- MCU_FLAGS = -mmcu=$(MCU)
- SIZE_FLAGS = --mcu=$(MCU) -C
-else
- TOOL_PREFIX = arm-none-eabi
- CPU_FLAGS = -mthumb -mcpu=$(MCPU)
- SIZE_FLAGS = -A
-endif
-
-# Arduino contained the main source code for the Arduino
-# Libraries, the "hardware variant" are for boards
-# that derives from that, and their source are present in
-# the main Marlin source directory
-
-TARGET = $(notdir $(CURDIR))
-
-# VPATH tells make to look into these directory for source files,
-# there is no need to specify explicit pathnames as long as the
-# directory is added here
-
-# The Makefile for previous versions of Marlin used VPATH for all
-# source files, but for Marlin 2.0, we use VPATH only for arduino
-# library files.
-
-VPATH = .
-VPATH += $(BUILD_DIR)
-VPATH += $(HARDWARE_SRC)
-
-ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
-endif
-
-ifeq ($(IS_MCU),1)
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
-
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
-endif
-
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
-ifeq ($(LIQUID_TWI2), 1)
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
-endif
-ifeq ($(WIRE), 1)
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
-endif
-ifeq ($(NEOPIXEL), 1)
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
-endif
-ifeq ($(U8GLIB), 1)
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/csrc
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/cppsrc
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/fntsrc
-endif
-ifeq ($(TMC), 1)
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src/source
-endif
-
-ifeq ($(HARDWARE_VARIANT), arduino)
- HARDWARE_SUB_VARIANT ?= mega
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
-else ifeq ($(HARDWARE_VARIANT), Sanguino)
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino
-else ifeq ($(HARDWARE_VARIANT), archim)
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/libsam
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/CMSIS/Include/
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/Device/ATMEL/
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/avr
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib
- VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
- LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
- LDLIBS = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
-else
- HARDWARE_SUB_VARIANT ?= standard
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
-endif
-
-LIB_SRC = wiring.c \
- wiring_analog.c wiring_digital.c \
- wiring_shift.c WInterrupts.c hooks.c
-
-ifeq ($(HARDWARE_VARIANT), archim)
- LIB_ASRC += wiring_pulse_asm.S
-else
- LIB_SRC += wiring_pulse.c
-endif
-
-ifeq ($(HARDWARE_VARIANT), Teensy)
- LIB_SRC = wiring.c
- VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
-endif
-
-LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp
-
-ifeq ($(NEOPIXEL), 1)
- LIB_CXXSRC += Adafruit_NeoPixel.cpp
-endif
-
-ifeq ($(LIQUID_TWI2), 0)
- LIB_CXXSRC += LiquidCrystal.cpp
-else
- LIB_SRC += twi.c
- LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
-endif
-
-ifeq ($(WIRE), 1)
- LIB_SRC += twi.c
- LIB_CXXSRC += Wire.cpp
-endif
-
-ifeq ($(U8GLIB), 1)
- LIB_CXXSRC += U8glib.cpp
- LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
-endif
-
-ifeq ($(TMC), 1)
- LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
-endif
-
-ifeq ($(RELOC_WORKAROUND), 1)
- LD_PREFIX=-nodefaultlibs
- LD_SUFFIX=-lm -lgcc -lc -lgcc
-endif
-
-#Check for Arduino 1.0.0 or higher and use the correct source files for that version
-ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
- LIB_CXXSRC += main.cpp
-else
- LIB_SRC += pins_arduino.c main.c
-endif
-
-FORMAT = ihex
-
-# Name of this Makefile (used for "make depend").
-MAKEFILE = Makefile
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
-# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
-DEBUG = stabs
-
-OPT = s
-
-DEFINES ?=
-
-# Program settings
-CC = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-gcc
-CXX = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-g++
-OBJCOPY = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objcopy
-OBJDUMP = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objdump
-AR = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-ar
-SIZE = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-size
-NM = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-nm
-AVRDUDE = avrdude
-REMOVE = rm -f
-MV = mv -f
-
-# Place -D or -U options here
-CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
-CXXDEFS = $(CDEFS)
-
-ifeq ($(HARDWARE_VARIANT), Teensy)
- CDEFS += -DUSB_SERIAL
- LIB_SRC += usb.c pins_teensy.c
- LIB_CXXSRC += usb_api.cpp
-
-else ifeq ($(HARDWARE_VARIANT), archim)
- CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
- LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
- LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
-
- ifeq ($(U8GLIB), 1)
- LIB_SRC += u8g_com_api.c u8g_pb32h1.c
- endif
-endif
-
-# Add all the source directories as include directories too
-CINCS = ${addprefix -I ,${VPATH}}
-CXXINCS = ${addprefix -I ,${VPATH}}
-
-# Silence warnings for library code (won't work for .h files, unfortunately)
-LIBWARN = -w -Wno-packed-bitfield-compat
-
-# Compiler flag to set the C/CPP Standard level.
-CSTANDARD = -std=gnu99
-CXXSTANDARD = -std=gnu++11
-CDEBUG = -g$(DEBUG)
-CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas
-CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas
-CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \
- -fshort-enums -ffunction-sections -fdata-sections
-ifneq ($(HARDWARE_MOTHERBOARD),)
- CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
-endif
-#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
-CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
-CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
-CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
-ASFLAGS := $(CDEFS)
-#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
-ifeq ($(HARDWARE_VARIANT), archim)
- LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
- LD_SUFFIX = $(LDLIBS)
- LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
-else
- LD_PREFIX = -Wl,--gc-sections,--relax
- LDFLAGS = -lm
- CTUNING += -flto
-endif
-
-# Programming support using avrdude. Settings and variables.
-AVRDUDE_PORT = $(UPLOAD_PORT)
-AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
-ifeq ($(shell uname -s), Linux)
- AVRDUDE_CONF = /etc/avrdude/avrdude.conf
-else
- AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
-endif
-AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
- -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
- -b$(UPLOAD_RATE)
-
-# Since Marlin 2.0, the source files may be distributed into several
-# different directories, so it is necessary to find them recursively
-
-SRC = $(shell find src -name '*.c' -type f)
-CXXSRC = $(shell find src -name '*.cpp' -type f)
-
-# Define all object files.
-OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
-OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
-OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
-OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
-OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
-
-# Define all listing files.
-LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CFLAGS) -I.
-ALL_CXXFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CXXFLAGS)
-ALL_ASFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(ASFLAGS) -x assembler-with-cpp
-
-# set V=1 (eg, "make V=1") to print the full commands etc.
-ifneq ($V,1)
- Pecho=@echo
- P=@
-else
- Pecho=@:
- P=
-endif
-
-# Create required build hierarchy if it does not exist
-
-$(shell mkdir -p $(dir $(OBJ)))
-
-# Default target.
-all: sizeafter
-
-build: elf hex bin
-
-elf: $(BUILD_DIR)/$(TARGET).elf
-bin: $(BUILD_DIR)/$(TARGET).bin
-hex: $(BUILD_DIR)/$(TARGET).hex
-eep: $(BUILD_DIR)/$(TARGET).eep
-lss: $(BUILD_DIR)/$(TARGET).lss
-sym: $(BUILD_DIR)/$(TARGET).sym
-
-# Program the device.
-# Do not try to reset an Arduino if it's not one
-upload: $(BUILD_DIR)/$(TARGET).hex
-ifeq (${AVRDUDE_PROGRAMMER}, arduino)
- stty hup < $(UPLOAD_PORT); true
-endif
- $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
-ifeq (${AVRDUDE_PROGRAMMER}, arduino)
- stty -hup < $(UPLOAD_PORT); true
-endif
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
-ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \
- $(SIZE) $(BUILD_DIR)/$(TARGET).elf
-sizebefore:
- $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
-
-sizeafter: build
- $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
-
-
-# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-COFFCONVERT=$(OBJCOPY) --debugging \
- --change-section-address .data-0x800000 \
- --change-section-address .bss-0x800000 \
- --change-section-address .noinit-0x800000 \
- --change-section-address .eeprom-0x810000
-
-
-coff: $(BUILD_DIR)/$(TARGET).elf
- $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
-
-
-extcoff: $(TARGET).elf
- $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
-
-
-.SUFFIXES: .elf .hex .eep .lss .sym .bin
-.PRECIOUS: .o
-
-.elf.hex:
- $(Pecho) " COPY $@"
- $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
-
-.elf.bin:
- $(Pecho) " COPY $@"
- $P $(OBJCOPY) -O binary -R .eeprom $< $@
-
-.elf.eep:
- -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
- --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
-
-# Create extended listing file from ELF output file.
-.elf.lss:
- $(OBJDUMP) -h -S $< > $@
-
-# Create a symbol table from ELF output file.
-.elf.sym:
- $(NM) -n $< > $@
-
-# Link: create ELF output file from library.
-
-$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
- $(Pecho) " CXX $@"
- $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
-
-# Object files that were found in "src" will be stored in $(BUILD_DIR)
-# in directories that mirror the structure of "src"
-
-$(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
- $(Pecho) " CC $<"
- $P $(CC) -MMD -c $(ALL_CFLAGS) $(CWARN) $< -o $@
-
-$(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
- $(Pecho) " CXX $<"
- $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(CXXWARN) $< -o $@
-
-# Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
-
-$(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
- $(Pecho) " CC $<"
- $P $(CC) -MMD -c $(ALL_CFLAGS) $(LIBWARN) $< -o $@
-
-$(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
- $(Pecho) " CXX $<"
- $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(LIBWARN) $< -o $@
-
-$(BUILD_DIR)/arduino/%.o: %.S $(MAKEFILE)
- $(Pecho) " CXX $<"
- $P $(CXX) -MMD -c $(ALL_ASFLAGS) $< -o $@
-
-# Target: clean project.
-clean:
- $(Pecho) " RMDIR $(BUILD_DIR)/"
- $P rm -rf $(BUILD_DIR)
-
-
-.PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
-
-# Automaticaly include the dependency files created by gcc
--include ${patsubst %.o, %.d, ${OBJ}}
diff --git a/marlin-original-clean/Marlin/Marlin.ino b/marlin-original-clean/Marlin/Marlin.ino
deleted file mode 100644
index 842b2a1..0000000
--- a/marlin-original-clean/Marlin/Marlin.ino
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-================================================================================
-
- Marlin Firmware
-
- (c) 2011-2018 MarlinFirmware
- Portions of Marlin are (c) by their respective authors.
- All code complies with GPLv2 and/or GPLv3
-
-================================================================================
-
-Greetings! Thank you for choosing Marlin 2 as your 3D printer firmware.
-
-To configure Marlin you must edit Configuration.h and Configuration_adv.h
-located in the root 'Marlin' folder. Check the config/examples folder to see if
-there's a more suitable starting-point for your specific hardware.
-
-Before diving in, we recommend the following essential links:
-
-Marlin Firmware Official Website
-
- - http://marlinfw.org/
- The official Marlin Firmware website contains the most up-to-date
- documentation. Contributions are always welcome!
-
-Configuration
-
- - https://www.youtube.com/watch?v=3gwWVFtdg-4
- A good 20-minute overview of Marlin configuration by Tom Sanladerer.
- (Applies to Marlin 1.0.x, so Jerk and Acceleration should be halved.)
- Also... https://www.google.com/search?tbs=vid%3A1&q=configure+marlin
-
- - http://marlinfw.org/docs/configuration/configuration.html
- Marlin's configuration options are explained in more detail here.
-
-Getting Help
-
- - http://forums.reprap.org/list.php?415
- The Marlin Discussion Forum is a great place to get help from other Marlin
- users who may have experienced similar issues to your own.
-
- - https://github.com/MarlinFirmware/Marlin/issues
- With a free GitHub account you can provide us with feedback, bug reports,
- and feature requests via the Marlin Issue Queue.
-
-Contributing
-
- - http://marlinfw.org/docs/development/contributing.html
- If you'd like to contribute to Marlin, read this first!
-
- - http://marlinfw.org/docs/development/coding_standards.html
- Before submitting code get to know the Coding Standards.
-*/
diff --git a/marlin-original-clean/Marlin/lib/readme.txt b/marlin-original-clean/Marlin/lib/readme.txt
deleted file mode 100644
index dbadc3d..0000000
--- a/marlin-original-clean/Marlin/lib/readme.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-
-This directory is intended for the project specific (private) libraries.
-PlatformIO will compile them to static libraries and link to executable file.
-
-The source code of each library should be placed in separate directory, like
-"lib/private_lib/[here are source files]".
-
-For example, see how can be organized `Foo` and `Bar` libraries:
-
-|--lib
-| |--Bar
-| | |--docs
-| | |--examples
-| | |--src
-| | |- Bar.c
-| | |- Bar.h
-| |--Foo
-| | |- Foo.c
-| | |- Foo.h
-| |- readme.txt --> THIS FILE
-|- platformio.ini
-|--src
- |- main.c
-
-Then in `src/main.c` you should use:
-
-#include <Foo.h>
-#include <Bar.h>
-
-// rest H/C/CPP code
-
-PlatformIO will find your libraries automatically, configure preprocessor's
-include paths and build them.
-
-More information about PlatformIO Library Dependency Finder
-- http://docs.platformio.org/page/librarymanager/ldf.html
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL.cpp
index 1534a35..7a27f2a 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL.cpp
@@ -1,7 +1,7 @@
/**
* Marlin 3D Printer Firmware
*
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
* Copyright (c) 2017 Victor Perez
@@ -34,6 +34,9 @@
#include "HAL.h"
#include <STM32ADC.h>
#include "../../inc/MarlinConfig.h"
+#include <SPI.h>
+//#include <Wire.h>
+//#include <libmaple/I2C.h>
// --------------------------------------------------------------------------
// Externals
@@ -92,9 +95,7 @@
// --------------------------------------------------------------------------
// Public Variables
// --------------------------------------------------------------------------
-#ifdef SERIAL_USB
- USBSerial SerialUSB;
-#endif
+USBSerial SerialUSB;
uint16_t HAL_adc_result;
@@ -103,16 +104,10 @@ uint16_t HAL_adc_result;
// --------------------------------------------------------------------------
STM32ADC adc(ADC1);
-uint8_t adc_pins[] = {
+uint8 adc_pins[] = {
#if HAS_TEMP_ADC_0
TEMP_0_PIN,
#endif
- #if HAS_HEATED_BED
- TEMP_BED_PIN,
- #endif
- #if HAS_HEATED_CHAMBER
- TEMP_CHAMBER_PIN,
- #endif
#if HAS_TEMP_ADC_1
TEMP_1_PIN,
#endif
@@ -125,8 +120,8 @@ uint8_t adc_pins[] = {
#if HAS_TEMP_ADC_4
TEMP_4_PIN,
#endif
- #if HAS_TEMP_ADC_5
- TEMP_5_PIN,
+ #if HAS_HEATED_BED
+ TEMP_BED_PIN,
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR)
FILWIDTH_PIN,
@@ -137,12 +132,6 @@ enum TEMP_PINS : char {
#if HAS_TEMP_ADC_0
TEMP_0,
#endif
- #if HAS_HEATED_BED
- TEMP_BED,
- #endif
- #if HAS_HEATED_CHAMBER
- TEMP_CHAMBER,
- #endif
#if HAS_TEMP_ADC_1
TEMP_1,
#endif
@@ -155,8 +144,8 @@ enum TEMP_PINS : char {
#if HAS_TEMP_ADC_4
TEMP_4,
#endif
- #if HAS_TEMP_ADC_5
- TEMP_5,
+ #if HAS_HEATED_BED
+ TEMP_BED,
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR)
FILWIDTH,
@@ -207,8 +196,49 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
} }
#endif
+void PWM_fan_init(void) {
+ HardwareTimer pwmtimer(8);
+ pwmtimer.pause();
+ pwmtimer.setPrescaleFactor(1);
+ pwmtimer.setOverflow(0xFFFF);
+ pwmtimer.refresh();
+ pwmtimer.resume();
+}
+
+void PWM_vref_init(void) {
+ HardwareTimer pwmtimer(3);
+ pwmtimer.pause();
+ pwmtimer.setPrescaleFactor(1);
+ pwmtimer.setOverflow(2000);
+ pwmtimer.refresh();
+ pwmtimer.resume();
+}
+
void HAL_init(void) {
+
NVIC_SetPriorityGrouping(0x3);
+
+#if SPI_MODULE
+ SPI.setModule(SPI_MODULE);
+#endif
+
+#if MB(MKS_ROBIN_MINI)
+ //PWM_fan_init();
+// #if PIN_EXISTS(VREF_XY)
+// SET_PWM(VREF_XY_PIN);
+// pwmWrite(VREF_XY_PIN, VREF_XY_VALUE);
+// #endif
+// #if PIN_EXISTS(VREF_Z)
+// SET_PWM(VREF_Z_PIN);
+// pwmWrite(VREF_Z_PIN, VREF_Z_VALUE);
+// #endif
+// #if PIN_EXISTS(VREF_E1)
+// SET_PWM(VREF_E1_PIN);
+// pwmWrite(VREF_E1_PIN, VREF_E1_VALUE);
+// #endif
+#endif
+//#if ENABLED(I2C_EEPROM)
+//#endif
}
/* VGPV Done with defines
@@ -282,12 +312,6 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
#if HAS_TEMP_ADC_0
case TEMP_0_PIN: pin_index = TEMP_0; break;
#endif
- #if HAS_HEATED_BED
- case TEMP_BED_PIN: pin_index = TEMP_BED; break;
- #endif
- #if HAS_HEATED_CHAMBER
- case TEMP_CHAMBER_PIN: pin_index = TEMP_CHAMBER; break;
- #endif
#if HAS_TEMP_ADC_1
case TEMP_1_PIN: pin_index = TEMP_1; break;
#endif
@@ -300,8 +324,8 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
#if HAS_TEMP_ADC_4
case TEMP_4_PIN: pin_index = TEMP_4; break;
#endif
- #if HAS_TEMP_ADC_5
- case TEMP_5_PIN: pin_index = TEMP_5; break;
+ #if HAS_HEATED_BED
+ case TEMP_BED_PIN: pin_index = TEMP_BED; break;
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR)
case FILWIDTH_PIN: pin_index = FILWIDTH; break;
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL.h
index 66c7ee8..41722dc 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL.h
@@ -1,7 +1,7 @@
/**
* Marlin 3D Printer Firmware
*
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
* Copyright (c) 2017 Victor Perez
@@ -36,6 +36,7 @@
// Includes
// --------------------------------------------------------------------------
+#include "../../core/macros.h"
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
@@ -50,67 +51,45 @@
#include "../../inc/MarlinConfigPre.h"
+
// --------------------------------------------------------------------------
// Defines
// --------------------------------------------------------------------------
-#ifdef SERIAL_USB
- #define UsbSerial Serial
- #define MSerial1 Serial1
- #define MSerial2 Serial2
- #define MSerial3 Serial3
- #define MSerial4 Serial4
- #define MSerial5 Serial5
-#else
- extern USBSerial SerialUSB;
- #define UsbSerial SerialUSB
- #define MSerial1 Serial
- #define MSerial2 Serial1
- #define MSerial3 Serial2
- #define MSerial4 Serial3
- #define MSerial5 Serial4
-#endif
-
-#if !WITHIN(SERIAL_PORT, -1, 5)
- #error "SERIAL_PORT must be from -1 to 5"
+#if !WITHIN(SERIAL_PORT, -1, 3)
+ #error "SERIAL_PORT must be from -1 to 3"
#endif
#if SERIAL_PORT == -1
- #define MYSERIAL0 UsbSerial
+ extern USBSerial SerialUSB;
+ #define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
- #error "Serial port 0 does not exist"
+ #define MYSERIAL0 Serial
#elif SERIAL_PORT == 1
- #define MYSERIAL0 MSerial1
+ #define MYSERIAL0 Serial1
#elif SERIAL_PORT == 2
- #define MYSERIAL0 MSerial2
+ #define MYSERIAL0 Serial2
#elif SERIAL_PORT == 3
- #define MYSERIAL0 MSerial3
-#elif SERIAL_PORT == 4
- #define MYSERIAL0 MSerial4
-#elif SERIAL_PORT == 5
- #define MYSERIAL0 MSerial5
+ #define MYSERIAL0 Serial3
#endif
#ifdef SERIAL_PORT_2
- #if !WITHIN(SERIAL_PORT_2, -1, 5)
- #error "SERIAL_PORT_2 must be from -1 to 5"
+ #if !WITHIN(SERIAL_PORT_2, -1, 3)
+ #error "SERIAL_PORT_2 must be from -1 to 3"
#elif SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
#endif
#define NUM_SERIAL 2
#if SERIAL_PORT_2 == -1
- #define MYSERIAL1 UsbSerial
+ extern USBSerial SerialUSB;
+ #define MYSERIAL1 SerialUSB
#elif SERIAL_PORT_2 == 0
- #error "Serial port 0 does not exist"
+ #define MYSERIAL1 Serial
#elif SERIAL_PORT_2 == 1
- #define MYSERIAL1 MSerial1
+ #define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 2
- #define MYSERIAL1 MSerial2
+ #define MYSERIAL1 Serial2
#elif SERIAL_PORT_2 == 3
- #define MYSERIAL1 MSerial3
- #elif SERIAL_PORT_2 == 4
- #define MYSERIAL1 MSerial4
- #elif SERIAL_PORT_2 == 5
- #define MYSERIAL1 MSerial5
+ #define MYSERIAL1 Serial3
#endif
#else
#define NUM_SERIAL 1
@@ -131,6 +110,7 @@ void HAL_init();
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != NULL)
#endif
+
#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); (void)__iCliRetVal()
#define CRITICAL_SECTION_END if (!primask) (void)__iSeiRetVal()
#define ISRS_ENABLED() (!__get_primask())
@@ -183,10 +163,10 @@ extern uint16_t HAL_adc_result;
#define __bss_end __bss_end__
/** clear reset reason */
-void HAL_clear_reset_source(void);
+void HAL_clear_reset_source (void);
/** reset reason */
-uint8_t HAL_get_reset_source(void);
+uint8_t HAL_get_reset_source (void);
void _delay_ms(const int delay);
@@ -215,10 +195,7 @@ static int freeMemory() {
#pragma GCC diagnostic pop
-//
// SPI: Extended functions which take a channel number (hardware SPI only)
-//
-
/** Write single byte to specified SPI channel */
void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */
@@ -226,22 +203,19 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */
uint8_t spiRec(uint32_t chan);
-//
+
// EEPROM
-//
/**
- * TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort.
- * Wire library should work for i2c EEPROMs.
+ * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
+ * Wire library should work for i2c eeproms.
*/
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
-void eeprom_read_block(void *__dst, const void *__src, size_t __n);
-void eeprom_update_block(const void *__src, void *__dst, size_t __n);
+void eeprom_read_block (void *__dst, const void *__src, size_t __n);
+void eeprom_update_block (const void *__src, void *__dst, size_t __n);
-//
// ADC
-//
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG);
@@ -275,3 +249,6 @@ void HAL_enable_AdcFreerun(void);
#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY)
#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)
+
+void PWM_vref_init(void);
+void PWM_fan_init(void);
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.cpp b/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.cpp
deleted file mode 100644
index f8fc315..0000000
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- * Copyright (C) 2017 Victor Perez
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifdef __STM32F1__
-
-#include "../../inc/MarlinConfig.h"
-
-#if HAS_SERVOS
-
-uint8_t ServoCount; //=0
-
-#include "HAL_Servo_STM32F1.h"
-
-//#include "Servo.h"
-
-#include <boards.h>
-#include <io.h>
-#include <pwm.h>
-#include <wirish_math.h>
-
-/**
- * 20 millisecond period config. For a 1-based prescaler,
- *
- * (prescaler * overflow / CYC_MSEC) msec = 1 timer cycle = 20 msec
- * => prescaler * overflow = 20 * CYC_MSEC
- *
- * This uses the smallest prescaler that allows an overflow < 2^16.
- */
-#define MAX_OVERFLOW ((1 << 16) - 1)
-#define CYC_MSEC (1000 * CYCLES_PER_MICROSECOND)
-#define TAU_MSEC 20
-#define TAU_USEC (TAU_MSEC * 1000)
-#define TAU_CYC (TAU_MSEC * CYC_MSEC)
-#define SERVO_PRESCALER (TAU_CYC / MAX_OVERFLOW + 1)
-#define SERVO_OVERFLOW ((uint16_t)round((double)TAU_CYC / SERVO_PRESCALER))
-
-// Unit conversions
-#define US_TO_COMPARE(us) ((uint16_t)map((us), 0, TAU_USEC, 0, SERVO_OVERFLOW))
-#define COMPARE_TO_US(c) ((uint32_t)map((c), 0, SERVO_OVERFLOW, 0, TAU_USEC))
-#define ANGLE_TO_US(a) ((uint16_t)(map((a), this->minAngle, this->maxAngle, \
- SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW)))
-#define US_TO_ANGLE(us) ((int16_t)(map((us), SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW, \
- this->minAngle, this->maxAngle)))
-
-libServo::libServo() {
- this->servoIndex = ServoCount < MAX_SERVOS ? ServoCount++ : INVALID_SERVO;
-}
-
-bool libServo::attach(const int32_t pin, const int32_t minAngle, const int32_t maxAngle) {
- if (this->servoIndex >= MAX_SERVOS) return false;
-
- this->pin = pin;
- this->minAngle = minAngle;
- this->maxAngle = maxAngle;
-
- timer_dev *tdev = PIN_MAP[this->pin].timer_device;
- uint8_t tchan = PIN_MAP[this->pin].timer_channel;
-
- pinMode(this->pin, PWM);
- pwmWrite(this->pin, 0);
-
- timer_pause(tdev);
- timer_set_prescaler(tdev, SERVO_PRESCALER - 1); // prescaler is 1-based
- timer_set_reload(tdev, SERVO_OVERFLOW);
- timer_generate_update(tdev);
- timer_resume(tdev);
-
- return true;
-}
-
-bool libServo::detach() {
- if (!this->attached()) return false;
- pwmWrite(this->pin, 0);
- return true;
-}
-
-int32_t libServo::read() const {
- if (this->attached()) {
- timer_dev *tdev = PIN_MAP[this->pin].timer_device;
- uint8_t tchan = PIN_MAP[this->pin].timer_channel;
- return US_TO_ANGLE(COMPARE_TO_US(timer_get_compare(tdev, tchan)));
- }
- return 0;
-}
-
-void libServo::move(const int32_t value) {
- constexpr uint16_t servo_delay[] = SERVO_DELAY;
- static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
-
- if (this->attached()) {
- pwmWrite(this->pin, US_TO_COMPARE(ANGLE_TO_US(constrain(value, this->minAngle, this->maxAngle))));
- safe_delay(servo_delay[this->servoIndex]);
- #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
- this->detach();
- #endif
- }
-}
-#endif // HAS_SERVOS
-
-#endif // __STM32F1__
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.h b/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.h
deleted file mode 100644
index ac83f08..0000000
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
- * Copyright (C) 2017 Victor Perez
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-#pragma once
-
-// Pin number of unattached pins
-#define NOT_ATTACHED (-1)
-#define INVALID_SERVO 255
-
-#ifndef MAX_SERVOS
- #define MAX_SERVOS 3
-#endif
-
-#define SERVO_DEFAULT_MIN_PW 544
-#define SERVO_DEFAULT_MAX_PW 2400
-#define SERVO_DEFAULT_MIN_ANGLE 0
-#define SERVO_DEFAULT_MAX_ANGLE 180
-
-#define HAL_SERVO_LIB libServo
-
-class libServo {
- public:
- libServo();
- bool attach(const int32_t pin, const int32_t minAngle=SERVO_DEFAULT_MIN_ANGLE, const int32_t maxAngle=SERVO_DEFAULT_MAX_ANGLE);
- bool attached() const { return this->pin != NOT_ATTACHED; }
- bool detach();
- void move(const int32_t value);
- int32_t read() const;
- private:
- uint8_t servoIndex; // index into the channel data for this servo
- int32_t pin = NOT_ATTACHED;
- int32_t minAngle;
- int32_t maxAngle;
-};
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp
index d7aa3cc..27c709a 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -21,7 +21,7 @@
*
*/
-#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
+#ifdef __STM32F1__
#include "HAL_sdio_STM32F1.h"
@@ -73,6 +73,7 @@ bool SDIO_Init(void) {
sdio_set_dbus_width(SDIO_CLKCR_WIDBUS_4BIT);
sdio_set_clock(SDIO_CLOCK);
+
return true;
}
@@ -116,7 +117,9 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
uint32_t retries = 3;
- while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
+ while (retries--) {
+ if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
+ }
return false;
}
@@ -150,7 +153,7 @@ bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
- uint32_t timeout = millis() + SDIO_WRITE_TIMEOUT;
+ uint32 timeout = millis() + SDIO_WRITE_TIMEOUT;
while (timeout > millis()) {
if (SDIO_GetCardState() == SDIO_CARD_TRANSFER) {
return true;
@@ -276,4 +279,4 @@ bool SDIO_GetCmdResp7(void) {
return true;
}
-#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
+#endif // __STM32F1__
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h
index bb48b3b..034bd6d 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h
@@ -1,7 +1,7 @@
/**
* Marlin 3D Printer Firmware
*
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2017 Victor Perez
*
@@ -25,8 +25,7 @@
// Includes
// --------------------------------------------------------------------------
-#include "../shared/Marduino.h"
-
+#include "Arduino.h"
#include "libmaple/sdio.h"
#include "libmaple/dma.h"
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp
index cbc6c7f..c2e09cf 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -86,7 +86,7 @@ void spiBegin() {
}
/**
- * @brief Initialize SPI port to required speed rate and transfer mode (MSB, SPI MODE 0)
+ * @brief Initializes SPI port to required speed rate and transfer mode (MSB, SPI MODE 0)
*
* @param spiRate Rate as declared in HAL.h (speed do not match AVR)
* @return Nothing
@@ -109,7 +109,7 @@ void spiInit(uint8_t spiRate) {
}
/**
- * @brief Receive a single byte from the SPI port.
+ * @brief Receives a single byte from the SPI port.
*
* @return Byte received
*
@@ -123,7 +123,7 @@ uint8_t spiRec(void) {
}
/**
- * @brief Receive a number of bytes from the SPI port to a buffer
+ * @brief Receives a number of bytes from the SPI port to a buffer
*
* @param buf Pointer to starting address of buffer to write to.
* @param nbyte Number of bytes to receive.
@@ -133,12 +133,12 @@ uint8_t spiRec(void) {
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
- SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
+ SPI.dmaTransfer(0, const_cast<uint8*>(buf), nbyte);
SPI.endTransaction();
}
/**
- * @brief Send a single byte on SPI port
+ * @brief Sends a single byte on SPI port
*
* @param b Byte to send
*
@@ -161,20 +161,11 @@ void spiSend(uint8_t b) {
void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.beginTransaction(spiConfig);
SPI.send(token);
- SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
+ SPI.dmaSend(const_cast<uint8*>(buf), 512);
SPI.endTransaction();
}
-/**
- * @brief Begin SPI transaction, set clock, bit order, data mode
- *
- * @param spiClock Clock setting
- * @param bitOrder Bit Order setting
- * @param dataMode Data Mode setting
- * @return Nothing
- *
- * @details Uses an SPI Config via SPISettings
- */
+/** Begin SPI transaction, set clock, bit order, data mode */
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
spiConfig = SPISettings(spiClock, (BitOrder)bitOrder, dataMode);
SPI.beginTransaction(spiConfig);
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp
index 8b235c0..f88e46b 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp
@@ -1,7 +1,7 @@
/**
* Marlin 3D Printer Firmware
*
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
*
@@ -119,7 +119,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
case STEP_TIMER_NUM:
timer_pause(STEP_TIMER_DEV);
timer_set_count(STEP_TIMER_DEV, 0);
- timer_set_prescaler(STEP_TIMER_DEV, (uint16_t)(STEPPER_TIMER_PRESCALE - 1));
+ timer_set_prescaler(STEP_TIMER_DEV, (uint16)(STEPPER_TIMER_PRESCALE - 1));
timer_set_reload(STEP_TIMER_DEV, 0xFFFF);
timer_set_compare(STEP_TIMER_DEV, STEP_TIMER_CHAN, MIN(HAL_TIMER_TYPE_MAX, (STEPPER_TIMER_RATE / frequency)));
timer_attach_interrupt(STEP_TIMER_DEV, STEP_TIMER_CHAN, stepTC_Handler);
@@ -130,7 +130,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
case TEMP_TIMER_NUM:
timer_pause(TEMP_TIMER_DEV);
timer_set_count(TEMP_TIMER_DEV, 0);
- timer_set_prescaler(TEMP_TIMER_DEV, (uint16_t)(TEMP_TIMER_PRESCALE - 1));
+ timer_set_prescaler(TEMP_TIMER_DEV, (uint16)(TEMP_TIMER_PRESCALE - 1));
timer_set_reload(TEMP_TIMER_DEV, 0xFFFF);
timer_set_compare(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, MIN(HAL_TIMER_TYPE_MAX, ((F_CPU / TEMP_TIMER_PRESCALE) / frequency)));
timer_attach_interrupt(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, tempTC_Handler);
@@ -157,7 +157,7 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num) {
}
}
-static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8_t interrupt) {
+static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8 interrupt) {
return bool(*bb_perip(&(dev->regs).adv->DIER, interrupt));
}
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h
index b17d8a4..322a702 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h
@@ -1,7 +1,7 @@
/**
* Marlin 3D Printer Firmware
*
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2017 Victor Perez
*
@@ -85,6 +85,7 @@ timer_dev* get_timer_dev(int number);
// TODO change this
+
#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler(void)
#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler(void)
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h
index c1470ca..ff38fa9 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -28,8 +28,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
- #if !PIN_EXISTS(SPINDLE_LASER_ENA)
- #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
+ #if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
+ #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -75,6 +75,6 @@
#error "SDIO_SUPPORT requires SDSUPPORT. Enable SDSUPPORT to continue."
#endif
-#if ENABLED(FAST_PWM_FAN)
- #error "FAST_PWM_FAN is not yet implemented for this platform."
+#if (PIN_EXISTS(VREF_XY) && !defined(VREF_XY_VALUE)) || (PIN_EXISTS(VREF_Z) && !defined(VREF_Z_VALUE)) || (PIN_EXISTS(VREF_E1) && !defined(VREF_E1_VALUE))
+ #error "VREF_XX is defined but PWM value not set."
#endif
diff --git a/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/binary.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/binary.h
new file mode 100644
index 0000000..70d5ead
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/binary.h
@@ -0,0 +1 @@
+#include "bit_constants.h"
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
index 85437c5..50d0127 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h
index 3994b32..3be336f 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -30,7 +30,7 @@
#include <libmaple/gpio.h>
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
-#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !((bool)V)))
+#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !(bool)V))
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
#define WRITE_VAR(IO,V) WRITE(IO,V)
@@ -42,17 +42,16 @@
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
-#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
+#define SET_OUTPUT(IO) OUT_WRITE(IO,LOW)
#define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0)
-#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
-#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
-#define HAS_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
+#define GET_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
+#define GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
+#define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
-#define PWM_PIN(P) HAS_TIMER(P)
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
+#define PWM_PIN(p) true
+#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
-
diff --git a/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_eeprom.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_eeprom.cpp
new file mode 100644
index 0000000..f39f295
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_eeprom.cpp
@@ -0,0 +1,46 @@
+#ifdef __STM32F1__
+
+#include "../../inc/MarlinConfig.h"
+
+#if ENABLED(EEPROM_SETTINGS) && ENABLED(I2C_EEPROM)
+
+#include "../shared/persistent_store_api.h"
+
+bool PersistentStore::access_start() { return true; }
+bool PersistentStore::access_finish() { return true; }
+
+bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
+ while (size--) {
+ uint8_t * const p = (uint8_t * const)pos;
+ uint8_t v = *value;
+ // EEPROM has only ~100,000 write cycles,
+ // so only write bytes that have changed!
+ if (v != eeprom_read_byte(p)) {
+ eeprom_write_byte(p, v);
+ if (eeprom_read_byte(p) != v) {
+ SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
+ return true;
+ }
+ }
+ crc16(crc, &v, 1);
+ pos++;
+ value++;
+ };
+ return false;
+}
+
+bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
+ do {
+ uint8_t c = eeprom_read_byte((uint8_t*)pos);
+ if (writing) *value = c;
+ crc16(crc, &c, 1);
+ pos++;
+ value++;
+ } while (--size);
+ return false; // always assume success for AVR's
+}
+
+size_t PersistentStore::capacity() { return E2END + 1; }
+
+#endif // EEPROM_SETTINGS || I2C_EEPROM
+#endif // __STM32F1__
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp
index aa03474..43e1721 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp
@@ -1,7 +1,7 @@
/**
* Marlin 3D Printer Firmware
*
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
@@ -31,74 +31,97 @@
#include "../../inc/MarlinConfig.h"
-// This is for EEPROM emulation in flash
#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION)
-#include "../shared/persistent_store_api.h"
+#define EEPROM_ERASE ((uint16)0xFF)
+#include "../shared/persistent_store_api.h"
#include <flash_stm32.h>
#include <EEPROM.h>
+static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
+static bool eeprom_changed = false;
+bool firstWrite = false;
+
// Store settings in the last two pages
// Flash pages must be erased before writing, so keep track.
-bool firstWrite = false;
uint32_t pageBase = EEPROM_START_ADDRESS;
-bool PersistentStore::access_start() {
- firstWrite = true;
- return true;
+inline uint16 CheckPage(uint32 pageBase)
+{
+ uint32 pageEnd = pageBase + (uint32)EEPROM_PAGE_SIZE;
+
+ // Page Status not EEPROM_ERASED
+ if ((*(__IO uint16*)pageBase) != EEPROM_ERASED)
+ return EEPROM_BAD_FLASH;
+ for(pageBase += 4; pageBase < pageEnd; pageBase += 4)
+ if ((*(__IO uint32*)pageBase) != 0xFFFFFFFF) // Verify if slot is empty
+ return EEPROM_BAD_FLASH;
+ return EEPROM_OK;
}
-bool PersistentStore::access_finish() {
- FLASH_Lock();
- firstWrite = false;
+bool PersistentStore::access_start() {
+
+ if (CheckPage(EEPROM_PAGE0_BASE) != EEPROM_OK || CheckPage(EEPROM_PAGE1_BASE) != EEPROM_OK) {
+ for (uint32_t i = 0; i < EEPROM_SIZE; i++) {
+ uint8* accessPoint = (uint8*)pageBase + i;
+ uint8_t c = *accessPoint;
+ ram_eeprom[i] = c;
+ }
+ } else {
+ for (int i = 0; i < EEPROM_SIZE; i++) {
+ ram_eeprom[i] = EEPROM_ERASE;
+ }
+ }
+ eeprom_changed = false;
return true;
}
-bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
+bool PersistentStore::access_finish() {
FLASH_Status status;
+ if (eeprom_changed) {
- if (firstWrite) {
FLASH_Unlock();
+
status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
if (status != FLASH_COMPLETE) return true;
status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
- if (status != FLASH_COMPLETE) return true;
- firstWrite = false;
+ if (status != FLASH_COMPLETE) return true;
}
- // First write full words
int i = 0;
- int wordsToWrite = size / sizeof(uint16_t);
- uint16_t* wordBuffer = (uint16_t *)value;
+ int wordsToWrite = EEPROM_SIZE / sizeof(uint16_t);
+ uint16_t* wordBuffer = (uint16_t *)ram_eeprom;
while (wordsToWrite) {
- status = FLASH_ProgramHalfWord(pageBase + pos + (i * 2), wordBuffer[i]);
+ status = FLASH_ProgramHalfWord(pageBase + (i *2), wordBuffer[i]);
if (status != FLASH_COMPLETE) return true;
wordsToWrite--;
i++;
}
- // Now, write any remaining single byte
- const uint16_t odd = size & 1;
- if (odd) {
- uint16_t temp = value[size - 1];
- status = FLASH_ProgramHalfWord(pageBase + pos + i, temp);
- if (status != FLASH_COMPLETE) return true;
- }
+ FLASH_Lock();
+
+ eeprom_changed = false;
+ return true;
+}
+
+bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
+
+ const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
+ if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
+ crc16(crc, buff, size);
+ pos += size;
- crc16(crc, value, size);
- pos += size + odd;
return false;
}
-bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
- for (uint16_t i = 0; i < size; i++) {
- byte* accessPoint = (byte*)(pageBase + pos + i);
- uint8_t c = *accessPoint;
- if (writing) value[i] = c;
- crc16(crc, &c, 1);
- }
- pos += ((size + 1) & ~1); // i.e., size+(size&1), round up odd values
+bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
+
+ for (size_t i = 0; i < size; i++) ram_eeprom[pos + i] = value[i];
+ eeprom_changed = true;
+ crc16(crc, value, size);
+ pos += size;
+
return false;
}
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp
index 2b184cd..d33c000 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp
@@ -29,7 +29,7 @@
#include "../../inc/MarlinConfig.h"
-#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
+#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION) && DISABLED(I2C_EEPROM)
#include "../shared/persistent_store_api.h"
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/spi_pins.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/spi_pins.h
index 97005a3..b2fc2c3 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/spi_pins.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/spi_pins.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp
index 1d2153d..318cc92 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -26,27 +26,40 @@
* Communication interface for FSMC
*/
-#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
-
#include "../../inc/MarlinConfig.h"
#if HAS_GRAPHICAL_LCD
+#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#include "U8glib.h"
#include "libmaple/fsmc.h"
#include "libmaple/gpio.h"
+#include "libmaple/dma.h"
#include "boards.h"
-#define LCD_READ_ID 0x04 /* Read display identification information */
+struct LCD_IO {
+ uint32_t id;
+ void (*writeRegister)(uint16_t reg);
+ uint16_t (*readData)(void);
+ void (*writeData)(uint16_t data);
+ void (*writeMultiple)(uint16_t data, uint32_t count);
+ void (*writeSequence)(uint16_t *data, uint16_t length);
+ void (*setWindow)(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax);
+};
/* Timing configuration */
#define FSMC_ADDRESS_SETUP_TIME 15 // AddressSetupTime
#define FSMC_DATA_SETUP_TIME 15 // DataSetupTime
+#define FSMC_DMA_DEV DMA2
+#define FSMC_DMA_CHANNEL DMA_CH4
+
void LCD_IO_Init(uint8_t cs, uint8_t rs);
-void LCD_IO_WriteData(uint16_t RegValue);
-void LCD_IO_WriteReg(uint8_t Reg);
-uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
+void LCD_IO_WriteReg(uint16_t reg);
+uint16_t LCD_IO_ReadData(void);
+void LCD_IO_WriteData(uint16_t data);
+void LCD_IO_WriteMultiple(uint16_t data, uint32_t count);
+void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT
@@ -56,43 +69,31 @@ uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
if (msgInitCount) return -1;
}
- static uint8_t isCommand;
-
- switch (msg) {
+ switch(msg) {
case U8G_COM_MSG_STOP:
break;
case U8G_COM_MSG_INIT:
u8g_SetPIOutput(u8g, U8G_PI_RESET);
+ dma_init(FSMC_DMA_DEV);
+ dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
+ dma_set_priority(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, DMA_PRIORITY_HIGH);
+
LCD_IO_Init(u8g->pin_list[U8G_PI_CS], u8g->pin_list[U8G_PI_A0]);
u8g_Delay(100);
- if (arg_ptr != NULL)
- *((uint32_t *)arg_ptr) = LCD_IO_ReadData(LCD_READ_ID, 3);
-
- isCommand = 0;
- break;
-
- case U8G_COM_MSG_ADDRESS: // define cmd (arg_val = 0) or data mode (arg_val = 1)
- isCommand = arg_val == 0 ? 1 : 0;
+ if (arg_ptr != NULL) {
+ ((LCD_IO *)arg_ptr)->writeRegister = LCD_IO_WriteReg;
+ ((LCD_IO *)arg_ptr)->readData = LCD_IO_ReadData;
+ ((LCD_IO *)arg_ptr)->writeData = LCD_IO_WriteData;
+ ((LCD_IO *)arg_ptr)->writeMultiple = LCD_IO_WriteMultiple;
+ ((LCD_IO *)arg_ptr)->writeSequence = LCD_IO_WriteSequence;
+ }
break;
case U8G_COM_MSG_RESET:
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
break;
-
- case U8G_COM_MSG_WRITE_BYTE:
- if (isCommand)
- LCD_IO_WriteReg(arg_val);
- else
- LCD_IO_WriteData((uint16_t)arg_val);
- break;
-
- case U8G_COM_MSG_WRITE_SEQ:
-
- for (uint8_t i = 0; i < arg_val; i += 2)
- LCD_IO_WriteData(*(uint16_t *)(((uint32_t)arg_ptr) + i));
- break;
}
return 1;
}
@@ -107,7 +108,7 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB(void) {
__ASM volatile ("dsb 0xF":::"memory");
}
-#define FSMC_CS_NE1 PD7
+#define FSMC_CS_NE1 PD7 //LQFP100 pin 88
#ifdef STM32_XL_DENSITY
#define FSMC_CS_NE2 PG9
@@ -132,14 +133,14 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB(void) {
#define FSMC_RS_A15 PG5
#endif
-#define FSMC_RS_A16 PD11
-#define FSMC_RS_A17 PD12
-#define FSMC_RS_A18 PD13
-#define FSMC_RS_A19 PE3
-#define FSMC_RS_A20 PE4
-#define FSMC_RS_A21 PE5
-#define FSMC_RS_A22 PE6
-#define FSMC_RS_A23 PE2
+#define FSMC_RS_A16 PD11
+#define FSMC_RS_A17 PD12
+#define FSMC_RS_A18 PD13
+#define FSMC_RS_A19 PE3
+#define FSMC_RS_A20 PE4
+#define FSMC_RS_A21 PE5
+#define FSMC_RS_A22 PE6
+#define FSMC_RS_A23 PE2
#ifdef STM32_XL_DENSITY
#define FSMC_RS_A24 PG13
@@ -161,7 +162,7 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) {
if (fsmcInit) return;
fsmcInit = 1;
- switch (cs) {
+ switch(cs) {
case FSMC_CS_NE1: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION1; break;
#ifdef STM32_XL_DENSITY
case FSMC_CS_NE2: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION2; break;
@@ -173,7 +174,7 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) {
#define _ORADDR(N) controllerAddress |= (_BV32(N) - 2)
- switch (rs) {
+ switch(rs) {
#ifdef STM32_XL_DENSITY
case FSMC_RS_A0: _ORADDR( 1); break;
case FSMC_RS_A1: _ORADDR( 2); break;
@@ -240,31 +241,43 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) {
LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress;
}
-void LCD_IO_WriteData(uint16_t RegValue) {
- LCD->RAM = RegValue;
- __DSB();
+void LCD_IO_WriteReg(uint16_t reg) {
+ LCD->REG = reg;
+ __DSB();
}
-void LCD_IO_WriteReg(uint8_t Reg) {
- LCD->REG = (uint16_t)Reg;
- __DSB();
+uint16_t LCD_IO_ReadData(void) {
+ return LCD->RAM;
}
-uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
- volatile uint32_t data;
- LCD->REG = (uint16_t)RegValue;
+void LCD_IO_WriteData(uint16_t data) {
+ LCD->RAM = data;
__DSB();
+}
- data = LCD->RAM; // dummy read
- data = LCD->RAM & 0x00FF;
+void LCD_IO_WriteMultiple(uint16_t data, uint32_t count) {
+ while (count > 0) {
+ dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, &data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM);
+ dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count > 65535 ? 65535 : count);
+ dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
+ dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
- while (--ReadSize) {
- data <<= 8;
- data |= (LCD->RAM & 0x00FF);
+ while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & 0x0A) == 0) {};
+ dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
+
+ count = count > 65535 ? count - 65535 : 0;
}
- return (uint32_t)data;
}
-#endif // HAS_GRAPHICAL_LCD
+void LCD_IO_WriteSequence(uint16_t *data, uint16_t length) {
+ dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | DMA_PINC_MODE);
+ dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, length);
+ dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
+ dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
+
+ while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & 0x0A) == 0) {};
+ dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
+}
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
+#endif // HAS_GRAPHICAL_LCD
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp
index 0cbfb7f..7ecf3fd 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -33,13 +33,6 @@
#include <libmaple/iwdg.h>
#include "watchdog_STM32F1.h"
-void watchdog_reset() {
- #if PIN_EXISTS(LED)
- TOGGLE(LED_PIN); // heartbeat indicator
- #endif
- iwdg_feed();
-}
-
void watchdogSetup(void) {
// do whatever. don't remove this function.
}
diff --git a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h
index db62d44..d34efdc 100644
--- a/marlin-original-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -27,6 +27,8 @@
#include <libmaple/iwdg.h>
+#include "../../inc/MarlinConfig.h"
+
/**
* The watchdog clock is 40Khz. We need a 4 seconds interval, so use a /256 preescaler and
* 625 reload value (counts down to 0)
@@ -41,4 +43,9 @@ void watchdog_init();
// Reset watchdog. MUST be called at least every 4 seconds after the
// first watchdog_init or STM32F1 will reset.
-void watchdog_reset();
+inline void watchdog_reset() {
+ #if PIN_EXISTS(LED)
+ TOGGLE(LED_PIN); // heart beat indicator
+ #endif
+ iwdg_feed();
+}
diff --git a/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/xpt2046.cpp b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/xpt2046.cpp
new file mode 100644
index 0000000..91dfeb0
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/xpt2046.cpp
@@ -0,0 +1,64 @@
+//#include <Arduino.h>
+#include <SPI.h>
+
+#include "xpt2046.h"
+
+static SPISettings spiConfig;
+static uint32_t timeout = 0;
+
+extern int8_t encoderDiff;
+
+uint8_t xpt2046_read_buttons() {
+ uint16_t x, y;
+
+ if (timeout > millis()) return 0;
+ timeout = millis() + 250;
+
+ spiConfig = SPISettings(XPT2046_SPI_CLOCK, MSBFIRST, SPI_MODE0);
+ if (!getTouchPoint(&x, &y)) return 0;
+
+ x = (uint16_t)((((int32_t)x * (int32_t)XPT2046_X_CALIBRATION) >> 16) + XPT2046_X_OFFSET);
+ y = (uint16_t)((((int32_t)y * (int32_t)XPT2046_Y_CALIBRATION) >> 16) + XPT2046_Y_OFFSET);
+
+ if (y < 185 || y > 224) return 0;
+ if (x > 20 & x < 99) encoderDiff = - ENCODER_STEPS_PER_MENU_ITEM * ENCODER_PULSES_PER_STEP;
+ if (x > 120 & x < 199) encoderDiff = ENCODER_STEPS_PER_MENU_ITEM * ENCODER_PULSES_PER_STEP;
+ if (x > 220 & x < 299) return EN_C;
+ return 0;
+}
+
+uint16_t getTouchCoordinate(uint8_t coordinate) {
+ coordinate |= XPT2046_CONTROL | XPT2046_DFR_MODE;
+
+ OUT_WRITE(TOUCH_CS, LOW);
+ SPI.beginTransaction(spiConfig);
+
+ uint16_t data[3], delta[3];
+
+ SPI.transfer(coordinate);
+ for (uint32_t i = 0; i < 3 ; i++) {
+ data[i] = ((uint16_t) SPI.transfer(0x00)) << 4;
+ data[i] |= ((uint16_t) SPI.transfer(coordinate)) >> 4;
+ }
+ SPI.transfer(0x00);
+ SPI.transfer(0x00);
+ SPI.transfer(0x00);
+
+ SPI.endTransaction();
+ WRITE(TOUCH_CS, HIGH);
+
+ delta[0] = data[0] > data[1] ? data[0] - data [1] : data[1] - data [0];
+ delta[1] = data[0] > data[2] ? data[0] - data [2] : data[2] - data [0];
+ delta[2] = data[1] > data[2] ? data[1] - data [2] : data[2] - data [1];
+
+ if (delta[0] <= delta[1] && delta[0] <= delta[2]) return (data[0] + data [1]) >> 1;
+ if (delta[1] <= delta[2]) return (data[0] + data [2]) >> 1;
+ return (data[1] + data [2]) >> 1;
+}
+
+bool getTouchPoint(uint16_t *x, uint16_t *y) {
+ if (!isTouched()) return false;
+ *x = getTouchCoordinate(XPT2046_X);
+ *y = getTouchCoordinate(XPT2046_Y);
+ return isTouched();
+}
diff --git a/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/xpt2046.h b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/xpt2046.h
new file mode 100644
index 0000000..ce868ee
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/HAL/HAL_STM32F1/xpt2046.h
@@ -0,0 +1,58 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+#include "HAL.h"
+#include "../../lcd/ultralcd.h"
+
+#define XPT2046_DFR_MODE 0x00
+#define XPT2046_SER_MODE 0x04
+#define XPT2046_CONTROL 0x80
+
+#define XPT2046_X 0x10
+#define XPT2046_Z1 0x30
+#define XPT2046_Z2 0x40
+#define XPT2046_Y 0x50
+
+#define XPT2046_SPI_CLOCK SPI_CLOCK_DIV2
+
+#define XPT2046_Z1_TRESHHOLD 10
+
+/* MKS Robin TFT v2.0 */
+#define XPT2046_X_CALIBRATION 12149
+#define XPT2046_X_OFFSET -35
+#define XPT2046_Y_CALIBRATION -8746
+#define XPT2046_Y_OFFSET 256
+
+/* MKS Robin TFT v1.1 */
+//#define XPT2046_X_CALIBRATION -11792
+//#define XPT2046_X_OFFSET 342
+//#define XPT2046_Y_CALIBRATION 8947
+//#define XPT2046_Y_OFFSET -19
+
+uint8_t xpt2046_read_buttons();
+uint16_t getTouchCoordinate(uint8_t coordinate);
+bool getTouchPoint(uint16_t *x, uint16_t *y);
+
+inline bool isTouched() { return getTouchCoordinate(XPT2046_Z1) >= XPT2046_Z1_TRESHHOLD; }
+inline void waitForRelease(void) { while (isTouched()) {}; }
+inline void waitForTouch(uint16_t *x, uint16_t *y) { while(!getTouchPoint(x, y)) {}; }
diff --git a/marlin-original-clean/Marlin/src/Marlin.cpp b/marlin-qq-clean/Marlin/src/Marlin.cpp
index e612b0d..5cf65cd 100644
--- a/marlin-original-clean/Marlin/src/Marlin.cpp
+++ b/marlin-qq-clean/Marlin/src/Marlin.cpp
@@ -939,6 +939,15 @@ void setup() {
queue_setup();
+ // UI must be initialized before EEPROM
+ // (because EEPROM code calls the UI).
+ ui.init();
+ ui.reset_status();
+
+ #if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
+ ui.show_bootscreen();
+ #endif
+
#if ENABLED(SDIO_SUPPORT) && SD_DETECT_PIN == -1
// Auto-mount the SD for EEPROM.dat emulation
if (!card.isDetected()) card.initsd();
@@ -1044,13 +1053,6 @@ void setup() {
fanmux_init();
#endif
- ui.init();
- ui.reset_status();
-
- #if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
- ui.show_bootscreen();
- #endif
-
#if ENABLED(MIXING_EXTRUDER)
mixer.init();
#endif
diff --git a/marlin-original-clean/Marlin/src/core/boards.h b/marlin-qq-clean/Marlin/src/core/boards.h
index 4a7fb64..8581169 100644
--- a/marlin-original-clean/Marlin/src/core/boards.h
+++ b/marlin-qq-clean/Marlin/src/core/boards.h
@@ -244,6 +244,7 @@
#define BOARD_GTM32_PRO_VB 1805 // STM32f103VET6 controller
#define BOARD_MORPHEUS 1806 // STM32F103C8/STM32F103CB Libmaple based stm32f1 controller
#define BOARD_MKS_ROBIN 1808 // MKS Robin / STM32F103ZET6
+#define BOARD_MKS_ROBIN_MINI 1812 // MKS Robin / STM32F103VET6
//
// STM32 ARM Cortex-M4F
diff --git a/marlin-qq-clean/Marlin/src/feature/backlash.cpp b/marlin-qq-clean/Marlin/src/feature/backlash.cpp
new file mode 100644
index 0000000..3254fb3
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/feature/backlash.cpp
@@ -0,0 +1,139 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "../Marlin.h"
+
+#if ENABLED(BACKLASH_COMPENSATION)
+
+#include "backlash.h"
+#include "../module/planner.h"
+
+#if ENABLED(BACKLASH_GCODE)
+ uint8_t Backlash::correction = (BACKLASH_CORRECTION) * 0xFF;
+ #ifdef BACKLASH_DISTANCE_MM
+ float Backlash::distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
+ #endif
+ #ifdef BACKLASH_SMOOTHING_MM
+ float Backlash::smoothing_mm = BACKLASH_SMOOTHING_MM;
+ #endif
+#endif
+
+#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
+ float Backlash::measured_mm[XYZ] = { 0 };
+ uint8_t Backlash::measured_count[XYZ] = { 0 };
+#endif
+
+Backlash backlash;
+
+/**
+ * To minimize seams in the printed part, backlash correction only adds
+ * steps to the current segment (instead of creating a new segment, which
+ * causes discontinuities and print artifacts).
+ *
+ * With a non-zero BACKLASH_SMOOTHING_MM value the backlash correction is
+ * spread over multiple segments, smoothing out artifacts even more.
+ */
+
+void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block) {
+ static uint8_t last_direction_bits;
+ uint8_t changed_dir = last_direction_bits ^ dm;
+ // Ignore direction change if no steps are taken in that direction
+ if (da == 0) CBI(changed_dir, X_AXIS);
+ if (db == 0) CBI(changed_dir, Y_AXIS);
+ if (dc == 0) CBI(changed_dir, Z_AXIS);
+ last_direction_bits ^= changed_dir;
+
+ if (correction == 0) return;
+
+ #ifdef BACKLASH_SMOOTHING_MM
+ // The segment proportion is a value greater than 0.0 indicating how much residual_error
+ // is corrected for in this segment. The contribution is based on segment length and the
+ // smoothing distance. Since the computation of this proportion involves a floating point
+ // division, defer computation until needed.
+ float segment_proportion = 0;
+
+ // Residual error carried forward across multiple segments, so correction can be applied
+ // to segments where there is no direction change.
+ static int32_t residual_error[XYZ] = { 0 };
+ #else
+ // No leftover residual error from segment to segment
+ int32_t residual_error[XYZ] = { 0 };
+ // No direction change, no correction.
+ if (!changed_dir) return;
+ #endif
+
+ const float f_corr = float(correction) / 255.0f;
+
+ LOOP_XYZ(axis) {
+ if (distance_mm[axis]) {
+ const bool reversing = TEST(dm,axis);
+
+ // When an axis changes direction, add axis backlash to the residual error
+ if (TEST(changed_dir, axis))
+ residual_error[axis] += (reversing ? -f_corr : f_corr) * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
+
+ // Decide how much of the residual error to correct in this segment
+ int32_t error_correction = residual_error[axis];
+ #ifdef BACKLASH_SMOOTHING_MM
+ if (error_correction && smoothing_mm != 0) {
+ // Take up a portion of the residual_error in this segment, but only when
+ // the current segment travels in the same direction as the correction
+ if (reversing == (error_correction < 0)) {
+ if (segment_proportion == 0)
+ segment_proportion = MIN(1.0f, block->millimeters / smoothing_mm);
+ error_correction = ceil(segment_proportion * error_correction);
+ }
+ else
+ error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps
+ }
+ #endif
+ // Making a correction reduces the residual error and modifies delta_mm
+ if (error_correction) {
+ block->steps[axis] += ABS(error_correction);
+ residual_error[axis] -= error_correction;
+ }
+ }
+ }
+}
+
+#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
+ #if USES_Z_MIN_PROBE_ENDSTOP
+ #define TEST_PROBE_PIN (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
+ #else
+ #define TEST_PROBE_PIN (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
+ #endif
+
+ // Measure Z backlash by raising nozzle in increments until probe deactivates
+ void Backlash::measure_with_probe() {
+ if (measured_count[Z_AXIS] == 255) return;
+
+ float start_height = current_position[Z_AXIS];
+ while (current_position[Z_AXIS] < (start_height + BACKLASH_MEASUREMENT_LIMIT) && TEST_PROBE_PIN)
+ do_blocking_move_to_z(current_position[Z_AXIS] + BACKLASH_MEASUREMENT_RESOLUTION, MMM_TO_MMS(BACKLASH_MEASUREMENT_FEEDRATE));
+
+ // The backlash from all probe points is averaged, so count the number of measurements
+ measured_mm[Z_AXIS] += current_position[Z_AXIS] - start_height;
+ measured_count[Z_AXIS]++;
+ }
+#endif
+
+#endif // BACKLASH_COMPENSATION
diff --git a/marlin-qq-clean/Marlin/src/feature/backlash.h b/marlin-qq-clean/Marlin/src/feature/backlash.h
new file mode 100644
index 0000000..c35675f
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/feature/backlash.h
@@ -0,0 +1,88 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+#include "../inc/MarlinConfigPre.h"
+#include "../module/planner.h"
+
+class Backlash {
+public:
+ #if ENABLED(BACKLASH_GCODE)
+ static uint8_t correction;
+ #ifdef BACKLASH_DISTANCE_MM
+ static float distance_mm[XYZ];
+ #endif
+ #ifdef BACKLASH_SMOOTHING_MM
+ static float smoothing_mm;
+ #endif
+ static inline void set_correction(const float &v) { correction = MAX(0, MIN(1.0, v)) * all_on; }
+ static inline float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
+ #elif ENABLED(BACKLASH_COMPENSATION)
+ static constexpr uint8_t correction = (BACKLASH_CORRECTION) * 0xFF;
+ #ifdef BACKLASH_DISTANCE_MM
+ static constexpr float distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
+ #endif
+ #ifdef BACKLASH_SMOOTHING_MM
+ static constexpr float smoothing_mm = BACKLASH_SMOOTHING_MM;
+ #endif
+ static inline void set_correction(float) { }
+ static inline float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
+ #else
+ static constexpr uint8_t correction = 0;
+ static inline void set_correction(float) { }
+ static inline float get_correction() { return 0; }
+ #endif
+
+ #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
+ private:
+ static float measured_mm[XYZ];
+ static uint8_t measured_count[XYZ];
+ public:
+ static void measure_with_probe();
+ #endif
+
+ static inline float get_measurement(const uint8_t e) {
+ // Return the measurement averaged over all readings
+ return (
+ #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
+ measured_count[e] > 0 ? measured_mm[e] / measured_count[e] :
+ #endif
+ 0
+ );
+ }
+
+ static inline bool has_measurement(const uint8_t e) {
+ return (false
+ #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
+ || (measured_count[e] > 0)
+ #endif
+ );
+ }
+
+ static inline bool has_any_measurement() {
+ return has_measurement(X_AXIS) || has_measurement(Y_AXIS) || has_measurement(Z_AXIS);
+ }
+
+ void add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block);
+};
+
+extern Backlash backlash;
diff --git a/marlin-original-clean/Marlin/src/feature/runout.cpp b/marlin-qq-clean/Marlin/src/feature/runout.cpp
index 9395dec..e319a7c 100644
--- a/marlin-original-clean/Marlin/src/feature/runout.cpp
+++ b/marlin-qq-clean/Marlin/src/feature/runout.cpp
@@ -51,7 +51,7 @@ void FilamentSensorBase::filament_present(const uint8_t extruder) {
uint8_t FilamentSensorEncoder::motion_detected;
#endif
-#if FILAMENT_RUNOUT_DISTANCE_MM > 0
+#ifdef FILAMENT_RUNOUT_DISTANCE_MM
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
volatile float RunoutResponseDelayed::runout_mm_countdown[EXTRUDERS];
#else
diff --git a/marlin-original-clean/Marlin/src/feature/runout.h b/marlin-qq-clean/Marlin/src/feature/runout.h
index 3f1e5fa..eccc7ab 100644
--- a/marlin-original-clean/Marlin/src/feature/runout.h
+++ b/marlin-qq-clean/Marlin/src/feature/runout.h
@@ -78,6 +78,11 @@ class TFilamentMonitor : public FilamentMonitorBase {
response.filament_present(extruder);
}
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ static inline float& runout_distance() { return response.runout_distance_mm; }
+ static inline void set_runout_distance(const float &mm) { response.runout_distance_mm = mm; }
+ #endif
+
// Handle a block completion. RunoutResponseDelayed uses this to
// add up the length of filament moved while the filament is out.
static inline void block_completed(const block_t* const b) {
@@ -90,13 +95,13 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter.
static inline void run() {
if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning() || did_pause_print)) {
- #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
#endif
response.run();
sensor.run();
const bool ran_out = response.has_run_out();
- #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
sei();
#endif
if (ran_out) {
@@ -272,7 +277,7 @@ class FilamentSensorBase {
/********************************* RESPONSE TYPE *********************************/
-#if FILAMENT_RUNOUT_DISTANCE_MM > 0
+#ifdef FILAMENT_RUNOUT_DISTANCE_MM
// RunoutResponseDelayed triggers a runout event only if the length
// of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed
@@ -347,11 +352,12 @@ class FilamentSensorBase {
/********************************* TEMPLATE SPECIALIZATION *********************************/
typedef TFilamentMonitor<
- #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ RunoutResponseDelayed,
#if ENABLED(FILAMENT_MOTION_SENSOR)
- RunoutResponseDelayed, FilamentSensorEncoder
+ FilamentSensorEncoder
#else
- RunoutResponseDelayed, FilamentSensorSwitch
+ FilamentSensorSwitch
#endif
#else
RunoutResponseDebounced, FilamentSensorSwitch
diff --git a/marlin-original-clean/Marlin/src/gcode/calibrate/G425.cpp b/marlin-qq-clean/Marlin/src/gcode/calibrate/G425.cpp
index 1174fc3..03e4c4e 100644
--- a/marlin-original-clean/Marlin/src/gcode/calibrate/G425.cpp
+++ b/marlin-qq-clean/Marlin/src/gcode/calibrate/G425.cpp
@@ -31,6 +31,7 @@
#include "../../module/tool_change.h"
#include "../../module/endstops.h"
#include "../../feature/bedlevel/bedlevel.h"
+#include "../../feature/backlash.h"
/**
@@ -55,11 +56,6 @@
#define HAS_X_CENTER BOTH(CALIBRATION_MEASURE_LEFT, CALIBRATION_MEASURE_RIGHT)
#define HAS_Y_CENTER BOTH(CALIBRATION_MEASURE_FRONT, CALIBRATION_MEASURE_BACK)
-#if ENABLED(BACKLASH_GCODE)
- extern float backlash_distance_mm[], backlash_smoothing_mm;
- extern uint8_t backlash_correction;
-#endif
-
enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES };
struct measurements_t {
@@ -79,13 +75,13 @@ struct measurements_t {
#define TEMPORARY_SOFT_ENDSTOP_STATE(enable) REMEMBER(tes, soft_endstops_enabled, enable);
#if ENABLED(BACKLASH_GCODE)
- #define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash_correction, value)
+ #define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash.correction, value)
#else
#define TEMPORARY_BACKLASH_CORRECTION(value)
#endif
#if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)
- #define TEMPORARY_BACKLASH_SMOOTHING(value) REMEMBER(tbsm, backlash_smoothing_mm, value)
+ #define TEMPORARY_BACKLASH_SMOOTHING(value) REMEMBER(tbsm, backlash.smoothing_mm, value)
#else
#define TEMPORARY_BACKLASH_SMOOTHING(value)
#endif
@@ -454,22 +450,22 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) {
#if ENABLED(BACKLASH_GCODE)
#if HAS_X_CENTER
- backlash_distance_mm[X_AXIS] = (m.backlash[LEFT] + m.backlash[RIGHT]) / 2;
+ backlash.distance_mm[X_AXIS] = (m.backlash[LEFT] + m.backlash[RIGHT]) / 2;
#elif ENABLED(CALIBRATION_MEASURE_LEFT)
- backlash_distance_mm[X_AXIS] = m.backlash[LEFT];
+ backlash.distance_mm[X_AXIS] = m.backlash[LEFT];
#elif ENABLED(CALIBRATION_MEASURE_RIGHT)
- backlash_distance_mm[X_AXIS] = m.backlash[RIGHT];
+ backlash.distance_mm[X_AXIS] = m.backlash[RIGHT];
#endif
#if HAS_Y_CENTER
- backlash_distance_mm[Y_AXIS] = (m.backlash[FRONT] + m.backlash[BACK]) / 2;
+ backlash.distance_mm[Y_AXIS] = (m.backlash[FRONT] + m.backlash[BACK]) / 2;
#elif ENABLED(CALIBRATION_MEASURE_FRONT)
- backlash_distance_mm[Y_AXIS] = m.backlash[FRONT];
+ backlash.distance_mm[Y_AXIS] = m.backlash[FRONT];
#elif ENABLED(CALIBRATION_MEASURE_BACK)
- backlash_distance_mm[Y_AXIS] = m.backlash[BACK];
+ backlash.distance_mm[Y_AXIS] = m.backlash[BACK];
#endif
- backlash_distance_mm[Z_AXIS] = m.backlash[TOP];
+ backlash.distance_mm[Z_AXIS] = m.backlash[TOP];
#endif
}
diff --git a/marlin-original-clean/Marlin/src/gcode/calibrate/M425.cpp b/marlin-qq-clean/Marlin/src/gcode/calibrate/M425.cpp
index e51c930..74b38f5 100644
--- a/marlin-original-clean/Marlin/src/gcode/calibrate/M425.cpp
+++ b/marlin-qq-clean/Marlin/src/gcode/calibrate/M425.cpp
@@ -24,20 +24,9 @@
#if ENABLED(BACKLASH_GCODE)
+#include "../../feature/backlash.h"
#include "../../module/planner.h"
-float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
-uint8_t backlash_correction = BACKLASH_CORRECTION * all_on;
-
-#ifdef BACKLASH_SMOOTHING_MM
- float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM;
-#endif
-
-#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
- float backlash_measured_mm[XYZ] = { 0 };
- uint8_t backlash_measured_num[XYZ] = { 0 };
-#endif
-
#include "../gcode.h"
/**
@@ -60,59 +49,52 @@ void GcodeSuite::M425() {
LOOP_XYZ(i) {
if (parser.seen(axis_codes[i])) {
planner.synchronize();
- const float measured_backlash = (
- #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
- backlash_measured_num[i] > 0 ? backlash_measured_mm[i] / backlash_measured_num[i] : 0
- #else
- 0
- #endif
- );
- backlash_distance_mm[i] = parser.has_value() ? parser.value_linear_units() : measured_backlash;
+ backlash.distance_mm[i] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(i);
noArgs = false;
}
}
if (parser.seen('F')) {
planner.synchronize();
- backlash_correction = MAX(0, MIN(1.0, parser.value_float())) * all_on;
+ backlash.set_correction(parser.value_float());
noArgs = false;
}
#ifdef BACKLASH_SMOOTHING_MM
if (parser.seen('S')) {
planner.synchronize();
- backlash_smoothing_mm = parser.value_linear_units();
+ backlash.smoothing_mm = parser.value_linear_units();
noArgs = false;
}
#endif
if (noArgs) {
- SERIAL_ECHOPGM("Backlash correction is ");
- if (!backlash_correction) SERIAL_ECHOPGM("in");
+ SERIAL_ECHOPGM("Backlash Correction ");
+ if (!backlash.correction) SERIAL_ECHOPGM("in");
SERIAL_ECHOLNPGM("active:");
- SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", float(ui8_to_percent(backlash_correction)) / 100, " (F1.0 = full, F0.0 = none)");
+ SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
LOOP_XYZ(a) {
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[a]);
- SERIAL_ECHO(backlash_distance_mm[a]);
+ SERIAL_ECHO(backlash.distance_mm[a]);
SERIAL_EOL();
}
#ifdef BACKLASH_SMOOTHING_MM
- SERIAL_ECHOLNPAIR(" Smoothing (mm): S", backlash_smoothing_mm);
+ SERIAL_ECHOLNPAIR(" Smoothing (mm): S", backlash.smoothing_mm);
#endif
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
SERIAL_ECHOPGM(" Average measured backlash (mm):");
- LOOP_XYZ(a) {
- if (backlash_measured_num[a] > 0) {
+ if (backlash.has_any_measurement()) {
+ LOOP_XYZ(a) if (backlash.has_measurement(a)) {
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[a]);
- SERIAL_ECHO(backlash_measured_mm[a] / backlash_measured_num[a]);
+ SERIAL_ECHO(backlash.get_measurement(a));
}
}
- if (!backlash_measured_num[X_AXIS] && !backlash_measured_num[Y_AXIS] && !backlash_measured_num[Z_AXIS])
+ else
SERIAL_ECHOPGM(" (Not yet measured)");
SERIAL_EOL();
#endif
diff --git a/marlin-original-clean/Marlin/src/gcode/feature/runout/M412.cpp b/marlin-qq-clean/Marlin/src/gcode/feature/runout/M412.cpp
index 749ce2a..6cf2238 100644
--- a/marlin-original-clean/Marlin/src/gcode/feature/runout/M412.cpp
+++ b/marlin-qq-clean/Marlin/src/gcode/feature/runout/M412.cpp
@@ -32,6 +32,9 @@
*/
void GcodeSuite::M412() {
if (parser.seen("HS"
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ "D"
+ #endif
#if ENABLED(HOST_ACTION_COMMANDS)
"R"
#endif
@@ -42,11 +45,17 @@ void GcodeSuite::M412() {
const bool seenR = parser.seen('R'), seenS = parser.seen('S');
if (seenR || seenS) runout.reset();
if (seenS) runout.enabled = parser.value_bool();
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ if (parser.seen('D')) runout.set_runout_distance(parser.value_linear_units());
+ #endif
}
else {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Filament runout ");
serialprintln_onoff(runout.enabled);
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ SERIAL_ECHOLNPAIR("Filament runout distance (mm): ", runout.runout_distance());
+ #endif
}
}
diff --git a/marlin-original-clean/Marlin/src/inc/Conditionals_LCD.h b/marlin-qq-clean/Marlin/src/inc/Conditionals_LCD.h
index 45051e3..898790d 100644
--- a/marlin-original-clean/Marlin/src/inc/Conditionals_LCD.h
+++ b/marlin-qq-clean/Marlin/src/inc/Conditionals_LCD.h
@@ -237,6 +237,8 @@
#define ULTRA_LCD
#define DOGLCD
#define ULTIPANEL
+ #define RGB_DISPLAY
+ #define TOUCH_BUTTONS
#endif
/**
@@ -516,9 +518,13 @@
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#endif
+#if ENABLED(MALYAN_LCD)
+ #define EXTENSIBLE_UI
+#endif
#define HAS_SOFTWARE_ENDSTOPS EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
#define HAS_RESUME_CONTINUE ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER)
-#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
+//#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
+#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9532) || ENABLED(NEOPIXEL_LED) || ENABLED (RGB_DISPLAY))
#define HAS_LEDS_OFF_FLAG (BOTH(PRINTER_EVENT_LEDS, SDSUPPORT) && HAS_RESUME_CONTINUE)
#define HAS_PRINT_PROGRESS EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#define HAS_SERVICE_INTERVALS (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)
diff --git a/marlin-original-clean/Marlin/src/inc/Conditionals_post.h b/marlin-qq-clean/Marlin/src/inc/Conditionals_post.h
index a4789f7..3db857e 100644
--- a/marlin-original-clean/Marlin/src/inc/Conditionals_post.h
+++ b/marlin-qq-clean/Marlin/src/inc/Conditionals_post.h
@@ -53,7 +53,8 @@
#undef FILAMENT_LOAD_UNLOAD_GCODES
#endif
-#define HAS_CLASSIC_JERK (IS_KINEMATIC || DISABLED(JUNCTION_DEVIATION))
+// TODO
+//#define HAS_CLASSIC_JERK (IS_KINEMATIC || DISABLED(JUNCTION_DEVIATION))
/**
* Axis lengths and center
diff --git a/marlin-original-clean/Marlin/src/inc/SanityCheck.h b/marlin-qq-clean/Marlin/src/inc/SanityCheck.h
index a268595..3f80764 100644
--- a/marlin-original-clean/Marlin/src/inc/SanityCheck.h
+++ b/marlin-qq-clean/Marlin/src/inc/SanityCheck.h
@@ -613,6 +613,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 5 requires FIL_RUNOUT6_PIN."
#elif DISABLED(SDSUPPORT, PRINTJOB_TIMER_AUTOSTART)
#error "FILAMENT_RUNOUT_SENSOR requires SDSUPPORT or PRINTJOB_TIMER_AUTOSTART."
+ #elif FILAMENT_RUNOUT_DISTANCE_MM < 0
+ #error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero."
#elif DISABLED(ADVANCED_PAUSE_FEATURE)
static_assert(NULL == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with FILAMENT_RUNOUT_SENSOR.");
#endif
@@ -1784,7 +1786,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
+ ENABLED(OLED_PANEL_TINYBOY2) \
+ ENABLED(ZONESTAR_LCD) \
+ ENABLED(ULTI_CONTROLLER) \
- + ENABLED(EXTENSIBLE_UI)
+ + (ENABLED(EXTENSIBLE_UI) && DISABLED(MALYAN_LCD))
#error "Please select no more than one LCD controller option."
#endif
diff --git a/marlin-original-clean/Marlin/src/inc/Version.h b/marlin-qq-clean/Marlin/src/inc/Version.h
index 0ff190e..b43628d 100644
--- a/marlin-original-clean/Marlin/src/inc/Version.h
+++ b/marlin-qq-clean/Marlin/src/inc/Version.h
@@ -38,7 +38,7 @@
/**
* Marlin release version identifier
*/
- #define SHORT_BUILD_VERSION "bugfix-2.0.x"
+ #define SHORT_BUILD_VERSION "bugfix-2.0.x-c1"
/**
* Verbose version identifier which should contain a reference to the location
@@ -51,7 +51,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
- #define STRING_DISTRIBUTION_DATE "2018-01-20"
+ #define STRING_DISTRIBUTION_DATE "2019-05-27"
/**
* Required minimum Configuration.h and Configuration_adv.h file versions.
diff --git a/marlin-original-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp b/marlin-qq-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp
index 8f295ab..7904b2b 100644
--- a/marlin-original-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp
+++ b/marlin-qq-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -63,109 +63,361 @@
#include "HAL_LCD_com_defines.h"
#include "string.h"
+#include "../../lcd/ultralcd.h"
+#if HAS_COLOR_LEDS && ENABLED(PRINTER_EVENT_LEDS)
+#include "../../feature/leds/leds.h"
+#endif
+
+struct LCD_IO {
+ uint32_t id;
+ void (*writeRegister)(uint16_t reg);
+ uint16_t (*readData)(void);
+ void (*writeData)(uint16_t data);
+ void (*writeMultiple)(uint16_t data, uint32_t count);
+ void (*writeSequence)(uint16_t *data, uint16_t length);
+ void (*setWindow)(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax);
+};
+static LCD_IO lcd = {0, NULL, NULL, NULL, NULL, NULL, NULL};
+
#define WIDTH 128
#define HEIGHT 64
#define PAGE_HEIGHT 8
#define X_MIN 32
-#define Y_MIN 56
+#define Y_MIN 28
#define X_MAX (X_MIN + 2 * WIDTH - 1)
#define Y_MAX (Y_MIN + 2 * HEIGHT - 1)
-#define LCD_COLUMN 0x2A /* Colomn address register */
-#define LCD_ROW 0x2B /* Row address register */
-#define LCD_WRITE_RAM 0x2C
-
static uint32_t lcd_id = 0;
+uint16_t color = 0xFFFF;
+
+#define ESC_REG(x) 0xFFFF, 0x00FF & (uint16_t)x
+#define ESC_DELAY(x) 0xFFFF, 0x8000 | (x & 0x7FFF)
+#define ESC_END 0xFFFF, 0x7FFF
+#define ESC_FFFF 0xFFFF, 0xFFFF
-#define U8G_ESC_DATA(x) (uint8_t)(x >> 8), (uint8_t)(x & 0xFF)
+void writeEscSequence(const uint16_t *sequence) {
+ uint16_t data;
+ for (;;) {
+ data = *sequence++;
+ if (data != 0xFFFF) {
+ lcd.writeData(data);
+ continue;
+ }
+ data = *sequence++;
+ if (data == 0x7FFF) return;
+ if (data == 0xFFFF) {
+ lcd.writeData(data);
+ } else if (data & 0x8000) {
+ delay(data & 0x7FFF);
+ } else if ((data & 0xFF00) == 0) {
+ lcd.writeRegister(data);
+ }
+ }
+}
-static const uint8_t page_first_sequence[] = {
- U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(X_MIN), U8G_ESC_DATA(X_MAX),
- U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(Y_MIN), U8G_ESC_DATA(Y_MAX),
- U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
- U8G_ESC_END
+static const uint16_t st7789v_init[] = {
+ ESC_REG(0x10), ESC_DELAY(10), ESC_REG(0x01), ESC_DELAY(200), ESC_REG(0x11), ESC_DELAY(120),
+ ESC_REG(0x36), 0x00A0,
+ ESC_REG(0x3A), 0x0055,
+ ESC_REG(0x2A), 0x0000, 0x0000, 0x0001, 0x003F,
+ ESC_REG(0x2B), 0x0000, 0x0000, 0x0000, 0x00EF,
+ ESC_REG(0xB2), 0x000C, 0x000C, 0x0000, 0x0033, 0x0033,
+ ESC_REG(0xB7), 0x0035,
+ ESC_REG(0xBB), 0x001F,
+ ESC_REG(0xC0), 0x002C,
+ ESC_REG(0xC2), 0x0001, 0x00C3,
+ ESC_REG(0xC4), 0x0020,
+ ESC_REG(0xC6), 0x000F,
+ ESC_REG(0xD0), 0x00A4, 0x00A1,
+ ESC_REG(0x29),
+ ESC_REG(0x11),
+ ESC_END
};
-static const uint8_t clear_screen_sequence[] = {
- U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
- U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
- U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
- U8G_ESC_END
+static const uint16_t ili9328_init[] = {
+ ESC_REG(0x0001), 0x0100,
+ ESC_REG(0x0002), 0x0400,
+ ESC_REG(0x0003), 0x1038,
+ ESC_REG(0x0004), 0x0000,
+ ESC_REG(0x0008), 0x0202,
+ ESC_REG(0x0009), 0x0000,
+ ESC_REG(0x000A), 0x0000,
+ ESC_REG(0x000C), 0x0000,
+ ESC_REG(0x000D), 0x0000,
+ ESC_REG(0x000F), 0x0000,
+ ESC_REG(0x0010), 0x0000,
+ ESC_REG(0x0011), 0x0007,
+ ESC_REG(0x0012), 0x0000,
+ ESC_REG(0x0013), 0x0000,
+ ESC_REG(0x0007), 0x0001,
+ ESC_DELAY(200),
+ ESC_REG(0x0010), 0x1690,
+ ESC_REG(0x0011), 0x0227,
+ ESC_DELAY(50),
+ ESC_REG(0x0012), 0x008C,
+ ESC_DELAY(50),
+ ESC_REG(0x0013), 0x1500,
+ ESC_REG(0x0029), 0x0004,
+ ESC_REG(0x002B), 0x000D,
+ ESC_DELAY(50),
+ ESC_REG(0x0050), 0x0000,
+ ESC_REG(0x0051), 0x00EF,
+ ESC_REG(0x0052), 0x0000,
+ ESC_REG(0x0053), 0x013F,
+ ESC_REG(0x0020), 0x0000,
+ ESC_REG(0x0021), 0x0000,
+ ESC_REG(0x0060), 0x2700,
+ ESC_REG(0x0061), 0x0001,
+ ESC_REG(0x006A), 0x0000,
+ ESC_REG(0x0080), 0x0000,
+ ESC_REG(0x0081), 0x0000,
+ ESC_REG(0x0082), 0x0000,
+ ESC_REG(0x0083), 0x0000,
+ ESC_REG(0x0084), 0x0000,
+ ESC_REG(0x0085), 0x0000,
+ ESC_REG(0x0090), 0x0010,
+ ESC_REG(0x0092), 0x0600,
+ ESC_REG(0x0007), 0x0133,
+ ESC_REG(0x0022),
+ ESC_END
};
-static const uint8_t st7789v_init_sequence[] = { // 0x8552 - ST7789V
- U8G_ESC_ADR(0),
- 0x10,
- U8G_ESC_DLY(10),
- 0x01,
- U8G_ESC_DLY(100), U8G_ESC_DLY(100),
- 0x11,
- U8G_ESC_DLY(120),
- 0x36, U8G_ESC_ADR(1), 0xA0,
- U8G_ESC_ADR(0), 0x3A, U8G_ESC_ADR(1), 0x05,
- U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
- U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
- U8G_ESC_ADR(0), 0xB2, U8G_ESC_ADR(1), 0x0C, 0x0C, 0x00, 0x33, 0x33,
- U8G_ESC_ADR(0), 0xB7, U8G_ESC_ADR(1), 0x35,
- U8G_ESC_ADR(0), 0xBB, U8G_ESC_ADR(1), 0x1F,
- U8G_ESC_ADR(0), 0xC0, U8G_ESC_ADR(1), 0x2C,
- U8G_ESC_ADR(0), 0xC2, U8G_ESC_ADR(1), 0x01, 0xC3,
- U8G_ESC_ADR(0), 0xC4, U8G_ESC_ADR(1), 0x20,
- U8G_ESC_ADR(0), 0xC6, U8G_ESC_ADR(1), 0x0F,
- U8G_ESC_ADR(0), 0xD0, U8G_ESC_ADR(1), 0xA4, 0xA1,
- U8G_ESC_ADR(0), 0xE0, U8G_ESC_ADR(1), 0xD0, 0x08, 0x11, 0x08, 0x0C, 0x15, 0x39, 0x33, 0x50, 0x36, 0x13, 0x14, 0x29, 0x2D,
- U8G_ESC_ADR(0), 0xE1, U8G_ESC_ADR(1), 0xD0, 0x08, 0x10, 0x08, 0x06, 0x06, 0x39, 0x44, 0x51, 0x0B, 0x16, 0x14, 0x2F, 0x31,
- U8G_ESC_ADR(0), 0x29, 0x11, 0x35, U8G_ESC_ADR(1), 0x00,
- U8G_ESC_END
+static const uint8_t button0[] = {
+ B01111111,B11111111,B11111111,B11111111,B11111110,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00001000,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00111110,B00000000,B00000001,
+ B10000000,B00000000,B01111111,B00000000,B00000001,
+ B10000000,B00000000,B11111111,B10000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B01111111,B11111111,B11111111,B11111111,B11111110,
};
+static const uint8_t button1[] = {
+ B01111111,B11111111,B11111111,B11111111,B11111110,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B11111111,B10000000,B00000001,
+ B10000000,B00000000,B01111111,B00000000,B00000001,
+ B10000000,B00000000,B00111110,B00000000,B00000001,
+ B10000000,B00000000,B00011100,B00000000,B00000001,
+ B10000000,B00000000,B00001000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B01111111,B11111111,B11111111,B11111111,B11111110,
+};
+
+static const uint8_t button2[] = {
+ B01111111,B11111111,B11111111,B11111111,B11111110,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B01000001,B11000000,B00000001,
+ B10000000,B00000000,B11000001,B11000000,B00000001,
+ B10000000,B00000001,B11111111,B11000000,B00000001,
+ B10000000,B00000011,B11111111,B11000000,B00000001,
+ B10000000,B00000001,B11111111,B11000000,B00000001,
+ B10000000,B00000000,B11000000,B00000000,B00000001,
+ B10000000,B00000000,B01000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B10000000,B00000000,B00000000,B00000000,B00000001,
+ B01111111,B11111111,B11111111,B11111111,B11111110,
+};
+
+static void _setWindow_x20_x21_x22(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) {
+ lcd.writeRegister(0x50);
+ lcd.writeData(Ymin);
+ lcd.writeRegister(0x51);
+ lcd.writeData(Ymax);
+ lcd.writeRegister(0x52);
+ lcd.writeData(Xmin);
+ lcd.writeRegister(0x53);
+ lcd.writeData(Xmax);
+
+ lcd.writeRegister(0x20);
+ lcd.writeData(Ymin);
+ lcd.writeRegister(0x21);
+ lcd.writeData(Xmin);
+
+ lcd.writeRegister(0x22);
+}
+
+static void _setWindow_x2a_x2b_x2c(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) {
+ lcd.writeRegister(0x2A);
+ lcd.writeData((Xmin >> 8) & 0xFF);
+ lcd.writeData(Xmin & 0xFF);
+ lcd.writeData((Xmax >> 8) & 0xFF);
+ lcd.writeData(Xmax & 0xFF);
+
+ lcd.writeRegister(0x2B);
+ lcd.writeData((Ymin >> 8) & 0xFF);
+ lcd.writeData(Ymin & 0xFF);
+ lcd.writeData((Ymax >> 8) & 0xFF);
+ lcd.writeData(Ymax & 0xFF);
+
+ lcd.writeRegister(0x2C);
+}
+
+void drawImage(const uint8_t *data, uint16_t length, uint16_t height) {
+ uint16_t i, j, k;
+ uint16_t buffer[160];
+
+ for (i = 0; i < height; i++) {
+ k = 0;
+ for (j = 0; j < length; j++) {
+ if (*(data + (i * (length >> 3) + (j >> 3))) & (128 >> (j & 7))) {
+ buffer[k++] = color;
+ buffer[k++] = color;
+ } else {
+ buffer[k++] = 0x0000;
+ buffer[k++] = 0x0000;
+ }
+ }
+ lcd.writeSequence(buffer, length << 1);
+ lcd.writeSequence(buffer, length << 1);
+ }
+}
+
+void drawUI(void) {
+ lcd.setWindow(10, 170, 309, 171);
+ lcd.writeMultiple(color, 600);
+
+ lcd.setWindow( 20, 185, 99, 224);
+ drawImage(button0, 40, 20);
+ lcd.setWindow(120, 185, 199, 224);
+ drawImage(button1, 40, 20);
+ lcd.setWindow(220, 185, 299, 224);
+ drawImage(button2, 40, 20);
+}
+
uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
+#if HAS_COLOR_LEDS && ENABLED(PRINTER_EVENT_LEDS)
+ uint16_t newColor;
+#endif
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
uint16_t buffer[256];
uint32_t i, j, k;
+ uint8_t byte;
- switch (msg) {
+ uint16_t reg00;
+
+ switch(msg) {
case U8G_DEV_MSG_INIT:
- dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, &lcd_id);
- if (lcd_id == 0x040404) return 0; // No connected display on FSMC
- if (lcd_id == 0xFFFFFF) return 0; // No connected display on SPI
+ dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, &lcd);
+ if (lcd.writeRegister == NULL || lcd.writeData == NULL || lcd.readData == NULL || lcd.writeSequence == NULL) break;
- memset(buffer, 0x00, sizeof(buffer));
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+// !!! POC implementation. NOT compatible with 8-bit interface (SPI / FSMC 8-bit) !!!
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if ((lcd_id & 0xFFFF) == 0x8552) // ST7789V
- u8g_WriteEscSeqP(u8g, dev, st7789v_init_sequence);
+ lcd.writeRegister(0x0000);
+ reg00 = lcd.readData();
+ if (reg00 == 0 || reg00 == 0xFFFF) {
+ lcd.writeRegister(0x0004);
+ lcd.readData(); // dummy read
+ lcd.id = ((uint32_t)(lcd.readData() & 0xff) << 16) | ((uint32_t)(lcd.readData() & 0xff) << 8) | (uint32_t)(lcd.readData() & 0xff);
+ if (lcd_id == 0x040404) { // No connected display on FSMC
+ lcd.id = 0;
+ return 0;
+ }
+ } else {
+ lcd.id = (uint32_t)reg00;
+ }
+
+ switch(lcd.id & 0xFFFF) {
+ case 0x8552: // ST7789V
+ writeEscSequence(st7789v_init);
+ lcd.setWindow = _setWindow_x2a_x2b_x2c;
+ break;
+ case 0x9328: // ILI9328
+ writeEscSequence(ili9328_init);
+ lcd.setWindow = _setWindow_x20_x21_x22;
+ break;
+ case 0x0404: // No connected display on FSMC
+ lcd.id = 0;
+ return 0;
+ case 0xFFFF: // No connected display on SPI
+ lcd.id = 0;
+ return 0;
+ default:
+ if (reg00 == 0)
+ lcd.setWindow = _setWindow_x2a_x2b_x2c;
+ else
+ lcd.setWindow = _setWindow_x20_x21_x22;
+ break;
+ }
- u8g_WriteEscSeqP(u8g, dev, clear_screen_sequence);
- for (i = 0; i < 960; i++)
- u8g_WriteSequence(u8g, dev, 160, (uint8_t *)buffer);
+ lcd.setWindow(0,0,319,239);
+ lcd.writeMultiple(0x0000, 320 * 240);
+ drawUI();
break;
case U8G_DEV_MSG_STOP:
break;
case U8G_DEV_MSG_PAGE_FIRST:
- u8g_WriteEscSeqP(u8g, dev, page_first_sequence);
+ if (lcd.id == 0) break;
+
+#if HAS_COLOR_LEDS && ENABLED(PRINTER_EVENT_LEDS)
+ newColor = (0xF800 & (((uint16_t)leds.color.r) << 8)) | (0x07E0 & (((uint16_t)leds.color.g) << 3)) | (0x001F & (((uint16_t)leds.color.b) >> 3));
+ if ((newColor != 0) && (newColor != color)) {
+ color = newColor;
+ drawUI();
+ }
+#endif
+ lcd.setWindow(X_MIN,Y_MIN,X_MAX,Y_MAX);
break;
case U8G_DEV_MSG_PAGE_NEXT:
- for (j = 0; j < 8; j++) {
+ if (lcd.id == 0) break;
+
+ for (j = 0; j < 8; j++) {
k = 0;
- for (i = 0; i < (uint32_t)pb->width; i++) {
- const uint8_t b = *(((uint8_t *)pb->buf) + i);
- const uint16_t c = TEST(b, j) ? 0x7FFF : 0x0000;
- buffer[k++] = c; buffer[k++] = c;
- }
- for (k = 0; k < 2; k++) {
- u8g_WriteSequence(u8g, dev, 128, (uint8_t*)buffer);
- u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[64]));
- u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[128]));
- u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[192]));
+ for (i = 0; i < (uint32_t) pb->width; i++) {
+ byte = *(((uint8_t *)pb->buf) + i);
+ if (byte & (1 << j)) {
+ buffer[k++] = color;
+ buffer[k++] = color;
+ } else {
+ buffer[k++] = 0x0000;
+ buffer[k++] = 0x0000;
+ }
}
+ for (k = 0; k < 2; k++) lcd.writeSequence(buffer, 256);
}
break;
case U8G_DEV_MSG_SLEEP_ON:
+ return 1;
+
case U8G_DEV_MSG_SLEEP_OFF:
return 1;
}
diff --git a/marlin-qq-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.~~p b/marlin-qq-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.~~p
new file mode 100644
index 0000000..8f295ab
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.~~p
@@ -0,0 +1,177 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+
+ u8g_dev_tft_320x240_upscale_from_128x64.cpp
+
+ Universal 8bit Graphics Library
+
+ Copyright (c) 2011, olikraus@gmail.com
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include "../../inc/MarlinConfig.h"
+
+#if HAS_GRAPHICAL_LCD
+
+#include "U8glib.h"
+#include "HAL_LCD_com_defines.h"
+#include "string.h"
+
+#define WIDTH 128
+#define HEIGHT 64
+#define PAGE_HEIGHT 8
+
+#define X_MIN 32
+#define Y_MIN 56
+#define X_MAX (X_MIN + 2 * WIDTH - 1)
+#define Y_MAX (Y_MIN + 2 * HEIGHT - 1)
+
+#define LCD_COLUMN 0x2A /* Colomn address register */
+#define LCD_ROW 0x2B /* Row address register */
+#define LCD_WRITE_RAM 0x2C
+
+static uint32_t lcd_id = 0;
+
+#define U8G_ESC_DATA(x) (uint8_t)(x >> 8), (uint8_t)(x & 0xFF)
+
+static const uint8_t page_first_sequence[] = {
+ U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(X_MIN), U8G_ESC_DATA(X_MAX),
+ U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(Y_MIN), U8G_ESC_DATA(Y_MAX),
+ U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
+ U8G_ESC_END
+};
+
+static const uint8_t clear_screen_sequence[] = {
+ U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
+ U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
+ U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
+ U8G_ESC_END
+};
+
+static const uint8_t st7789v_init_sequence[] = { // 0x8552 - ST7789V
+ U8G_ESC_ADR(0),
+ 0x10,
+ U8G_ESC_DLY(10),
+ 0x01,
+ U8G_ESC_DLY(100), U8G_ESC_DLY(100),
+ 0x11,
+ U8G_ESC_DLY(120),
+ 0x36, U8G_ESC_ADR(1), 0xA0,
+ U8G_ESC_ADR(0), 0x3A, U8G_ESC_ADR(1), 0x05,
+ U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
+ U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
+ U8G_ESC_ADR(0), 0xB2, U8G_ESC_ADR(1), 0x0C, 0x0C, 0x00, 0x33, 0x33,
+ U8G_ESC_ADR(0), 0xB7, U8G_ESC_ADR(1), 0x35,
+ U8G_ESC_ADR(0), 0xBB, U8G_ESC_ADR(1), 0x1F,
+ U8G_ESC_ADR(0), 0xC0, U8G_ESC_ADR(1), 0x2C,
+ U8G_ESC_ADR(0), 0xC2, U8G_ESC_ADR(1), 0x01, 0xC3,
+ U8G_ESC_ADR(0), 0xC4, U8G_ESC_ADR(1), 0x20,
+ U8G_ESC_ADR(0), 0xC6, U8G_ESC_ADR(1), 0x0F,
+ U8G_ESC_ADR(0), 0xD0, U8G_ESC_ADR(1), 0xA4, 0xA1,
+ U8G_ESC_ADR(0), 0xE0, U8G_ESC_ADR(1), 0xD0, 0x08, 0x11, 0x08, 0x0C, 0x15, 0x39, 0x33, 0x50, 0x36, 0x13, 0x14, 0x29, 0x2D,
+ U8G_ESC_ADR(0), 0xE1, U8G_ESC_ADR(1), 0xD0, 0x08, 0x10, 0x08, 0x06, 0x06, 0x39, 0x44, 0x51, 0x0B, 0x16, 0x14, 0x2F, 0x31,
+ U8G_ESC_ADR(0), 0x29, 0x11, 0x35, U8G_ESC_ADR(1), 0x00,
+ U8G_ESC_END
+};
+
+uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
+ u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
+ uint16_t buffer[256];
+ uint32_t i, j, k;
+
+ switch (msg) {
+ case U8G_DEV_MSG_INIT:
+ dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, &lcd_id);
+ if (lcd_id == 0x040404) return 0; // No connected display on FSMC
+ if (lcd_id == 0xFFFFFF) return 0; // No connected display on SPI
+
+ memset(buffer, 0x00, sizeof(buffer));
+
+ if ((lcd_id & 0xFFFF) == 0x8552) // ST7789V
+ u8g_WriteEscSeqP(u8g, dev, st7789v_init_sequence);
+
+ u8g_WriteEscSeqP(u8g, dev, clear_screen_sequence);
+ for (i = 0; i < 960; i++)
+ u8g_WriteSequence(u8g, dev, 160, (uint8_t *)buffer);
+ break;
+
+ case U8G_DEV_MSG_STOP:
+ break;
+
+ case U8G_DEV_MSG_PAGE_FIRST:
+ u8g_WriteEscSeqP(u8g, dev, page_first_sequence);
+ break;
+
+ case U8G_DEV_MSG_PAGE_NEXT:
+ for (j = 0; j < 8; j++) {
+ k = 0;
+ for (i = 0; i < (uint32_t)pb->width; i++) {
+ const uint8_t b = *(((uint8_t *)pb->buf) + i);
+ const uint16_t c = TEST(b, j) ? 0x7FFF : 0x0000;
+ buffer[k++] = c; buffer[k++] = c;
+ }
+ for (k = 0; k < 2; k++) {
+ u8g_WriteSequence(u8g, dev, 128, (uint8_t*)buffer);
+ u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[64]));
+ u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[128]));
+ u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[192]));
+ }
+ }
+ break;
+
+ case U8G_DEV_MSG_SLEEP_ON:
+ case U8G_DEV_MSG_SLEEP_OFF:
+ return 1;
+ }
+ return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
+}
+
+U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_tft_320x240_upscale_from_128x64_fn, U8G_COM_HAL_FSMC_FN);
+
+#endif // HAS_GRAPHICAL_LCD
diff --git a/marlin-original-clean/Marlin/src/lcd/extensible_ui/lib/example.cpp b/marlin-qq-clean/Marlin/src/lcd/extensible_ui/lib/example.cpp
index 2a11d5c..5a52e26 100644
--- a/marlin-original-clean/Marlin/src/lcd/extensible_ui/lib/example.cpp
+++ b/marlin-qq-clean/Marlin/src/lcd/extensible_ui/lib/example.cpp
@@ -1,6 +1,6 @@
-/*************
- * dummy.cpp *
- *************/
+/***************
+ * example.cpp *
+ ***************/
/****************************************************************************
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
@@ -21,7 +21,7 @@
#include "../../../inc/MarlinConfigPre.h"
-#if ENABLED(EXTENSIBLE_UI)
+#if BOTH(EXTUI_EXAMPLE, EXTENSIBLE_UI)
#include "../ui_api.h"
@@ -58,8 +58,36 @@ namespace ExtUI {
void onUserConfirmRequired(const char * const msg) {}
void onStatusChanged(const char * const msg) {}
void onFactoryReset() {}
- void onLoadSettings() {}
- void onStoreSettings() {}
+
+ void onStoreSettings(char *buff) {
+ // This is called when saving to EEPROM (i.e. M500). If the ExtUI needs
+ // permanent data to be stored, it can write up to eeprom_data_size bytes
+ // into buff.
+
+ // Example:
+ // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
+ // memcpy(buff, &myDataStruct, sizeof(myDataStruct));
+ }
+
+ void onLoadSettings(const char *buff) {
+ // This is called while loading settings from EEPROM. If the ExtUI
+ // needs to retrieve data, it should copy up to eeprom_data_size bytes
+ // from buff
+
+ // Example:
+ // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
+ // memcpy(&myDataStruct, buff, sizeof(myDataStruct));
+ }
+
+ void onConfigurationStoreWritten(bool success) {
+ // This is called after the entire EEPROM has been written,
+ // whether successful or not.
+ }
+
+ void onConfigurationStoreRead(bool success) {
+ // This is called after the entire EEPROM has been read,
+ // whether successful or not.
+ }
}
-#endif // EXTENSIBLE_UI
+#endif // EXTUI_EXAMPLE && EXTENSIBLE_UI
diff --git a/marlin-original-clean/Marlin/src/lcd/extensible_ui/ui_api.cpp b/marlin-qq-clean/Marlin/src/lcd/extensible_ui/ui_api.cpp
index 8e531ec..a140896 100644
--- a/marlin-original-clean/Marlin/src/lcd/extensible_ui/ui_api.cpp
+++ b/marlin-qq-clean/Marlin/src/lcd/extensible_ui/ui_api.cpp
@@ -82,11 +82,7 @@
#include "ui_api.h"
#if ENABLED(BACKLASH_GCODE)
- extern float backlash_distance_mm[XYZ];
- extern uint8_t backlash_correction;
- #ifdef BACKLASH_SMOOTHING_MM
- extern float backlash_smoothing_mm;
- #endif
+ #include "../../feature/backlash.h"
#endif
#if HAS_LEVELING
@@ -111,7 +107,6 @@ static struct {
} flags;
namespace ExtUI {
-
#ifdef __SAM3X8E__
/**
* Implement a special millis() to allow time measurement
@@ -517,13 +512,13 @@ namespace ExtUI {
bool getFilamentRunoutEnabled() { return runout.enabled; }
void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; }
- #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
float getFilamentRunoutDistance_mm() {
- return RunoutResponseDelayed::runout_distance_mm;
+ return runout.runout_distance();
}
void setFilamentRunoutDistance_mm(const float value) {
- RunoutResponseDelayed::runout_distance_mm = clamp(value, 0, 999);
+ runout.set_runout_distance(clamp(value, 0, 999));
}
#endif
#endif
@@ -687,16 +682,16 @@ namespace ExtUI {
#endif // HAS_HOTEND_OFFSET
#if ENABLED(BACKLASH_GCODE)
- float getAxisBacklash_mm(const axis_t axis) { return backlash_distance_mm[axis]; }
+ float getAxisBacklash_mm(const axis_t axis) { return backlash.distance_mm[axis]; }
void setAxisBacklash_mm(const float value, const axis_t axis)
- { backlash_distance_mm[axis] = clamp(value,0,5); }
+ { backlash.distance_mm[axis] = clamp(value,0,5); }
- float getBacklashCorrection_percent() { return ui8_to_percent(backlash_correction); }
- void setBacklashCorrection_percent(const float value) { backlash_correction = map(clamp(value, 0, 100), 0, 100, 0, 255); }
+ float getBacklashCorrection_percent() { return ui8_to_percent(backlash.correction); }
+ void setBacklashCorrection_percent(const float value) { backlash.correction = map(clamp(value, 0, 100), 0, 100, 0, 255); }
#ifdef BACKLASH_SMOOTHING_MM
- float getBacklashSmoothing_mm() { return backlash_smoothing_mm; }
- void setBacklashSmoothing_mm(const float value) { backlash_smoothing_mm = clamp(value, 0, 999); }
+ float getBacklashSmoothing_mm() { return backlash.smoothing_mm; }
+ void setBacklashSmoothing_mm(const float value) { backlash.smoothing_mm = clamp(value, 0, 999); }
#endif
#endif
@@ -750,7 +745,7 @@ namespace ExtUI {
}
bool commandsInQueue() { return (planner.movesplanned() || commands_in_queue); }
-
+
bool isAxisPositionKnown(const axis_t axis) {
return TEST(axis_known_position, axis);
}
diff --git a/marlin-original-clean/Marlin/src/lcd/extensible_ui/ui_api.h b/marlin-qq-clean/Marlin/src/lcd/extensible_ui/ui_api.h
index 2f2f99d..a643ffd 100644
--- a/marlin-original-clean/Marlin/src/lcd/extensible_ui/ui_api.h
+++ b/marlin-qq-clean/Marlin/src/lcd/extensible_ui/ui_api.h
@@ -46,6 +46,11 @@
#include "../../inc/MarlinConfig.h"
namespace ExtUI {
+ // The ExtUI implementation can store up to this many bytes
+ // in the EEPROM when the methods onStoreSettings and
+ // onLoadSettings are called.
+
+ static constexpr size_t eeprom_data_size = 48;
enum axis_t : uint8_t { X, Y, Z };
enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 };
@@ -207,7 +212,7 @@ namespace ExtUI {
bool getFilamentRunoutEnabled();
void setFilamentRunoutEnabled(const bool);
- #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
float getFilamentRunoutDistance_mm();
void setFilamentRunoutDistance_mm(const float);
#endif
@@ -283,8 +288,10 @@ namespace ExtUI {
void onUserConfirmRequired(const char * const msg);
void onStatusChanged(const char * const msg);
void onFactoryReset();
- void onStoreSettings();
- void onLoadSettings();
+ void onStoreSettings(char *);
+ void onLoadSettings(const char *);
+ void onConfigurationStoreWritten(bool success);
+ void onConfigurationStoreRead(bool success);
};
/**
diff --git a/marlin-original-clean/Marlin/src/lcd/malyanlcd.cpp b/marlin-qq-clean/Marlin/src/lcd/malyanlcd.cpp
index cb0e2a0..8a6d611 100644
--- a/marlin-original-clean/Marlin/src/lcd/malyanlcd.cpp
+++ b/marlin-qq-clean/Marlin/src/lcd/malyanlcd.cpp
@@ -41,23 +41,19 @@
* Copyright (c) 2017 Jason Nelson (xC0000005)
*/
-#include "../inc/MarlinConfig.h"
+#include "../inc/MarlinConfigPre.h"
#if ENABLED(MALYAN_LCD)
+#include "extensible_ui/ui_api.h"
+
#include "ultralcd.h"
#include "../module/temperature.h"
-#include "../module/planner.h"
#include "../module/stepper.h"
#include "../module/motion.h"
-#include "../module/probe.h"
#include "../libs/duration_t.h"
#include "../module/printcounter.h"
-#include "../gcode/gcode.h"
#include "../gcode/queue.h"
-#include "../module/configuration_store.h"
-
-#include "../Marlin.h"
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"
@@ -412,78 +408,118 @@ void update_usb_status(const bool forceUpdate) {
}
}
-/**
- * - from printer on startup:
- * {SYS:STARTED}{VER:29}{SYS:STARTED}{R:UD}
- * The optimize attribute fixes a register Compile
- * error for amtel.
- */
-void MarlinUI::update() {
- static char inbound_buffer[MAX_CURLY_COMMAND];
-
- // First report USB status.
- update_usb_status(false);
-
- // now drain commands...
- while (LCD_SERIAL.available()) {
- const byte b = (byte)LCD_SERIAL.read() & 0x7F;
- inbound_buffer[inbound_count++] = b;
- if (b == '}' || inbound_count == sizeof(inbound_buffer) - 1) {
- inbound_buffer[inbound_count - 1] = '\0';
- process_lcd_command(inbound_buffer);
- inbound_count = 0;
- inbound_buffer[0] = 0;
- }
+namespace ExtUI {
+ void onStartup() {
+ /**
+ * The Malyan LCD actually runs as a separate MCU on Serial 1.
+ * This code's job is to siphon the weird curly-brace commands from
+ * it and translate into gcode, which then gets injected into
+ * the command queue where possible.
+ */
+ inbound_count = 0;
+ LCD_SERIAL.begin(500000);
+
+ // Signal init
+ write_to_lcd_P(PSTR("{SYS:STARTED}\r\n"));
+
+ // send a version that says "unsupported"
+ write_to_lcd_P(PSTR("{VER:99}\r\n"));
+
+ // No idea why it does this twice.
+ write_to_lcd_P(PSTR("{SYS:STARTED}\r\n"));
+ update_usb_status(true);
}
- #if ENABLED(SDSUPPORT)
- // The way last printing status works is simple:
- // The UI needs to see at least one TQ which is not 100%
- // and then when the print is complete, one which is.
- static uint8_t last_percent_done = 100;
-
- // If there was a print in progress, we need to emit the final
- // print status as {TQ:100}. Reset last percent done so a new print will
- // issue a percent of 0.
- const uint8_t percent_done = IS_SD_PRINTING() ? card.percentDone() : last_printing_status ? 100 : 0;
- if (percent_done != last_percent_done) {
- char message_buffer[10];
- sprintf_P(message_buffer, PSTR("{TQ:%03i}"), percent_done);
- write_to_lcd(message_buffer);
- last_percent_done = percent_done;
- last_printing_status = IS_SD_PRINTING();
+ void onIdle() {
+ /**
+ * - from printer on startup:
+ * {SYS:STARTED}{VER:29}{SYS:STARTED}{R:UD}
+ * The optimize attribute fixes a register Compile
+ * error for amtel.
+ */
+ static char inbound_buffer[MAX_CURLY_COMMAND];
+
+ // First report USB status.
+ update_usb_status(false);
+
+ // now drain commands...
+ while (LCD_SERIAL.available()) {
+ const byte b = (byte)LCD_SERIAL.read() & 0x7F;
+ inbound_buffer[inbound_count++] = b;
+ if (b == '}' || inbound_count == sizeof(inbound_buffer) - 1) {
+ inbound_buffer[inbound_count - 1] = '\0';
+ process_lcd_command(inbound_buffer);
+ inbound_count = 0;
+ inbound_buffer[0] = 0;
+ }
}
- #endif
-}
-/**
- * The Malyan LCD actually runs as a separate MCU on Serial 1.
- * This code's job is to siphon the weird curly-brace commands from
- * it and translate into gcode, which then gets injected into
- * the command queue where possible.
- */
-void MarlinUI::init() {
- inbound_count = 0;
- LCD_SERIAL.begin(500000);
+ #if ENABLED(SDSUPPORT)
+ // The way last printing status works is simple:
+ // The UI needs to see at least one TQ which is not 100%
+ // and then when the print is complete, one which is.
+ static uint8_t last_percent_done = 100;
+
+ // If there was a print in progress, we need to emit the final
+ // print status as {TQ:100}. Reset last percent done so a new print will
+ // issue a percent of 0.
+ const uint8_t percent_done = IS_SD_PRINTING() ? card.percentDone() : last_printing_status ? 100 : 0;
+ if (percent_done != last_percent_done) {
+ char message_buffer[10];
+ sprintf_P(message_buffer, PSTR("{TQ:%03i}"), percent_done);
+ write_to_lcd(message_buffer);
+ last_percent_done = percent_done;
+ last_printing_status = IS_SD_PRINTING();
+ }
+ #endif
+ }
- // Signal init
- write_to_lcd_P(PSTR("{SYS:STARTED}\r\n"));
+ void onPrinterKilled(PGM_P const msg) {}
+ void onMediaInserted() {};
+ void onMediaError() {};
+ void onMediaRemoved() {};
+ void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
+ void onPrintTimerStarted() {}
+ void onPrintTimerPaused() {}
+ void onPrintTimerStopped() {}
+ void onFilamentRunout() {}
+ void onUserConfirmRequired(const char * const msg) {}
+ void onStatusChanged(const char * const msg) {
+ write_to_lcd_P(PSTR("{E:"));
+ write_to_lcd(msg);
+ write_to_lcd_P("}");
+ }
+ void onFactoryReset() {}
- // send a version that says "unsupported"
- write_to_lcd_P(PSTR("{VER:99}\r\n"));
+ void onStoreSettings(char *buff) {
+ // This is called when saving to EEPROM (i.e. M500). If the ExtUI needs
+ // permanent data to be stored, it can write up to eeprom_data_size bytes
+ // into buff.
- // No idea why it does this twice.
- write_to_lcd_P(PSTR("{SYS:STARTED}\r\n"));
- update_usb_status(true);
-}
+ // Example:
+ // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
+ // memcpy(buff, &myDataStruct, sizeof(myDataStruct));
+ }
-/**
- * Set an alert.
- */
-void MarlinUI::set_alert_status_P(PGM_P const message) {
- write_to_lcd_P(PSTR("{E:"));
- write_to_lcd_P(message);
- write_to_lcd_P("}");
+ void onLoadSettings(const char *buff) {
+ // This is called while loading settings from EEPROM. If the ExtUI
+ // needs to retrieve data, it should copy up to eeprom_data_size bytes
+ // from buff
+
+ // Example:
+ // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
+ // memcpy(&myDataStruct, buff, sizeof(myDataStruct));
+ }
+
+ void onConfigurationStoreWritten(bool success) {
+ // This is called after the entire EEPROM has been written,
+ // whether successful or not.
+ }
+
+ void onConfigurationStoreRead(bool success) {
+ // This is called after the entire EEPROM has been read,
+ // whether successful or not.
+ }
}
#endif // MALYAN_LCD
diff --git a/marlin-original-clean/Marlin/src/lcd/menu/menu_backlash.cpp b/marlin-qq-clean/Marlin/src/lcd/menu/menu_backlash.cpp
index 1b183e1..9c51230 100644
--- a/marlin-original-clean/Marlin/src/lcd/menu/menu_backlash.cpp
+++ b/marlin-qq-clean/Marlin/src/lcd/menu/menu_backlash.cpp
@@ -30,26 +30,21 @@
#include "menu.h"
-extern float backlash_distance_mm[XYZ];
-extern uint8_t backlash_correction;
-
-#ifdef BACKLASH_SMOOTHING_MM
- extern float backlash_smoothing_mm;
-#endif
+#include "../../feature/backlash.h"
void menu_backlash() {
START_MENU();
MENU_BACK(MSG_MAIN);
- MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_BACKLASH_CORRECTION, &backlash_correction, all_off, all_on);
+ MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_BACKLASH_CORRECTION, &backlash.correction, all_off, all_on);
- #define EDIT_BACKLASH_DISTANCE(N) MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_##N, &backlash_distance_mm[_AXIS(N)], 0.0f, 9.9f);
+ #define EDIT_BACKLASH_DISTANCE(N) MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_##N, &backlash.distance_mm[_AXIS(N)], 0.0f, 9.9f);
EDIT_BACKLASH_DISTANCE(A);
EDIT_BACKLASH_DISTANCE(B);
EDIT_BACKLASH_DISTANCE(C);
#ifdef BACKLASH_SMOOTHING_MM
- MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_BACKLASH_SMOOTHING, &backlash_smoothing_mm, 0.0f, 9.9f);
+ MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_BACKLASH_SMOOTHING, &backlash.smoothing_mm, 0.0f, 9.9f);
#endif
END_MENU();
diff --git a/marlin-original-clean/Marlin/src/lcd/ultralcd.cpp b/marlin-qq-clean/Marlin/src/lcd/ultralcd.cpp
index 3fd483a..e107960 100644
--- a/marlin-original-clean/Marlin/src/lcd/ultralcd.cpp
+++ b/marlin-qq-clean/Marlin/src/lcd/ultralcd.cpp
@@ -23,7 +23,7 @@
#include "../inc/MarlinConfigPre.h"
// These displays all share the MarlinUI class
-#if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI)
+#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
#include "ultralcd.h"
#include "fontutils.h"
MarlinUI ui;
@@ -95,6 +95,12 @@
#if HAS_SLOW_BUTTONS
volatile uint8_t MarlinUI::slow_buttons;
#endif
+ #if defined(TOUCH_BUTTONS)
+ #include "xpt2046.h"
+ volatile uint8_t MarlinUI::touch_buttons;
+ uint8_t MarlinUI::read_touch_buttons() { return xpt2046_read_buttons(); }
+ #endif
+
#endif
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
@@ -287,6 +293,9 @@ void MarlinUI::init() {
#if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS
slow_buttons = 0;
#endif
+ #if HAS_ENCODER_ACTION && defined(TOUCH_BUTTONS)
+ touch_buttons = 0;
+ #endif
update_buttons();
@@ -770,6 +779,9 @@ void MarlinUI::update() {
#if HAS_SLOW_BUTTONS
slow_buttons = read_slow_buttons(); // Buttons that take too long to read in interrupt context
#endif
+ #if defined(TOUCH_BUTTONS)
+ touch_buttons = read_touch_buttons();
+ #endif
#if ENABLED(REPRAPWORLD_KEYPAD)
@@ -1112,6 +1124,9 @@ void MarlinUI::update() {
#if HAS_SLOW_BUTTONS
| slow_buttons
#endif
+ #if defined(TOUCH_BUTTONS)
+ | touch_buttons
+ #endif
;
#elif HAS_ADC_BUTTONS
buttons = 0;
diff --git a/marlin-original-clean/Marlin/src/lcd/ultralcd.h b/marlin-qq-clean/Marlin/src/lcd/ultralcd.h
index 2ea7f45..965bce8 100644
--- a/marlin-original-clean/Marlin/src/lcd/ultralcd.h
+++ b/marlin-qq-clean/Marlin/src/lcd/ultralcd.h
@@ -145,6 +145,7 @@
#define EN_A _BV(BLEN_A)
#define EN_B _BV(BLEN_B)
+ //#define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
#if BUTTON_EXISTS(ENC)
@@ -496,6 +497,10 @@ public:
static volatile uint8_t slow_buttons;
static uint8_t read_slow_buttons();
#endif
+ #if defined(TOUCH_BUTTONS)
+ static volatile uint8_t touch_buttons;
+ static uint8_t read_touch_buttons();
+ #endif
static void update_buttons();
static inline bool button_pressed() { return BUTTON_CLICK(); }
#if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
diff --git a/marlin-original-clean/Marlin/src/module/configuration_store.cpp b/marlin-qq-clean/Marlin/src/module/configuration_store.cpp
index ceab713..99a135b 100644
--- a/marlin-original-clean/Marlin/src/module/configuration_store.cpp
+++ b/marlin-qq-clean/Marlin/src/module/configuration_store.cpp
@@ -37,7 +37,7 @@
*/
// Change EEPROM version if the structure changes
-#define EEPROM_VERSION "V65"
+#define EEPROM_VERSION "V66"
#define EEPROM_OFFSET 100
// Check the integrity of data offsets.
@@ -90,10 +90,16 @@
#include "../feature/pause.h"
+#if ENABLED(BACKLASH_COMPENSATION)
+ #include "../feature/backlash.h"
+#endif
+
#if HAS_FILAMENT_SENSOR
#include "../feature/runout.h"
#endif
+#include "../lcd/extensible_ui/ui_api.h"
+
#if ENABLED(EXTRA_LIN_ADVANCE_K)
extern float saved_extruder_advance_K[EXTRUDERS];
#endif
@@ -149,6 +155,7 @@ typedef struct SettingsDataStruct {
// FILAMENT_RUNOUT_SENSOR
//
bool runout_sensor_enabled; // M412 S
+ float runout_distance_mm; // M412 D
//
// ENABLE_LEVELING_FADE_HEIGHT
@@ -298,6 +305,21 @@ typedef struct SettingsDataStruct {
toolchange_settings_t toolchange_settings; // M217 S P R
#endif
+ //
+ // BACKLASH_COMPENSATION
+ //
+ float backlash_distance_mm[XYZ]; // M425 X Y Z
+ uint8_t backlash_correction; // M425 F
+ float backlash_smoothing_mm; // M425 S
+
+ //
+ // EXTENSIBLE_UI
+ //
+ #if ENABLED(EXTENSIBLE_UI)
+ // This is a significant hardware change; don't reserve space when not present
+ uint8_t extui_data[ExtUI::eeprom_data_size];
+ #endif
+
} SettingsData;
//static_assert(sizeof(SettingsData) <= E2END + 1, "EEPROM too small to contain SettingsData!");
@@ -372,6 +394,16 @@ void MarlinSettings::postprocess() {
report_current_position();
}
+#if ENABLED(PRINTCOUNTER) && ENABLED(EEPROM_SETTINGS)
+ #include "printcounter.h"
+
+ static_assert(
+ !WITHIN(STATS_EEPROM_ADDRESS, EEPROM_OFFSET, EEPROM_OFFSET + sizeof(SettingsData)) &&
+ !WITHIN(STATS_EEPROM_ADDRESS + sizeof(printStatistics), EEPROM_OFFSET, EEPROM_OFFSET + sizeof(SettingsData)),
+ "STATS_EEPROM_ADDRESS collides with EEPROM settings storage."
+ );
+#endif
+
#if ENABLED(SD_FIRMWARE_UPDATE)
#if ENABLED(EEPROM_SETTINGS)
@@ -528,11 +560,18 @@ void MarlinSettings::postprocess() {
//
{
#if HAS_FILAMENT_SENSOR
- EEPROM_WRITE(runout.enabled);
+ const bool &runout_sensor_enabled = runout.enabled;
#else
- const bool runout_sensor_enabled = true;
- EEPROM_WRITE(runout_sensor_enabled);
+ const bool runout_sensor_enabled = false;
#endif
+ #if HAS_FILAMENT_SENSOR && defined(FILAMENT_RUNOUT_DISTANCE_MM)
+ const float &runout_distance_mm = runout.runout_distance();
+ #else
+ const float runout_distance_mm = 0;
+ #endif
+ _FIELD_TEST(runout_sensor_enabled);
+ EEPROM_WRITE(runout_sensor_enabled);
+ EEPROM_WRITE(runout_distance_mm);
}
//
@@ -1118,6 +1157,42 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(toolchange_settings);
#endif
+ //
+ // Backlash Compensation
+ //
+ {
+ #if ENABLED(BACKLASH_COMPENSATION)
+ const float (&backlash_distance_mm)[XYZ] = backlash.distance_mm;
+ const uint8_t &backlash_correction = backlash.correction;
+ #else
+ const float backlash_distance_mm[XYZ] = { 0 };
+ const uint8_t backlash_correction = 0;
+ #endif
+ #ifdef BACKLASH_SMOOTHING_MM
+ const float &backlash_smoothing_mm = backlash.smoothing_mm;
+ #else
+ const float backlash_smoothing_mm = 3;
+ #endif
+ _FIELD_TEST(backlash_distance_mm);
+ EEPROM_WRITE(backlash_distance_mm[X_AXIS]);
+ EEPROM_WRITE(backlash_distance_mm[Y_AXIS]);
+ EEPROM_WRITE(backlash_distance_mm[Z_AXIS]);
+ EEPROM_WRITE(backlash_correction);
+ EEPROM_WRITE(backlash_smoothing_mm);
+ }
+
+ //
+ // Extensible UI User Data
+ //
+ #if ENABLED(EXTENSIBLE_UI)
+ {
+ char extui_data[ExtUI::eeprom_data_size] = { 0 };
+ ExtUI::onStoreSettings(extui_data);
+ _FIELD_TEST(extui_data);
+ EEPROM_WRITE(extui_data);
+ }
+ #endif
+
//
// Validate CRC and Data Size
//
@@ -1148,7 +1223,7 @@ void MarlinSettings::postprocess() {
#endif
#if ENABLED(EXTENSIBLE_UI)
- if (!eeprom_error) ExtUI::onStoreSettings();
+ ExtUI::onConfigurationStoreWritten(!eeprom_error);
#endif
return !eeprom_error;
@@ -1264,12 +1339,18 @@ void MarlinSettings::postprocess() {
// Filament Runout Sensor
//
{
- _FIELD_TEST(runout_sensor_enabled);
#if HAS_FILAMENT_SENSOR
- EEPROM_READ(runout.enabled);
+ bool &runout_sensor_enabled = runout.enabled;
#else
bool runout_sensor_enabled;
- EEPROM_READ(runout_sensor_enabled);
+ #endif
+ _FIELD_TEST(runout_sensor_enabled);
+ EEPROM_READ(runout_sensor_enabled);
+
+ float runout_distance_mm;
+ EEPROM_READ(runout_distance_mm);
+ #if HAS_FILAMENT_SENSOR && defined(FILAMENT_RUNOUT_DISTANCE_MM)
+ runout.set_runout_distance(runout_distance_mm);
#endif
}
@@ -1851,6 +1932,44 @@ void MarlinSettings::postprocess() {
EEPROM_READ(toolchange_settings);
#endif
+ //
+ // Backlash Compensation
+ //
+ {
+ #if ENABLED(BACKLASH_COMPENSATION)
+ float (&backlash_distance_mm)[XYZ] = backlash.distance_mm;
+ uint8_t &backlash_correction = backlash.correction;
+ #else
+ float backlash_distance_mm[XYZ];
+ uint8_t backlash_correction;
+ #endif
+ #ifdef BACKLASH_SMOOTHING_MM
+ float &backlash_smoothing_mm = backlash.smoothing_mm;
+ #else
+ float backlash_smoothing_mm;
+ #endif
+ _FIELD_TEST(backlash_distance_mm);
+ EEPROM_READ(backlash_distance_mm[X_AXIS]);
+ EEPROM_READ(backlash_distance_mm[Y_AXIS]);
+ EEPROM_READ(backlash_distance_mm[Z_AXIS]);
+ EEPROM_READ(backlash_correction);
+ EEPROM_READ(backlash_smoothing_mm);
+ }
+
+ //
+ // Extensible UI User Data
+ //
+ #if ENABLED(EXTENSIBLE_UI)
+ // This is a significant hardware change; don't reserve EEPROM space when not present
+ {
+ const char extui_data[ExtUI::eeprom_data_size] = { 0 };
+ _FIELD_TEST(extui_data);
+ EEPROM_READ(extui_data);
+ if(!validating)
+ ExtUI::onLoadSettings(extui_data);
+ }
+ #endif
+
eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
if (eeprom_error) {
DEBUG_ECHO_START();
@@ -1921,7 +2040,7 @@ void MarlinSettings::postprocess() {
if (validate()) {
const bool success = _load();
#if ENABLED(EXTENSIBLE_UI)
- if (success) ExtUI::onLoadSettings();
+ ExtUI::onConfigurationStoreRead(success);
#endif
return success;
}
@@ -2053,13 +2172,13 @@ void MarlinSettings::reset() {
#if HAS_CLASSIC_JERK
#ifndef DEFAULT_XJERK
- #define DEFAULT_XJERK 0
+ #define DEFAULT_XJERK 10
#endif
#ifndef DEFAULT_YJERK
- #define DEFAULT_YJERK 0
+ #define DEFAULT_YJERK 10
#endif
#ifndef DEFAULT_ZJERK
- #define DEFAULT_ZJERK 0
+ #define DEFAULT_ZJERK 10
#endif
planner.max_jerk[X_AXIS] = DEFAULT_XJERK;
planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
@@ -2090,6 +2209,9 @@ void MarlinSettings::reset() {
#if HAS_FILAMENT_SENSOR
runout.enabled = true;
runout.reset();
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM);
+ #endif
#endif
//
@@ -2108,6 +2230,23 @@ void MarlinSettings::reset() {
toolchange_settings.z_raise = TOOLCHANGE_ZRAISE;
#endif
+ #if ENABLED(BACKLASH_GCODE)
+ backlash.correction = (BACKLASH_CORRECTION) * 255;
+ #ifdef BACKLASH_DISTANCE_MM
+ constexpr float tmp[XYZ] = BACKLASH_DISTANCE_MM;
+ backlash.distance_mm[X_AXIS] = tmp[X_AXIS];
+ backlash.distance_mm[Y_AXIS] = tmp[Y_AXIS];
+ backlash.distance_mm[Z_AXIS] = tmp[Z_AXIS];
+ #endif
+ #ifdef BACKLASH_SMOOTHING_MM
+ backlash.smoothing_mm = BACKLASH_SMOOTHING_MM;
+ #endif
+ #endif
+
+ #if ENABLED(EXTENSIBLE_UI)
+ ExtUI::onFactoryReset();
+ #endif
+
//
// Magnetic Parking Extruder
//
@@ -3200,6 +3339,31 @@ void MarlinSettings::reset() {
CONFIG_ECHO_START();
M217_report(true);
#endif
+
+ #if ENABLED(BACKLASH_GCODE)
+ CONFIG_ECHO_HEADING("Backlash compensation:");
+ CONFIG_ECHO_START();
+ SERIAL_ECHOLNPAIR(
+ " M425 F", backlash.get_correction(),
+ " X", LINEAR_UNIT(backlash.distance_mm[X_AXIS]),
+ " Y", LINEAR_UNIT(backlash.distance_mm[Y_AXIS]),
+ " Z", LINEAR_UNIT(backlash.distance_mm[Z_AXIS])
+ #ifdef BACKLASH_SMOOTHING_MM
+ , " S", LINEAR_UNIT(backlash.smoothing_mm)
+ #endif
+ );
+ #endif
+
+ #if HAS_FILAMENT_SENSOR
+ CONFIG_ECHO_HEADING("Filament runout sensor:");
+ CONFIG_ECHO_START();
+ SERIAL_ECHOLNPAIR(
+ " M412 S", int(runout.enabled)
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ , " D", LINEAR_UNIT(runout.runout_distance())
+ #endif
+ );
+ #endif
}
#endif // !DISABLE_M503
diff --git a/marlin-original-clean/Marlin/src/module/planner.cpp b/marlin-qq-clean/Marlin/src/module/planner.cpp
index 5073d90..9c8a6f0 100644
--- a/marlin-original-clean/Marlin/src/module/planner.cpp
+++ b/marlin-qq-clean/Marlin/src/module/planner.cpp
@@ -92,6 +92,10 @@
#include "../feature/power.h"
#endif
+#if ENABLED(BACKLASH_COMPENSATION)
+ #include "../feature/backlash.h"
+#endif
+
// Delay for delivery of first block to the stepper ISR, if the queue contains 2 or
// fewer movements. The delay is measured in milliseconds, and must be less than 250ms
#define BLOCK_DELAY_FOR_1ST_MOVE 100
@@ -1560,94 +1564,6 @@ void Planner::synchronize() {
) idle();
}
-/**
- * The following implements axis backlash correction. To minimize seams
- * on the printed part, the backlash correction only adds steps to the
- * current segment (instead of creating a new segment, which causes
- * discontinuities and print artifacts).
- *
- * When BACKLASH_SMOOTHING_MM is enabled and non-zero, the backlash
- * correction is spread over multiple segments, smoothing out print
- * artifacts even more.
- */
-#if ENABLED(BACKLASH_COMPENSATION)
- #if ENABLED(BACKLASH_GCODE)
- extern float backlash_distance_mm[];
- extern uint8_t backlash_correction;
- #ifdef BACKLASH_SMOOTHING_MM
- extern float backlash_smoothing_mm;
- #endif
- #else
- constexpr float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM,
- constexpr uint8_t backlash_correction = BACKLASH_CORRECTION * 255;
- #ifdef BACKLASH_SMOOTHING_MM
- constexpr float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM;
- #endif
- #endif
-
- void Planner::add_backlash_correction_steps(const int32_t da, const int32_t db, const int32_t dc, const uint8_t dm, block_t * const block) {
- static uint8_t last_direction_bits;
- uint8_t changed_dir = last_direction_bits ^ dm;
- // Ignore direction change if no steps are taken in that direction
- if (da == 0) CBI(changed_dir, X_AXIS);
- if (db == 0) CBI(changed_dir, Y_AXIS);
- if (dc == 0) CBI(changed_dir, Z_AXIS);
- last_direction_bits ^= changed_dir;
-
- if (backlash_correction == 0) return;
-
- #ifdef BACKLASH_SMOOTHING_MM
- // The segment proportion is a value greater than 0.0 indicating how much residual_error
- // is corrected for in this segment. The contribution is based on segment length and the
- // smoothing distance. Since the computation of this proportion involves a floating point
- // division, defer computation until needed.
- float segment_proportion = 0;
-
- // Residual error carried forward across multiple segments, so correction can be applied
- // to segments where there is no direction change.
- static int32_t residual_error[XYZ] = { 0 };
- #else
- // No leftover residual error from segment to segment
- int32_t residual_error[XYZ] = { 0 };
- // No direction change, no correction.
- if (!changed_dir) return;
- #endif
-
- const float f_corr = float(backlash_correction) / 255.0f;
-
- LOOP_XYZ(axis) {
- if (backlash_distance_mm[axis]) {
- const bool reversing = TEST(dm,axis);
-
- // When an axis changes direction, add axis backlash to the residual error
- if (TEST(changed_dir, axis))
- residual_error[axis] += (reversing ? -f_corr : f_corr) * backlash_distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
-
- // Decide how much of the residual error to correct in this segment
- int32_t error_correction = residual_error[axis];
- #ifdef BACKLASH_SMOOTHING_MM
- if (error_correction && backlash_smoothing_mm != 0) {
- // Take up a portion of the residual_error in this segment, but only when
- // the current segment travels in the same direction as the correction
- if (reversing == (error_correction < 0)) {
- if (segment_proportion == 0)
- segment_proportion = MIN(1.0f, block->millimeters / backlash_smoothing_mm);
- error_correction = ceil(segment_proportion * error_correction);
- }
- else
- error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps
- }
- #endif
- // Making a correction reduces the residual error and modifies delta_mm
- if (error_correction) {
- block->steps[axis] += ABS(error_correction);
- residual_error[axis] -= error_correction;
- }
- }
- }
- }
-#endif // BACKLASH_COMPENSATION
-
/**
* Planner::_buffer_steps
*
@@ -1919,7 +1835,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
* should *never* remove steps!
*/
#if ENABLED(BACKLASH_COMPENSATION)
- add_backlash_correction_steps(da, db, dc, dm, block);
+ backlash.add_correction_steps(da, db, dc, dm, block);
#endif
}
diff --git a/marlin-original-clean/Marlin/src/module/planner.h b/marlin-qq-clean/Marlin/src/module/planner.h
index a95c3f2..5e24ce6 100644
--- a/marlin-original-clean/Marlin/src/module/planner.h
+++ b/marlin-qq-clean/Marlin/src/module/planner.h
@@ -338,10 +338,6 @@ class Planner {
volatile static uint32_t block_buffer_runtime_us; //Theoretical block buffer runtime in µs
#endif
- #if ENABLED(BACKLASH_COMPENSATION)
- static void add_backlash_correction_steps(const int32_t da, const int32_t db, const int32_t dc, const uint8_t dm, block_t * const block);
- #endif
-
public:
/**
diff --git a/marlin-original-clean/Marlin/src/module/printcounter.cpp b/marlin-qq-clean/Marlin/src/module/printcounter.cpp
index 4fa3e50..51af80a 100644
--- a/marlin-original-clean/Marlin/src/module/printcounter.cpp
+++ b/marlin-qq-clean/Marlin/src/module/printcounter.cpp
@@ -29,6 +29,10 @@ Stopwatch print_job_timer; // Global Print Job Timer instance
#else // PRINTCOUNTER
+#if ENABLED(EXTENSIBLE_UI)
+ #include "../lcd/extensible_ui/ui_api.h"
+#endif
+
#include "printcounter.h"
#include "../Marlin.h"
#include "../HAL/shared/persistent_store_api.h"
@@ -169,6 +173,10 @@ void PrintCounter::saveStats() {
persistentStore.access_start();
persistentStore.write_data(address + sizeof(uint8_t), (uint8_t*)&data, sizeof(printStatistics));
persistentStore.access_finish();
+
+ #if ENABLED(EXTENSIBLE_UI)
+ ExtUI::onConfigurationStoreWritten(true);
+ #endif
}
#if HAS_SERVICE_INTERVALS
diff --git a/marlin-original-clean/Marlin/src/module/probe.cpp b/marlin-qq-clean/Marlin/src/module/probe.cpp
index 8988b15..39b6c8e 100644
--- a/marlin-original-clean/Marlin/src/module/probe.cpp
+++ b/marlin-qq-clean/Marlin/src/module/probe.cpp
@@ -54,6 +54,10 @@
#include "planner.h"
#endif
+#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
+ #include "../feature/backlash.h"
+#endif
+
float zprobe_zoffset; // Initialized by settings.load()
#if ENABLED(BLTOUCH)
@@ -463,30 +467,6 @@ bool set_probe_deployed(const bool deploy) {
}
#endif
-#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
- #if USES_Z_MIN_PROBE_ENDSTOP
- #define TEST_PROBE_PIN (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
- #else
- #define TEST_PROBE_PIN (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
- #endif
-
- extern float backlash_measured_mm[];
- extern uint8_t backlash_measured_num[];
-
- /* Measure Z backlash by raising nozzle in increments until probe deactivates */
- static void measure_backlash_with_probe() {
- if (backlash_measured_num[Z_AXIS] == 255) return;
-
- float start_height = current_position[Z_AXIS];
- while (current_position[Z_AXIS] < (start_height + BACKLASH_MEASUREMENT_LIMIT) && TEST_PROBE_PIN)
- do_blocking_move_to_z(current_position[Z_AXIS] + BACKLASH_MEASUREMENT_RESOLUTION, MMM_TO_MMS(BACKLASH_MEASUREMENT_FEEDRATE));
-
- // The backlash from all probe points is averaged, so count the number of measurements
- backlash_measured_mm[Z_AXIS] += current_position[Z_AXIS] - start_height;
- backlash_measured_num[Z_AXIS]++;
- }
-#endif
-
/**
* @brief Used by run_z_probe to do a single Z probe move.
*
@@ -643,7 +623,7 @@ static float run_z_probe() {
}
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
- measure_backlash_with_probe();
+ backlash.measure_with_probe();
#endif
#if MULTIPLE_PROBING > 2
diff --git a/marlin-original-clean/Marlin/src/module/stepper.cpp b/marlin-qq-clean/Marlin/src/module/stepper.cpp
index ce3141c..0e758e9 100644
--- a/marlin-original-clean/Marlin/src/module/stepper.cpp
+++ b/marlin-qq-clean/Marlin/src/module/stepper.cpp
@@ -113,7 +113,7 @@ Stepper stepper; // Singleton
#include "../feature/mixing.h"
#endif
-#if FILAMENT_RUNOUT_DISTANCE_MM > 0
+#ifdef FILAMENT_RUNOUT_DISTANCE_MM
#include "../feature/runout.h"
#endif
@@ -1537,7 +1537,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
// If current block is finished, reset pointer
if (step_events_completed >= step_event_count) {
- #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
runout.block_completed(current_block);
#endif
axis_did_move = 0;
@@ -2579,6 +2579,12 @@ void Stepper::report_positions() {
#ifdef __AVR__
SET_CS5(PRESCALER_1);
#endif
+ // Set TIM3 to 36khz. Prescaler is 2000.
+ #ifdef __STM32F1__
+ #if MB(MKS_ROBIN_MINI)
+ PWM_vref_init();
+ #endif
+ #endif
#endif
}
diff --git a/marlin-original-clean/Marlin/src/module/thermistor/thermistor_666.h b/marlin-qq-clean/Marlin/src/module/thermistor/thermistor_666.h
old mode 100755
new mode 100644
diff --git a/marlin-original-clean/Marlin/src/pins/pins.h b/marlin-qq-clean/Marlin/src/pins/pins.h
index bb7a101..d820a17 100644
--- a/marlin-original-clean/Marlin/src/pins/pins.h
+++ b/marlin-qq-clean/Marlin/src/pins/pins.h
@@ -422,6 +422,8 @@
#include "pins_MORPHEUS.h" // STM32F1 env:STM32F1
#elif MB(MKS_ROBIN)
#include "pins_MKS_ROBIN.h" // STM32F1 env:mks_robin
+#elif MB(MKS_ROBIN_MINI)
+ #include "pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini
//
// STM32 ARM Cortex-M4F
diff --git a/marlin-original-clean/Marlin/src/pins/pins_5DPRINT.h b/marlin-qq-clean/Marlin/src/pins/pins_5DPRINT.h
old mode 100755
new mode 100644
diff --git a/marlin-original-clean/Marlin/src/pins/pins_AZTEEG_X5_GT.h b/marlin-qq-clean/Marlin/src/pins/pins_AZTEEG_X5_GT.h
old mode 100755
new mode 100644
diff --git a/marlin-original-clean/Marlin/src/pins/pins_EINSTART-S.h b/marlin-qq-clean/Marlin/src/pins/pins_EINSTART-S.h
old mode 100755
new mode 100644
diff --git a/marlin-qq-clean/Marlin/src/pins/pins_MKS_ROBIN_MINI.h b/marlin-qq-clean/Marlin/src/pins/pins_MKS_ROBIN_MINI.h
new file mode 100644
index 0000000..5de0dff
--- /dev/null
+++ b/marlin-qq-clean/Marlin/src/pins/pins_MKS_ROBIN_MINI.h
@@ -0,0 +1,151 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * MKS Robin (STM32F130ZET6) board pin assignments
+ */
+
+#ifndef __STM32F1__
+ #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
+#endif
+
+#if HOTENDS > 1 || E_STEPPERS > 1
+ #error "MKS Robin mini supports only 1 hotend / E-stepper. Comment out this line to continue."
+#endif
+
+#define BOARD_NAME "MKS Robin mini"
+
+//
+// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
+//
+#define DISABLE_DEBUG
+
+//
+// Note: MKS Robin mini board is using SPI2 interface.
+//
+#define SPI_MODULE 2
+//#define I2C_EEPROM
+#define FLASH_EEPROM_EMULATION
+#define E2END 0x800 // 2K in a 24C16C
+
+// This is for EEPROM emulation in flash
+#define EEPROM_PAGE_SIZE (uint16)0x800 // 2048
+#define EEPROM_START_ADDRESS ((uint32)(0x8000000 + 512 * 1024 - 2 * EEPROM_PAGE_SIZE))
+#define EEPROM_PAGE0_BASE ((uint32)(EEPROM_START_ADDRESS + 0x000))
+#define EEPROM_PAGE1_BASE ((uint32)(EEPROM_START_ADDRESS + EEPROM_PAGE_SIZE))
+#define EEPROM_SIZE ((uint16)(EEPROM_PAGE_SIZE * 2))
+
+//
+// Servos
+// MKS Robin mini have no servos interface
+//#define SERVO0_PIN PC3 // XS1 - 5
+//#define SERVO1_PIN PA1 // XS1 - 6
+//#define SERVO2_PIN PF9 // XS2 - 5
+//#define SERVO3_PIN PF8 // XS2 - 6
+
+//
+// Limit Switches
+//
+#define X_MAX_PIN PA15
+#define Y_MAX_PIN PA12
+#define Z_MIN_PIN PA11
+#define Z_MAX_PIN PC4
+
+//
+// Steppers
+//
+#define X_ENABLE_PIN PE4
+#define X_STEP_PIN PE3
+#define X_DIR_PIN PE2
+
+#define Y_ENABLE_PIN PE1
+#define Y_STEP_PIN PE0
+#define Y_DIR_PIN PB9
+
+#define Z_ENABLE_PIN PB8
+#define Z_STEP_PIN PB5
+#define Z_DIR_PIN PB4
+
+#define E0_ENABLE_PIN PB3
+#define E0_STEP_PIN PD6
+#define E0_DIR_PIN PD3
+
+//
+// Temperature Sensors
+//
+#define TEMP_0_PIN PC1 // TH1
+#define TEMP_BED_PIN PC0 // TB1
+
+
+//
+// Heaters / Fans
+//
+#define HEATER_0_PIN PC3 // HEATER1
+#define HEATER_BED_PIN PA0 // HOT BED
+#define FAN_PIN PB1 // FAN
+
+#define BTN_ENC PC13 // Pin is not connected. Real pin is needed to enable encoder's push button functionality used by touch screen
+#define BTN_EN1 -1
+#define BTN_EN2 -1
+
+//#define MAX6675_SS_PIN PE5 // TC1 - CS1
+//#define MAX6675_SS_PIN PE6 // TC2 - CS2
+
+#define POWER_LOSS_PIN PA1 // PW_DET
+#define FIL_RUNOUT_PIN PA4 // MT_DET
+
+#define BEEPER_PIN PC5
+
+//#define LED_PIN PB2 //Robin mini have no status led
+
+/**
+ * Note: MKS Robin TFT screens may have different TFT controllers
+ * If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization.
+ *
+ * Enabling 'LCD_RESET_PIN' causes flickering when entering the LCD menu due to LCD controller reset.
+ * Reset feature was designed to "revive the LCD if static electricity killed it."
+ */
+//#define LCD_RESET_PIN PC6
+#define LCD_BACKLIGHT_PIN PD13
+#define FSMC_CS_PIN PD7 // NE1
+#define FSMC_RS_PIN PD11 // A16
+#define TOUCH_CS PC2
+
+#define SD_DETECT_PIN PD12
+
+// Motor current PWM pins
+#define MOTOR_CURRENT_PWM_XY_PIN PA6
+#define MOTOR_CURRENT_PWM_Z_PIN PA7
+#define MOTOR_CURRENT_PWM_E_PIN PB0
+#define MOTOR_CURRENT_PWM_RANGE 65535 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
+#define DEFAULT_PWM_MOTOR_CURRENT {1030, 1030, 1030} // 1.05Amp per driver, here is XY, Z and E. This values determined empirically.
+
+// this is a kind of workaround in case native marlin "digipot" interface won't work, required to uncomment related code in stm32f1/hal.cpp
+//#ifndef MKS_ROBIN_MINI_VREF_PWM
+// #define MKS_ROBIN_MINI_VREF_PWM
+//#endif
+
+//#define VREF_XY_PIN PA6
+//#define VREF_Z_PIN PA7
+//#define VREF_E1_PIN PB0
+
+
\ No newline at end of file
diff --git a/marlin-original-clean/Marlin/src/pins/pins_RAMPS_ENDER_4.h b/marlin-qq-clean/Marlin/src/pins/pins_RAMPS_ENDER_4.h
old mode 100755
new mode 100644
diff --git a/marlin-original-clean/Marlin/src/pins/pins_TEENSYLU.h b/marlin-qq-clean/Marlin/src/pins/pins_TEENSYLU.h
old mode 100755
new mode 100644
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment