From 9b38017e8a96b38741f14258e64585d8f0138ec6 Mon Sep 17 00:00:00 2001 From: Sergey Date: Thu, 26 Mar 2020 11:26:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=87=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=20=D0=BF=D0=BE=D0=B4=204S?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 220 +++-- Marlin/Configuration_adv.h | 596 ++++++++----- Marlin/src/lcd/dogm/HAL_LCD_class_defines.h | 12 + ...8g_dev_tft_480x320_upscale_from_128x64.cpp | 787 ++++++++++++++++++ Marlin/src/lcd/dogm/ultralcd_DOGM.h | 26 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 25 +- jlink.cmd | 4 + ozone.jdebug | 240 ++++++ ozone.jdebug.user | 28 + 9 files changed, 1587 insertions(+), 351 deletions(-) create mode 100644 Marlin/src/lcd/dogm/u8g_dev_tft_480x320_upscale_from_128x64.cpp create mode 100644 jlink.cmd create mode 100644 ozone.jdebug create mode 100644 ozone.jdebug.user diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index cac5343c1a..cd6a0e2eed 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -71,7 +71,7 @@ // @section info // Author info of this build printed to the host during boot and M115 -#define STRING_CONFIG_H_AUTHOR "(Yandex_an, FlyingbearGhost4S)" // Who made the changes. +#define STRING_CONFIG_H_AUTHOR "(Sergey, FlyingbearGhost4S)" // Who made the changes. //#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes) @@ -87,7 +87,7 @@ */ // Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION ** -//#define SHOW_BOOTSCREEN +#define SHOW_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup. //#define SHOW_CUSTOM_BOOTSCREEN @@ -105,15 +105,12 @@ * * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] */ - -//@ #define SERIAL_PORT 3 /** * Select a secondary serial port on the board to use for communication with the host. * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] */ -//@ #define SERIAL_PORT_2 1 #define NUM_SERIAL 2 @@ -126,20 +123,17 @@ * * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] */ -// @fixing octoprint connection issues - I guess RPi may have issues with higher baud rates. #define BAUDRATE 115200 // Enable the Bluetooth serial interface on AT90USB devices //#define BLUETOOTH // Choose the name from boards.h that matches your setup -//@ #ifndef MOTHERBOARD #define MOTHERBOARD BOARD_MKS_ROBIN_NANO #endif // Name displayed in the LCD "Ready" message and Info menu -//@ #define CUSTOM_MACHINE_NAME "FBGhost 4s" // Printer's unique ID, used by some programs to differentiate between machines. @@ -149,11 +143,10 @@ // @section extruder // This defines the number of extruders -// :[1, 2, 3, 4, 5, 6] +// :[1, 2, 3, 4, 5, 6, 7, 8] #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 1.75 // For Cyclops or any "multi-extruder" that shares a single nozzle. @@ -332,13 +325,14 @@ //#define PSU_NAME "Power Supply" #if ENABLED(PSU_CONTROL) - #define PSU_ACTIVE_HIGH false // Set 'false' for ATX (1), 'true' for X-Box (2) + #define PSU_ACTIVE_HIGH false // Set 'false' for ATX, 'true' for X-Box - //#define PS_DEFAULT_OFF // Keep power off until enabled directly with M80 + //#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80 + //#define PSU_POWERUP_DELAY 100 // (ms) Delay for the PSU to warm up to full power - //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin #if ENABLED(AUTO_POWER_CONTROL) - #define AUTO_POWER_FANS // Turn on PSU if fans need power + #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 @@ -359,13 +353,15 @@ * * Temperature sensors available: * + * -5 : PT100 / PT1000 with MAX31865 (only for sensors 0-1) + * -3 : thermocouple with MAX31855 (only for sensors 0-1) + * -2 : thermocouple with MAX6675 (only for sensors 0-1) * -4 : thermocouple with AD8495 - * -3 : thermocouple with MAX31855 (only for sensor 0) - * -2 : thermocouple with MAX6675 (only for sensor 0) * -1 : thermocouple with AD595 * 0 : not used * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) - * 331 : (3.3V scaled thermistor 1 table) + * 331 : (3.3V scaled thermistor 1 table for MEGA) + * 332 : (3.3V scaled thermistor 1 table for DUE) * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) * 202 : 200k thermistor - Copymaster 3D * 3 : Mendel-parts thermistor (4.7k pullup) @@ -384,7 +380,8 @@ * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" * 15 : 100k thermistor calibration for JGAurora A5 hotend * 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 - * 20 : Pt100 with circuit in the Ultimainboard V2.x + * 20 : Pt100 with circuit in the Ultimainboard V2.x with 5v excitation (AVR) + * 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v excitation (STM32 \ LPC176x....) * 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 * 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup @@ -411,16 +408,16 @@ * 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. */ -//@ need to check what thermistor it actually uses #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_3 0 #define TEMP_SENSOR_4 0 #define TEMP_SENSOR_5 0 -//@ +#define TEMP_SENSOR_6 0 +#define TEMP_SENSOR_7 0 #define TEMP_SENSOR_BED 1 -// #define TEMP_SENSOR_CHAMBER 1 +#define TEMP_SENSOR_PROBE 0 #define TEMP_SENSOR_CHAMBER 0 // Dummy thermistor constant temperature readings, for use with 998 and 999 @@ -448,6 +445,8 @@ #define HEATER_3_MINTEMP 5 #define HEATER_4_MINTEMP 5 #define HEATER_5_MINTEMP 5 +#define HEATER_6_MINTEMP 5 +#define HEATER_7_MINTEMP 5 #define BED_MINTEMP 5 // Above this temperature the heater will be switched off. @@ -459,8 +458,9 @@ #define HEATER_3_MAXTEMP 275 #define HEATER_4_MAXTEMP 275 #define HEATER_5_MAXTEMP 275 -//@ -#define BED_MAXTEMP 125 +#define HEATER_6_MAXTEMP 275 +#define HEATER_7_MAXTEMP 275 +#define BED_MAXTEMP 150 //=========================================================================== //============================= PID Settings ================================ @@ -486,9 +486,9 @@ // 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 @@ -500,11 +500,6 @@ //#define DEFAULT_Ki 2.25 //#define DEFAULT_Kd 440 - //@ SapphirePro 50W MonsterHeater (full metal heatbreak, no sock no fans @200° C) - #define DEFAULT_Kp 15.36 - #define DEFAULT_Ki 1.13 - #define DEFAULT_Kd 52.03 - #endif // PIDTEMP //=========================================================================== @@ -542,9 +537,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 @@ -552,11 +547,6 @@ //#define DEFAULT_bedKi 1.41 //#define DEFAULT_bedKd 1675.16 - // SapphirePro 24V Heater C5 S50 - #define DEFAULT_bedKp 45.99 - #define DEFAULT_bedKi 8.69 - #define DEFAULT_bedKd 60.84 - // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. #endif // PIDTEMPBED @@ -577,7 +567,7 @@ * Note: For Bowden Extruders make this large enough to allow load/unload. */ #define PREVENT_LENGTHY_EXTRUDE -#define EXTRUDE_MAXLENGTH 710 //@ maybe needed for filament loading +#define EXTRUDE_MAXLENGTH 710 //=========================================================================== //======================== Thermal Runaway Protection ======================= @@ -608,7 +598,7 @@ // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // either in the usual order or reversed -//#define COREXY //@ +//#define COREXY //#define COREXZ //#define COREYZ //#define COREYX @@ -624,7 +614,6 @@ // 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. -//@ Sapphire Pro uses Y-MAX, if you want 0,0 to be front left #define USE_XMIN_PLUG #define USE_YMIN_PLUG #define USE_ZMIN_PLUG @@ -659,7 +648,6 @@ #endif // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). -//@ microswitches #define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING true// Set to true to invert the logic of the endstop. #define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. @@ -676,14 +664,14 @@ * * A4988 is assumed for unspecified drivers. * - * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01, + * TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE, * TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, * TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] */ -//@ Sapphire Pro setup #define X_DRIVER_TYPE A4988 #define Y_DRIVER_TYPE A4988 #define Z_DRIVER_TYPE A4988 @@ -691,12 +679,15 @@ //#define Y2_DRIVER_TYPE A4988 //#define Z2_DRIVER_TYPE A4988 //#define Z3_DRIVER_TYPE A4988 +//#define Z4_DRIVER_TYPE A4988 #define E0_DRIVER_TYPE A4988 //#define E1_DRIVER_TYPE A4988 //#define E2_DRIVER_TYPE A4988 //#define E3_DRIVER_TYPE A4988 //#define E4_DRIVER_TYPE A4988 //#define E5_DRIVER_TYPE A4988 +//#define E6_DRIVER_TYPE A4988 +//#define E7_DRIVER_TYPE A4988 // Enable this feature if all enabled endstop pins are interrupt-capable. // This will remove the need to poll the interrupt pins, saving many CPU cycles. @@ -739,17 +730,15 @@ /** * Default Axis Steps Per Unit (steps/mm) * Override with M92 - * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + * X, Y, Z, E0 [, E1[, E2...]] */ -//@ settings from 1.0.3 stock firmware #define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 400 } /** * Default Max Feed Rate (mm/s) * Override with M203 - * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + * X, Y, Z, E0 [, E1[, E2...]] */ -//@ keep speed reasonable #define DEFAULT_MAX_FEEDRATE { 200, 200, 4, 70 } //#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2 @@ -761,9 +750,8 @@ * Default Max Acceleration (change/s) change = mm/s * (Maximum start speed for accelerated moves) * Override with M201 - * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + * X, Y, Z, E0 [, E1[, E2...]] */ -//@ keep speed reasonable #define DEFAULT_MAX_ACCELERATION { 1000, 1000, 100, 1000 } //#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2 @@ -779,7 +767,6 @@ * M204 R Retract Acceleration * M204 T Travel Acceleration */ -//@ keep speed reasonable #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 @@ -789,7 +776,7 @@ * Override with M205 X Y Z E * * "Jerk" specifies the minimum speed change that requires acceleration. - * When changing speed and , if the difference is less than the + * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ //#define CLASSIC_JERK @@ -798,6 +785,8 @@ #define DEFAULT_YJERK 10.0 #define DEFAULT_ZJERK 0.5 + //#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves + //#define LIMITED_JERK_EDITING // Limit edit via M205 or LCD to DEFAULT_aJERK * 2 #if ENABLED(LIMITED_JERK_EDITING) #define MAX_JERK_EDIT_VALUES { 20, 20, 0.6, 10 } // ...or, set your own edit limits @@ -825,7 +814,6 @@ * * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained */ -//@ #define S_CURVE_ACCELERATION //=========================================================================== @@ -874,9 +862,8 @@ * Use G29 repeatedly, adjusting the Z height at each point with movement commands * or (with LCD_BED_LEVELING) the LCD controller. */ -//@ #define PROBE_MANUALLY -//#define MANUAL_PROBE_START_Z 0 +//#define MANUAL_PROBE_START_Z 0.2 /** * A Fix-Mounted Probe either doesn't deploy or needs manual deployment. @@ -884,6 +871,12 @@ */ //#define FIX_MOUNTED_PROBE +/** + * Use the nozzle as the probe, as with a conductive + * nozzle system or a piezo-electric smart effector. + */ +//#define NOZZLE_AS_PROBE + /** * Z Servo Probe, such as an endstop switch on a rotating arm. */ @@ -967,11 +960,11 @@ */ #define NOZZLE_TO_PROBE_OFFSET { 14, -40, 0 } -// Certain types of probes need to stay away from edges +// Most probes should stay away from the edges of the bed, but +// with NOZZLE_AS_PROBE this can be negative for a wider probing area. #define MIN_PROBE_EDGE 5 // X and Y axis travel speed (mm/m) between probes -//@ #define XY_PROBE_SPEED 1000 // Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) @@ -1006,10 +999,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 5 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow #define Z_CLEARANCE_BETWEEN_PROBES 3 // Z Clearance between probe points #define Z_CLEARANCE_MULTI_PROBE 1 // Z Clearance between multiple probes -#define Z_AFTER_PROBING 5 // Z position after probing is done +#define Z_AFTER_PROBING 5 // Z position after probing is done #define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping @@ -1065,7 +1058,6 @@ // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -//@ TMC2208 behavior #define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR true @@ -1079,30 +1071,28 @@ #define INVERT_E3_DIR false #define INVERT_E4_DIR false #define INVERT_E5_DIR false +#define INVERT_E6_DIR false +#define INVERT_E7_DIR false // @section homing -//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//@ -//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. +#define Z_HOMING_HEIGHT 2 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure to have this much clearance over your Z_MAX_POS to prevent grinding. -#define Z_HOMING_HEIGHT 2 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... - // Be sure you have this distance over your Z_MAX_POS in case. +//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing Z // Direction of endstops when homing; 1=MAX, -1=MIN // :[-1,1] #define X_HOME_DIR -1 -//@ home to Y-max #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 // @section machine -//@ -//@ my measurements -//@ - // The size of the print bed #define X_BED_SIZE 255 #define Y_BED_SIZE 210 @@ -1112,7 +1102,7 @@ #define Y_MIN_POS 0 #define Z_MIN_POS 0 #define X_MAX_POS X_BED_SIZE -#define Y_MAX_POS 210 +#define Y_MAX_POS Y_BED_SIZE #define Z_MAX_POS 210 /** @@ -1152,7 +1142,7 @@ * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. * By default the firmware assumes HIGH=FILAMENT PRESENT. */ -//#define FILAMENT_RUNOUT_SENSOR +#define FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR) #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. #define FIL_RUNOUT_INVERTING true // Set to true to invert the logic of the sensor. @@ -1224,7 +1214,6 @@ * Normally G28 leaves leveling disabled on completion. Enable * this option to have G28 restore the prior leveling state. */ -//@ #define RESTORE_LEVELING_AFTER_G28 /** @@ -1256,6 +1245,7 @@ #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 G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. + #define G26_RETRACT_MULTIPLIER 1.0 // G26 Q (retraction) used by default between mesh test elements. #endif #endif @@ -1323,8 +1313,7 @@ * 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. @@ -1333,7 +1322,6 @@ #endif // Add a menu item to move between bed corners for manual bed adjustment -//@ #define LEVEL_BED_CORNERS #if ENABLED(LEVEL_BED_CORNERS) @@ -1378,7 +1366,6 @@ #endif // Homing speeds (mm/m) -//@ #define HOMING_FEEDRATE_XY (50*50) #define HOMING_FEEDRATE_Z (50*50) @@ -1462,6 +1449,10 @@ #define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load #if ENABLED(EEPROM_SETTINGS) + #define SDCARD_EEPROM_EMULATION + #undef USE_REAL_EEPROM + #undef FLASH_EEPROM_EMULATION + #undef SRAM_EEPROM_EMULATION #define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors. #endif @@ -1475,11 +1466,6 @@ #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 -// -//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage - // // G20/G21 Inch mode support // @@ -1493,19 +1479,16 @@ // @section temperature // Preheat Constants -//@ #define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 -//@ #define PREHEAT_2_LABEL "PETG" #define PREHEAT_2_TEMP_HOTEND 235 #define PREHEAT_2_TEMP_BED 70 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 - /** * Nozzle Park * @@ -1517,7 +1500,6 @@ * P1 Raise the nozzle always to Z-park height. * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. */ -//@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) @@ -1574,9 +1556,10 @@ // Default number of triangles #define NOZZLE_CLEAN_TRIANGLES 3 - // Specify positions as { X, Y, Z } - #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1) } - #define NOZZLE_CLEAN_END_POINT { 100, 60, (Z_MIN_POS + 1) } + // Specify positions for each tool as { { X, Y, Z }, { X, Y, Z } } + // Dual hotend system may use { { -20, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }, { 420, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }} + #define NOZZLE_CLEAN_START_POINT { { 30, 30, (Z_MIN_POS + 1) } } + #define NOZZLE_CLEAN_END_POINT { { 100, 60, (Z_MIN_POS + 1) } } // Circular pattern radius #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 @@ -1679,9 +1662,7 @@ * you must uncomment the following option or it won't work. * */ -//@ #define SDSUPPORT -#define SDIO_SUPPORT /** * SD CARD: SPI SPEED @@ -1698,7 +1679,6 @@ * * Use CRC checks and retries on the SD communication. */ -//@ #define SD_CHECK_AND_RETRY /** @@ -1762,7 +1742,6 @@ // // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. // -//@ #define INDIVIDUAL_AXIS_HOMING_MENU // @@ -1834,7 +1813,7 @@ // // Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller -// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// https://www.aliexpress.com/item/32765887917.html // //#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 @@ -2001,20 +1980,26 @@ // FYSETC variant of the MINI12864 graphic controller with SD support // https://wiki.fysetc.com/Mini12864_Panel/ // -//#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default -//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on) -//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight -//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight +//#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default +//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on) +//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight +//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight +//#define FYSETC_GENERIC_12864_1_1 // Larger display with basic ON/OFF backlight. // // Factory display for Creality CR-10 -// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// https://www.aliexpress.com/item/32833148327.html // // This is RAMPS-compatible using a single 10-pin connector. // (For CR-10 owners who want to replace the Melzi Creality board but retain the display) // //#define CR10_STOCKDISPLAY +// +// Ender-2 OEM display, a variant of the MKS_MINI_12864 +// +//#define ENDER2_STOCKDISPLAY + // // ANET and Tronxy Graphical Controller // @@ -2026,7 +2011,7 @@ // // AZSMZ 12864 LCD with SD -// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// https://www.aliexpress.com/item/32837222770.html // //#define AZSMZ_12864 @@ -2083,9 +2068,11 @@ //============================================================================= // -// DGUS Touch Display with DWIN OS +// DGUS Touch Display with DWIN OS. (Choose one.) // -//#define DGUS_LCD +//#define DGUS_LCD_UI_ORIGIN +//#define DGUS_LCD_UI_FYSETC +//#define DGUS_LCD_UI_HIPRECY // // Touch-screen LCD for Malyan M200 printers @@ -2093,10 +2080,10 @@ //#define MALYAN_LCD // -// LulzBot Color Touch UI for FTDI EVE (FT800/FT810) displays +// Touch UI for FTDI EVE (FT800/FT810) displays // See Configuration_adv.h for all configuration options. // -//#define LULZBOT_TOUCH_UI +//#define TOUCH_UI_FTDI_EVE // // Third-party or vendor-customized controller interfaces. @@ -2111,16 +2098,10 @@ // // FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.) // - -//@ -//#define FSMC_GRAPHICAL_TFT +#define FSMC_GRAPHICAL_TFT #if ENABLED(FSMC_GRAPHICAL_TFT) - // - // FSMC_UPSCALE 2 2x upscaler for 320x240 displays (default) - // FSMC_UPSCALE 3 3x upscaler for 480x320 displays - // - #define FSMC_UPSCALE 3 - +// #define FSMC_UPSCALE 2 //2x upscaler for 320x240 displays (default) + #define FSMC_UPSCALE 3 //3x upscaler for 480x320 displays #endif //============================================================================= @@ -2130,22 +2111,15 @@ // // ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8 // -//@ testing -//#define TOUCH_BUTTONS +#define TOUCH_BUTTONS #if ENABLED(TOUCH_BUTTONS) #define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens #define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus - //@ different calib for 3.5"TFT #define XPT2046_X_CALIBRATION 12013 #define XPT2046_X_OFFSET -32 #define XPT2046_Y_CALIBRATION -8711 #define XPT2046_Y_OFFSET 256 - - //#define XPT2046_X_CALIBRATION 12316 - //#define XPT2046_Y_CALIBRATION -8981 - //#define XPT2046_X_OFFSET -43 - //#define XPT2046_Y_OFFSET 257 #endif // diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a8e1d5ab24..2a8324dd03 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -177,28 +177,28 @@ * Thermal Protection parameters for the bed are just as above for hotends. */ #if ENABLED(THERMAL_PROTECTION_BED) - #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds - #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius /** * As described above, except for the bed (M140/M190/M303). */ - #define WATCH_BED_TEMP_PERIOD 60 // Seconds - #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius + #define WATCH_BED_TEMP_PERIOD 60 // Seconds + #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif /** * Thermal Protection parameters for the heated chamber. */ #if ENABLED(THERMAL_PROTECTION_CHAMBER) - #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius /** * Heated chamber watch settings (M141/M191). */ - #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds - #define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius #endif #if ENABLED(PIDTEMP) @@ -353,7 +353,7 @@ //#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings #if ENABLED(CONTROLLER_FAN_EDITABLE) #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu - #endif +#endif #endif // When first starting the main fan, run it at full speed for the @@ -361,6 +361,9 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// Some coolers may require a non-zero "off" state. +//#define FAN_OFF_PWM 1 + /** * PWM Fan Scaling * @@ -386,7 +389,7 @@ * FAST_PWM_FAN_FREQUENCY [undefined by default] * Set this to your desired frequency. * If left undefined this defaults to F = F_CPU/(2*255*1) - * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers. * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior. * @@ -417,9 +420,7 @@ * Multiple extruders can be assigned to the same pin in which case * the fan will turn on when any selected extruder is above the threshold. */ -#define E0_AUTO_FAN_PIN PB0 // hotend fan on heater2 -//#define E0_AUTO_FAN_PIN -1 // hotend fan on heater2 - +#define E0_AUTO_FAN_PIN HEATER_1_PIN #define E1_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 @@ -427,7 +428,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 -#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 // hotend fan will start at 50° C +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed #define CHAMBER_AUTO_FAN_TEMPERATURE 30 #define CHAMBER_AUTO_FAN_SPEED 255 @@ -446,13 +447,13 @@ /** * M355 Case Light on-off / brightness */ -//#define CASE_LIGHT_ENABLE +#define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) - //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define CASE_LIGHT_PIN LED_CASE_PIN // Override the default pin if needed #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on - #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) - //#define CASE_LIGHT_MAX_PWM 128 // Limit pwm + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin) + #define CASE_LIGHT_MAX_PWM 255 // Limit pwm //#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu //#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting. //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. @@ -499,7 +500,7 @@ //#define X_DUAL_ENDSTOPS #if ENABLED(X_DUAL_ENDSTOPS) #define X2_USE_ENDSTOP _XMAX_ - #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #define X2_ENDSTOP_ADJUSTMENT 0 #endif #endif @@ -509,27 +510,28 @@ //#define Y_DUAL_ENDSTOPS #if ENABLED(Y_DUAL_ENDSTOPS) #define Y2_USE_ENDSTOP _YMAX_ - #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #define Y2_ENDSTOP_ADJUSTMENT 0 #endif #endif -//#define Z_DUAL_STEPPER_DRIVERS -#if ENABLED(Z_DUAL_STEPPER_DRIVERS) - //#define Z_DUAL_ENDSTOPS - #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 +// +// For Z set the number of stepper drivers +// +#define NUM_Z_STEPPER_DRIVERS 1 // (1-4) Z options change based on how many + +#if NUM_Z_STEPPER_DRIVERS > 1 + //#define Z_MULTI_ENDSTOPS + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z2_ENDSTOP_ADJUSTMENT 0 + #if NUM_Z_STEPPER_DRIVERS >= 3 + #define Z3_USE_ENDSTOP _YMAX_ + #define Z3_ENDSTOP_ADJUSTMENT 0 #endif + #if NUM_Z_STEPPER_DRIVERS >= 4 + #define Z4_USE_ENDSTOP _ZMAX_ + #define Z4_ENDSTOP_ADJUSTMENT 0 #endif - -//#define Z_TRIPLE_STEPPER_DRIVERS -#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - //#define Z_TRIPLE_ENDSTOPS - #if ENABLED(Z_TRIPLE_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z3_USE_ENDSTOP _YMAX_ - #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 - #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 #endif #endif @@ -593,7 +595,6 @@ #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 QUICK_HOME // If homing includes X and Y, do a diagonal move initially #define HOMING_BACKOFF_MM { 0, 0, 20 } // (mm) Move away from the endstops after homing @@ -676,11 +677,37 @@ */ //#define Z_STEPPER_AUTO_ALIGN #if ENABLED(Z_STEPPER_AUTO_ALIGN) - // Define probe X and Y positions for Z1, Z2 [, Z3] - #define Z_STEPPER_ALIGN_XY { { 10, 290 }, { 150, 10 }, { 290, 290 } } + // Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]] + // If not defined, probe limits will be used. + // Override with 'M422 S X Y' + //#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } } + + /** + * Orientation for the automatically-calculated probe positions. + * Override Z stepper align points with 'M422 S X Y' + * + * 2 Steppers: (0) (1) + * | | 2 | + * | 1 2 | | + * | | 1 | + * + * 3 Steppers: (0) (1) (2) (3) + * | 3 | 1 | 2 1 | 2 | + * | | 3 | | 3 | + * | 1 2 | 2 | 3 | 1 | + * + * 4 Steppers: (0) (1) (2) (3) + * | 4 3 | 1 4 | 2 1 | 3 2 | + * | | | | | + * | 1 2 | 2 3 | 3 4 | 4 1 | + * + */ + #ifndef Z_STEPPER_ALIGN_XY + //#define Z_STEPPERS_ORIENTATION 0 + #endif // Provide Z stepper positions for more rapid convergence in bed alignment. - // Currently requires triple stepper drivers. + // Requires triple stepper drivers (i.e., set NUM_Z_STEPPER_DRIVERS to 3) //#define Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) // Define Stepper XY positions for Z1, Z2, Z3 corresponding to @@ -688,18 +715,11 @@ // Define one position per Z stepper in stepper driver order. #define Z_STEPPER_ALIGN_STEPPER_XY { { 210.7, 102.5 }, { 152.6, 220.0 }, { 94.5, 102.5 } } #else - // Amplification factor. Used to scale the correction step up or down. - // In case the stepper (spindle) position is further out than the test point. - // Use a value > 1. NOTE: This may cause instability - #define Z_STEPPER_ALIGN_AMP 1.0 + // Amplification factor. Used to scale the correction step up or down in case + // the stepper (spindle) position is farther out than the test point. + #define Z_STEPPER_ALIGN_AMP 1.0 // Use a value > 1.0 NOTE: This may cause instability! #endif - // Set number of iterations to align - #define Z_STEPPER_ALIGN_ITERATIONS 3 - - // Enable to restore leveling setup after operation - #define RESTORE_LEVELING_AFTER_G34 - // On a 300mm bed a 5% grade would give a misalignment of ~1.5cm #define G34_MAX_GRADE 5 // (%) Maximum incline that G34 will handle #define Z_STEPPER_ALIGN_ITERATIONS 5 // Number of iterations to apply during alignment @@ -735,7 +755,6 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 -//@ #define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated // Minimum time that a segment needs to take if the buffer is emptied @@ -835,10 +854,10 @@ // probing on a screwhead or hollow washer, probe near the edges. //#define CALIBRATION_MEASURE_AT_TOP_EDGES - // Define pin which is read during calibration + // Define the pin to read during calibration #ifndef CALIBRATION_PIN - #define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop - #define CALIBRATION_PIN_INVERTING false // Set to true to invert the pin + #define CALIBRATION_PIN -1 // Define here to override the default pin + #define CALIBRATION_PIN_INVERTING false // Set to true to invert the custom pin //#define CALIBRATION_PIN_PULLDOWN #define CALIBRATION_PIN_PULLUP #endif @@ -928,7 +947,6 @@ #endif #endif -//@ was set too fast // Change values more rapidly when the encoder is rotated faster #define ENCODER_RATE_MULTIPLIER #if ENABLED(ENCODER_RATE_MULTIPLIER) @@ -946,7 +964,6 @@ #if HAS_LCD_MENU // Include a page of printer information in the LCD Main Menu - //@ #define LCD_INFO_MENU #if ENABLED(LCD_INFO_MENU) //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages @@ -996,7 +1013,10 @@ #if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits //#define SHOW_REMAINING_TIME // Display estimated time to completion - //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time + #if ENABLED(SHOW_REMAINING_TIME) + //#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation + //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time +#endif #endif #if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) @@ -1014,7 +1034,7 @@ // The standard SD detect circuit reads LOW when media is inserted and HIGH when empty. // Enable this option and set to HIGH if your SD cards are incorrectly detected. - //#define SD_DETECT_STATE HIGH + #define SD_DETECT_STATE HIGH #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. @@ -1171,9 +1191,8 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define BINARY_FILE_TRANSFER + #define BINARY_FILE_TRANSFER - #if HAS_SDCARD_CONNECTION /** * Set this option to one of the following (or the board's defaults apply): * @@ -1184,7 +1203,6 @@ * :[ 'LCD', 'ONBOARD', 'CUSTOM_CABLE' ] */ //#define SDCARD_CONNECTION LCD - #endif #endif // SDSUPPORT @@ -1261,13 +1279,12 @@ #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating #define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating + //#define STATUS_CUTTER_ANIM // Use a second bitmap to indicate spindle / laser active //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames - //@ #define STATUS_HEAT_PERCENT // Show heating in a progress bar //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) - //@ testing //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~‭3260 (or ~940) bytes of PROGMEM. // Frivolous Game Options @@ -1318,7 +1335,7 @@ // // Touch UI for the FTDI Embedded Video Engine (EVE) // -#if ENABLED(LULZBOT_TOUCH_UI) +#if ENABLED(TOUCH_UI_FTDI_EVE) // Display board used //#define LCD_FTDI_VM800B35A // FTDI 3.5" with FT800 (320x240) //#define LCD_4DSYSTEMS_4DLCD_FT843 // 4D Systems 4.3" (480x272) @@ -1335,9 +1352,11 @@ //#define AO_EXP1_PINMAP // AlephObjects CLCD UI EXP1 mapping //#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping //#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping + //#define S6_TFT_PINMAP // FYSETC S6 pin mapping + //#define OTHER_PIN_LAYOUT // Define pins manually below #if ENABLED(OTHER_PIN_LAYOUT) - // The pins for CS and MOD_RESET (PD) must be chosen. + // Pins for CS and MOD_RESET (PD) must be chosen #define CLCD_MOD_RESET 9 #define CLCD_SPI_CS 10 @@ -1396,6 +1415,9 @@ // Output extra debug info for Touch UI events //#define TOUCH_UI_DEBUG + + // Developer menu (accessed by touching "About Printer" copyright text) + //#define TOUCH_UI_DEVELOPER_MENU #endif // @@ -1410,6 +1432,13 @@ #define TFT_BTOKMENU_COLOR COLOR_GREEN // 00010 100010 11111 Cyan #endif +// +// ADC Button Debounce +// +#if HAS_ADC_BUTTONS + #define ADC_BUTTON_DEBOUNCE_DELAY 16 // (ms) Increase if buttons bounce or repeat too fast +#endif + // @section safety /** @@ -1435,28 +1464,26 @@ * * Warning: Does not respect endstops! */ -//@ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) + //#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR //#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_Z 10 // Babysteps are very small. Increase for faster motion. #define BABYSTEP_MULTIPLICATOR_XY 10 + #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 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. #endif #endif - //@ #define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping @@ -1486,11 +1513,6 @@ */ #define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) - - //@ ~0.8 on my printer for PLA - // K = 0 - but will be activated via gcode filament-type-specific - // extruder seems to rattle quite hard, need to check acc/jerk settings - //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants #define LIN_ADVANCE_K 0 // Unit: mm compression per 1mm/s extruder speed //#define LA_DEBUG // If enabled, this will generate debug information output over USB. @@ -1515,7 +1537,8 @@ * Override MIN_PROBE_EDGE for each side of the build plate * Useful to get probe points to exact positions on targets or * to allow leveling to avoid plate clamps on only specific - * sides of the bed. + * sides of the bed. With NOZZLE_AS_PROBE negative values are + * allowed, to permit probing outside the bed. * * If you are replacing the prior *_PROBE_BED_POSITION options, * LEFT and FRONT values in most cases will map directly over @@ -1594,16 +1617,23 @@ // @section extras +// +// G60/G61 Position Save and Return +// +//#define SAVED_POSITIONS 1 // Each saved position slot costs 12 bytes + // // G2/G3 Arc Support // -#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes #if ENABLED(ARC_SUPPORT) - #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment - #define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle - #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections - //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles - //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes + #define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment + //#define ARC_SEGMENTS_PER_R 1 // Max segment length, MM_PER = Min + #define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + //#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum) + #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes #endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. @@ -1657,12 +1687,12 @@ /** * Maximum stepping rate (in Hz) the stepper driver allows * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) - * 500000 : Maximum for A4988 stepper driver - * 400000 : Maximum for TMC2xxx stepper drivers - * 250000 : Maximum for DRV8825 stepper driver - * 200000 : Maximum for LV8729 stepper driver - * 150000 : Maximum for TB6600 stepper driver - * 15000 : Maximum for TB6560 stepper driver + * 5000000 : Maximum for TMC2xxx stepper drivers + * 1000000 : Maximum for LV8729 stepper driver + * 500000 : Maximum for A4988 stepper driver + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 15000 : Maximum for TB6560 stepper driver * * Override the default value based on the driver type set in Configuration.h. */ @@ -1700,14 +1730,12 @@ // For debug-echo: 128 bytes for the optimal speed. // Other output doesn't need to be that speedy. // :[0, 2, 4, 8, 16, 32, 64, 128, 256] -// @fixing octoprint connection issues - probably overkill #define TX_BUFFER_SIZE 32 // Host Receive Buffer Size // Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. // To use flow control, set this buffer size to at least 1024 bytes. // :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] -// @fixing octoprint connection issues - probably overkill #define RX_BUFFER_SIZE 1024 #if RX_BUFFER_SIZE >= 1024 @@ -1802,6 +1830,9 @@ // Z raise distance for tool-change, as needed for some extruders #define TOOLCHANGE_ZRAISE 2 // (mm) //#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change + #if ENABLED(TOOLCHANGE_NO_RETURN) + //#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // G-code to run after tool-change is complete + #endif // Retract and prime filament on tool-change //#define TOOLCHANGE_FILAMENT_SWAP @@ -1833,15 +1864,13 @@ * Requires NOZZLE_PARK_FEATURE. * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. */ -//@ 1st measurements - check retraction settings -//#define ADVANCED_PAUSE_FEATURE +#define ADVANCED_PAUSE_FEATURE #if ENABLED(ADVANCED_PAUSE_FEATURE) #define PAUSE_PARK_RETRACT_FEEDRATE 35 // (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_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - //#define FILAMENT_CHANGE_UNLOAD_LENGTH 650 #define FILAMENT_CHANGE_UNLOAD_LENGTH 710 // (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. @@ -1851,7 +1880,6 @@ // 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_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - //#define FILAMENT_CHANGE_FAST_LOAD_LENGTH 615 #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 710 // (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. @@ -1865,9 +1893,10 @@ #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 10 // (mm) Unload initial retract length. - #define FILAMENT_UNLOAD_DELAY 750 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_RETRACT 10 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_PURGE_DELAY 750 // (ms) Delay for the filament to cool after retract. #define FILAMENT_UNLOAD_PURGE_LENGTH 3 // (mm) An unretract is done, then this length is purged. + #define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. @@ -1876,7 +1905,6 @@ #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 - // makes more sense #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 @@ -1933,6 +1961,12 @@ #define Z3_MICROSTEPS 16 #endif + #if AXIS_DRIVER_TYPE_Z4(TMC26X) + #define Z4_MAX_CURRENT 1000 + #define Z4_SENSE_RESISTOR 91 + #define Z4_MICROSTEPS 16 + #endif + #if AXIS_DRIVER_TYPE_E0(TMC26X) #define E0_MAX_CURRENT 1000 #define E0_SENSE_RESISTOR 91 @@ -1969,6 +2003,18 @@ #define E5_MICROSTEPS 16 #endif + #if AXIS_DRIVER_TYPE_E6(TMC26X) + #define E6_MAX_CURRENT 1000 + #define E6_SENSE_RESISTOR 91 + #define E6_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E7(TMC26X) + #define E7_MAX_CURRENT 1000 + #define E7_SENSE_RESISTOR 91 + #define E7_MICROSTEPS 16 + #endif + #endif // TMC26X // @section tmc_smart @@ -1995,94 +2041,123 @@ #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 #if AXIS_IS_TMC(X) - #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. - #define X_MICROSTEPS 16 // 0..256 - #define X_RSENSE 0.11 - #define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ... + #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. + #define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing + #define X_MICROSTEPS 16 // 0..256 + #define X_RSENSE 0.11 + #define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ... #endif #if AXIS_IS_TMC(X2) - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 - #define X2_RSENSE 0.11 - #define X2_CHAIN_POS -1 + #define X2_CURRENT 800 + #define X2_CURRENT_HOME X2_CURRENT + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #define X2_CHAIN_POS -1 #endif #if AXIS_IS_TMC(Y) - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 - #define Y_RSENSE 0.11 - #define Y_CHAIN_POS -1 + #define Y_CURRENT 800 + #define Y_CURRENT_HOME Y_CURRENT + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #define Y_CHAIN_POS -1 #endif #if AXIS_IS_TMC(Y2) - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 - #define Y2_RSENSE 0.11 - #define Y2_CHAIN_POS -1 + #define Y2_CURRENT 800 + #define Y2_CURRENT_HOME Y2_CURRENT + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #define Y2_CHAIN_POS -1 #endif #if AXIS_IS_TMC(Z) - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 - #define Z_RSENSE 0.11 - #define Z_CHAIN_POS -1 + #define Z_CURRENT 800 + #define Z_CURRENT_HOME Z_CURRENT + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #define Z_CHAIN_POS -1 #endif #if AXIS_IS_TMC(Z2) - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 - #define Z2_RSENSE 0.11 - #define Z2_CHAIN_POS -1 + #define Z2_CURRENT 800 + #define Z2_CURRENT_HOME Z2_CURRENT + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #define Z2_CHAIN_POS -1 #endif #if AXIS_IS_TMC(Z3) - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 - #define Z3_RSENSE 0.11 - #define Z3_CHAIN_POS -1 + #define Z3_CURRENT 800 + #define Z3_CURRENT_HOME Z3_CURRENT + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #define Z3_CHAIN_POS -1 + #endif + + #if AXIS_IS_TMC(Z4) + #define Z4_CURRENT 800 + #define Z4_CURRENT_HOME Z4_CURRENT + #define Z4_MICROSTEPS 16 + #define Z4_RSENSE 0.11 + #define Z4_CHAIN_POS -1 #endif #if AXIS_IS_TMC(E0) - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 - #define E0_RSENSE 0.11 - #define E0_CHAIN_POS -1 + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #define E0_CHAIN_POS -1 #endif #if AXIS_IS_TMC(E1) - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 - #define E1_RSENSE 0.11 - #define E1_CHAIN_POS -1 + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #define E1_CHAIN_POS -1 #endif #if AXIS_IS_TMC(E2) - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 - #define E2_RSENSE 0.11 - #define E2_CHAIN_POS -1 + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #define E2_CHAIN_POS -1 #endif #if AXIS_IS_TMC(E3) - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 - #define E3_RSENSE 0.11 - #define E3_CHAIN_POS -1 + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #define E3_CHAIN_POS -1 #endif #if AXIS_IS_TMC(E4) - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 - #define E4_RSENSE 0.11 - #define E4_CHAIN_POS -1 + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #define E4_CHAIN_POS -1 #endif #if AXIS_IS_TMC(E5) - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 - #define E5_RSENSE 0.11 - #define E5_CHAIN_POS -1 + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #define E5_CHAIN_POS -1 + #endif + + #if AXIS_IS_TMC(E6) + #define E6_CURRENT 800 + #define E6_MICROSTEPS 16 + #define E6_RSENSE 0.11 + #define E6_CHAIN_POS -1 + #endif + + #if AXIS_IS_TMC(E7) + #define E7_CURRENT 800 + #define E7_MICROSTEPS 16 + #define E7_RSENSE 0.11 + #define E7_CHAIN_POS -1 #endif /** @@ -2102,6 +2177,8 @@ //#define E3_CS_PIN -1 //#define E4_CS_PIN -1 //#define E5_CS_PIN -1 + //#define E6_CS_PIN -1 + //#define E7_CS_PIN -1 /** * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). @@ -2132,12 +2209,15 @@ #define Y2_SLAVE_ADDRESS 0 #define Z2_SLAVE_ADDRESS 0 #define Z3_SLAVE_ADDRESS 0 + #define Z4_SLAVE_ADDRESS 0 #define E0_SLAVE_ADDRESS 0 #define E1_SLAVE_ADDRESS 0 #define E2_SLAVE_ADDRESS 0 #define E3_SLAVE_ADDRESS 0 #define E4_SLAVE_ADDRESS 0 #define E5_SLAVE_ADDRESS 0 + #define E6_SLAVE_ADDRESS 0 + #define E7_SLAVE_ADDRESS 0 /** * Software enable @@ -2207,12 +2287,15 @@ #define Z_HYBRID_THRESHOLD 3 #define Z2_HYBRID_THRESHOLD 3 #define Z3_HYBRID_THRESHOLD 3 + #define Z4_HYBRID_THRESHOLD 3 #define E0_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30 #define E3_HYBRID_THRESHOLD 30 #define E4_HYBRID_THRESHOLD 30 #define E5_HYBRID_THRESHOLD 30 + #define E6_HYBRID_THRESHOLD 30 + #define E7_HYBRID_THRESHOLD 30 /** * Use StallGuard2 to home / probe X, Y, Z. @@ -2236,8 +2319,6 @@ * * IMPROVE_HOMING_RELIABILITY tunes acceleration and jerk when * homing and adds a guard period for endstop triggering. - * - * TMC2209 requires STEALTHCHOP enabled for SENSORLESS_HOMING */ //#define SENSORLESS_HOMING // StallGuard capable drivers only @@ -2270,20 +2351,20 @@ * * Example: * #define TMC_ADV() { \ - * stepperX.diag0_temp_prewarn(1); \ - * stepperY.interpolate(0); \ + * stepperX.diag0_otpw(1); \ + * stepperY.intpol(0); \ * } */ #define TMC_ADV() { } #endif // HAS_TRINAMIC_CONFIG -// @section L6470 +// @section L64XX /** - * L6470 Stepper Driver options + * L64XX Stepper Driver options * - * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver. + * Arduino-L6470 library (0.8.0 or higher) is required. * https://github.com/ameyer/Arduino-L6470 * * Requires the following to be defined in your pins_YOUR_BOARD file @@ -2291,114 +2372,160 @@ * L6470_CHAIN_MISO_PIN * L6470_CHAIN_MOSI_PIN * L6470_CHAIN_SS_PIN - * L6470_RESET_CHAIN_PIN (optional) + * ENABLE_RESET_L64XX_CHIPS(Q) where Q is 1 to enable and 0 to reset */ -#if HAS_DRIVER(L6470) - //#define L6470_CHITCHAT // Display additional status info +#if HAS_L64XX - #if AXIS_DRIVER_TYPE_X(L6470) - #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) - #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down) - #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) - #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper - #define X_CHAIN_POS -1 // Position in SPI chain. (<=0 : Not in chain. 1 : Nearest MOSI) - #endif + //#define L6470_CHITCHAT // Display additional status info - #if AXIS_DRIVER_TYPE_X2(L6470) + #if AXIS_IS_L64XX(X) + #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) - L6474 max is 16 + #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current + // L6470 & L6474 - VALID: 375 x (1 - 16) - 6A max - rounds down + // POWERSTEP01: VALID: 1000 x (1 - 32) - 32A max - rounds down + #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) + // L6470 & L6474 - VALID: 31.25 * (1-128) - 4A max - rounds down + // POWERSTEP01: VALID: 200 x (1 - 32) - 6.4A max - rounds down + // L6474 - STALLCURRENT setting is used to set the nominal (TVAL) current + #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper - not used by L6474 + #define X_CHAIN_POS -1 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI + #define X_SLEW_RATE 1 // 0-3, Slew 0 is slowest, 3 is fastest + #endif + + #if AXIS_IS_L64XX(X2) #define X2_MICROSTEPS 128 #define X2_OVERCURRENT 2000 #define X2_STALLCURRENT 1500 #define X2_MAX_VOLTAGE 127 #define X2_CHAIN_POS -1 + #define X2_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_Y(L6470) + #if AXIS_IS_L64XX(Y) #define Y_MICROSTEPS 128 #define Y_OVERCURRENT 2000 #define Y_STALLCURRENT 1500 #define Y_MAX_VOLTAGE 127 #define Y_CHAIN_POS -1 + #define Y_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_Y2(L6470) + #if AXIS_IS_L64XX(Y2) #define Y2_MICROSTEPS 128 #define Y2_OVERCURRENT 2000 #define Y2_STALLCURRENT 1500 #define Y2_MAX_VOLTAGE 127 #define Y2_CHAIN_POS -1 + #define Y2_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_Z(L6470) + #if AXIS_IS_L64XX(Z) #define Z_MICROSTEPS 128 #define Z_OVERCURRENT 2000 #define Z_STALLCURRENT 1500 #define Z_MAX_VOLTAGE 127 #define Z_CHAIN_POS -1 + #define Z_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_Z2(L6470) + #if AXIS_IS_L64XX(Z2) #define Z2_MICROSTEPS 128 #define Z2_OVERCURRENT 2000 #define Z2_STALLCURRENT 1500 #define Z2_MAX_VOLTAGE 127 #define Z2_CHAIN_POS -1 + #define Z2_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_Z3(L6470) + #if AXIS_IS_L64XX(Z3) #define Z3_MICROSTEPS 128 #define Z3_OVERCURRENT 2000 #define Z3_STALLCURRENT 1500 #define Z3_MAX_VOLTAGE 127 #define Z3_CHAIN_POS -1 + #define Z3_SLEW_RATE 1 + #endif + + #if AXIS_IS_L64XX(Z4) + #define Z4_MICROSTEPS 128 + #define Z4_OVERCURRENT 2000 + #define Z4_STALLCURRENT 1500 + #define Z4_MAX_VOLTAGE 127 + #define Z4_CHAIN_POS -1 + #define Z4_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_E0(L6470) + #if AXIS_IS_L64XX(E0) #define E0_MICROSTEPS 128 #define E0_OVERCURRENT 2000 #define E0_STALLCURRENT 1500 #define E0_MAX_VOLTAGE 127 #define E0_CHAIN_POS -1 + #define E0_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_E1(L6470) + #if AXIS_IS_L64XX(E1) #define E1_MICROSTEPS 128 #define E1_OVERCURRENT 2000 #define E1_STALLCURRENT 1500 #define E1_MAX_VOLTAGE 127 #define E1_CHAIN_POS -1 + #define E1_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_E2(L6470) + #if AXIS_IS_L64XX(E2) #define E2_MICROSTEPS 128 #define E2_OVERCURRENT 2000 #define E2_STALLCURRENT 1500 #define E2_MAX_VOLTAGE 127 #define E2_CHAIN_POS -1 + #define E2_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_E3(L6470) + #if AXIS_IS_L64XX(E3) #define E3_MICROSTEPS 128 #define E3_OVERCURRENT 2000 #define E3_STALLCURRENT 1500 #define E3_MAX_VOLTAGE 127 #define E3_CHAIN_POS -1 + #define E3_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_E4(L6470) + #if AXIS_IS_L64XX(E4) #define E4_MICROSTEPS 128 #define E4_OVERCURRENT 2000 #define E4_STALLCURRENT 1500 #define E4_MAX_VOLTAGE 127 #define E4_CHAIN_POS -1 + #define E4_SLEW_RATE 1 #endif - #if AXIS_DRIVER_TYPE_E5(L6470) + #if AXIS_IS_L64XX(E5) #define E5_MICROSTEPS 128 #define E5_OVERCURRENT 2000 #define E5_STALLCURRENT 1500 #define E5_MAX_VOLTAGE 127 #define E5_CHAIN_POS -1 + #define E5_SLEW_RATE 1 + #endif + + #if AXIS_IS_L64XX(E6) + #define E6_MICROSTEPS 128 + #define E6_OVERCURRENT 2000 + #define E6_STALLCURRENT 1500 + #define E6_MAX_VOLTAGE 127 + #define E6_CHAIN_POS -1 + #define E6_SLEW_RATE 1 + #endif + + #if AXIS_IS_L64XX(E7) + #define E7_MICROSTEPS 128 + #define E7_OVERCURRENT 2000 + #define E7_STALLCURRENT 1500 + #define E7_MAX_VOLTAGE 127 + #define E7_CHAIN_POS -1 + #define E7_SLEW_RATE 1 #endif /** @@ -2410,7 +2537,7 @@ * I not present or I0 or I1 - X, Y, Z or E0 * I2 - X2, Y2, Z2 or E1 * I3 - Z3 or E3 - * I4 - E4 + * I4 - Z4 or E4 * I5 - E5 * M916 - Increase drive level until get thermal warning * M917 - Find minimum current thresholds @@ -2424,7 +2551,15 @@ //#define L6470_STOP_ON_ERROR #endif -#endif // L6470 +#endif // HAS_L64XX + +// @section i2cbus + +// +// I2C Master ID for LPC176x LCD and Digital Current control +// Does not apply to other peripherals based on the Wire library. +// +//#define I2C_MASTER_ID 1 // Set a value from 0 to 2 /** * TWI/I2C BUS @@ -2454,10 +2589,10 @@ * echo:i2c-reply: from:99 bytes:5 data:hello */ -// @section i2cbus - //#define EXPERIMENTAL_I2CBUS -#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave +#if ENABLED(EXPERIMENTAL_I2CBUS) + #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave +#endif // @section extras @@ -2486,6 +2621,20 @@ // Duration to hold the switch or keep CHDK_PIN high //#define PHOTO_SWITCH_MS 50 // (ms) (M240 D) + + /** + * PHOTO_PULSES_US may need adjustment depending on board and camera model. + * Pin must be running at 48.4kHz. + * Be sure to use a PHOTOGRAPH_PIN which can rise and fall quick enough. + * (e.g., MKS SBase temp sensor pin was too slow, so used P1.23 on J8.) + * + * Example pulse data for Nikon: https://bit.ly/2FKD0Aq + * IR Wiring: https://git.io/JvJf7 + */ + //#define PHOTO_PULSES_US { 2000, 27850, 400, 1580, 400, 3580, 400 } // (µs) Durations for each 48.4kHz oscillation + #ifdef PHOTO_PULSES_US + #define PHOTO_PULSE_DELAY_US 13 // (µs) Approximate duration of each HIGH and LOW pulse in the oscillation + #endif #endif /** @@ -2649,6 +2798,12 @@ */ #define FASTER_GCODE_PARSER +#if ENABLED(FASTER_GCODE_PARSER) + //#define GCODE_QUOTED_STRINGS // Support for quoted string parameters +#endif + +//#define GCODE_CASE_INSENSITIVE // Accept G-code sent to the firmware in lowercase + /** * CNC G-code options * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. @@ -2688,40 +2843,25 @@ */ //#define CUSTOM_USER_MENUS #if ENABLED(CUSTOM_USER_MENUS) - #define CUSTOM_USER_MENU_TITLE "TFT Color Profiles" - #define USER_SCRIPT_DONE "M117 Color profile changed" + //#define CUSTOM_USER_MENU_TITLE "Custom Commands" + #define USER_SCRIPT_DONE "M117 User Script Done" #define USER_SCRIPT_AUDIBLE_FEEDBACK //#define USER_SCRIPT_RETURN // Return to status screen after a script - #define USER_DESC_1 "Black & White" - #define USER_GCODE_1 "M250 P0" - - // #define USER_DESC_1 "Home & UBL Info" - // #define USER_GCODE_1 "G28\nG29 W" - - #define USER_DESC_2 "Classic Blue" - #define USER_GCODE_2 "M250 P1" + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" - // #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL - // #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Inverted B&W" - #define USER_GCODE_3 "M250 P2" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) - // #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL - // #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" - #define USER_DESC_4 "Olive LED" - #define USER_GCODE_4 "M250 P3" - - // #define USER_DESC_4 "Heat Bed/Home/Level" - // #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" - - #define USER_DESC_5 "Grey Matters" - #define USER_GCODE_5 "M250 P4" - - // #define USER_DESC_5 "Home & Info" - // #define USER_GCODE_5 "G28\nM503" + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" #endif /** @@ -2840,7 +2980,11 @@ #define JOY_Z_PIN 12 // RAMPS: Suggested pin A12 on AUX2 #define JOY_EN_PIN 44 // RAMPS: Suggested pin D44 on AUX2 - // Use M119 to find reasonable values after connecting your hardware: + //#define INVERT_JOY_X // Enable if X direction is reversed + //#define INVERT_JOY_Y // Enable if Y direction is reversed + //#define INVERT_JOY_Z // Enable if Z direction is reversed + + // Use M119 with JOYSTICK_DEBUG to find reasonable values after connecting: #define JOY_X_LIMITS { 5600, 8190-100, 8190+100, 10800 } // min, deadzone start, deadzone end, max #define JOY_Y_LIMITS { 5600, 8250-100, 8250+100, 11000 } #define JOY_Z_LIMITS { 4800, 8080-100, 8080+100, 11550 } @@ -2895,12 +3039,23 @@ /** * WiFi Support (Espressif ESP32 WiFi) */ -//#define WIFISUPPORT -#if ENABLED(WIFISUPPORT) - #define WIFI_SSID "MarlinGhost" - #define WIFI_PWD "marlino" - //#define WEBSUPPORT // Start a webserver with auto-discovery - //#define OTASUPPORT // Support over-the-air firmware updates +//#define WIFISUPPORT // Marlin embedded WiFi managenent +//#define ESP3D_WIFISUPPORT // ESP3D Library WiFi management (https://github.com/luc-github/ESP3DLib) + +#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT) + //#define WEBSUPPORT // Start a webserver (which may include auto-discovery) + //#define OTASUPPORT // Support over-the-air firmware updates + //#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host + + /** + * To set a default WiFi SSID / Password, create a file called Configuration_Secure.h with + * the following defines, customized for your network. This specific file is excluded via + * .gitignore to prevent it from accidentally leaking to the public. + * + * #define WIFI_SSID "WiFi SSID" + * #define WIFI_PWD "WiFi Password" + */ + //#include "Configuration_Secure.h" // External file with WiFi SSID / Password #endif /** @@ -2972,10 +3127,15 @@ // @section develop -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -#define PINS_DEBUGGING +// +// M100 Free Memory Watcher to debug memory usage +// +//#define M100_FREE_MEMORY_WATCHER + +// +// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe +// +//#define PINS_DEBUGGING // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE diff --git a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h index 4ab165c7a0..a64ffc74e3 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h @@ -95,6 +95,18 @@ public: { } }; +// +// Very basic support for 480x320 TFT screen +// +extern u8g_dev_t u8g_dev_tft_480x320_upscale_from_128x64; + +class U8GLIB_TFT_480X320_UPSCALE_FROM_128X64 : public U8GLIB { +public: + U8GLIB_TFT_480X320_UPSCALE_FROM_128X64(uint8_t cs, uint8_t rs, uint8_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_tft_480x320_upscale_from_128x64, cs, rs, reset) + { } +}; + extern u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, u8g_dev_uc1701_mini12864_HAL_2x_hw_spi; diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_480x320_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_480x320_upscale_from_128x64.cpp new file mode 100644 index 0000000000..734776c469 --- /dev/null +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_480x320_upscale_from_128x64.cpp @@ -0,0 +1,787 @@ +/** + * 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 . + * + */ + +/* + + u8g_dev_tft_480x320_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. + +*/ + +/* + modified by alpine to 3x upscale for 3.5 TFT of the TwoTrees Sapphire Pro + + ToDo: + + * DONE - linear upscale algorithm to safe cpu + * DONE - touchUI in general + * DONE - check touch control to match hotzones to desired design + (not quite exact but reasonable close) + * color selection / temperature indicator + (see old MKS version) + * G-Code control ("on/off"/"brightness"/color profiles) + * nyan cat + + longterm: + * DONE make selectable upscale options (in own classes) + * still missing non-DMA mode + * DONE configurable through main/board config + * submit to marlin + + */ + +#include "../../inc/MarlinConfig.h" + +#if HAS_GRAPHICAL_LCD && PIN_EXISTS(FSMC_CS) + +#include "HAL_LCD_com_defines.h" +#include "ultralcd_DOGM.h" + +#include + +#if ENABLED(LCD_USE_DMA_FSMC) + extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length); + extern void LCD_IO_WriteSequence_Async(uint16_t *data, uint16_t length); + extern void LCD_IO_WaitSequence_Async(); + extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count); +#endif + +/* + desired screen arrangement: + +(0/0) <-- 480 px --> + \/_________________________ + |_| top offset: y 32 px |_| + |_|______________________|_| /\ + | | Marlin display |_| | + | | 384*192 px |_| | + |_|______________________|_| 320 px + |_| middle spacing 16 px |_| | + |_|______________________|_| | + || touch UI: 384*64 px || \/ + || UIelement Y 2+60+2 px || + ||________________________|| + |_| bottom offset y 16 px|_| + |_|______________________|_|<- (479/319) + ^- left offset: ^- right offset: + 48 px 48 px +*/ + +#define WIDTH LCD_PIXEL_WIDTH +#define HEIGHT LCD_PIXEL_HEIGHT +#define PAGE_HEIGHT 8 + +#define X_LO LCD_PIXEL_OFFSET_X +#define Y_LO LCD_PIXEL_OFFSET_Y +// 3x upscale +#define X_HI (X_LO + 3 * WIDTH - 1) +#define Y_HI (Y_LO + 3 * HEIGHT - 1) + +#define LCD_COLUMN 0x2A /* Colomn address register */ +#define LCD_ROW 0x2B /* Row address register */ +#define LCD_WRITE_RAM 0x2C + +/* + Touch UI + ||----------------------------|| + || middle spacing 384*16px || + ||----------------------------||/___ y = 242 px + || ELX | | ELA || ELB | | ELC ||\ +x ||^24 ^136 ^248 ^360 ||/___ y = 301 px + ||----------------------------||\ + 24 px + 96*4 px + 16*3 px + 24 px +*/ + +#define BUTTON_SIZE_X 32 +#define BUTTON_SIZE_Y 20 + +#define BUTTOND_X_LO 24 +#define BUTTOND_X_HI (BUTTOND_X_LO + 3 * BUTTON_SIZE_X -1) + +#define BUTTONA_X_LO 136 +#define BUTTONA_X_HI (BUTTONA_X_LO + 3 * BUTTON_SIZE_X -1) + +#define BUTTONB_X_LO 248 +#define BUTTONB_X_HI (BUTTONB_X_LO + 3 * BUTTON_SIZE_X -1) + +#define BUTTONC_X_LO 360 +#define BUTTONC_X_HI (BUTTONC_X_LO + 3 * BUTTON_SIZE_X -1) + +#define BUTTON_Y_LO 242 +#define BUTTON_Y_HI (BUTTON_Y_LO + 3 * BUTTON_SIZE_Y -1) + + + +// see https://ee-programming-notepad.blogspot.com/2016/10/16-bit-color-generator-picker.html + +#define COLOR_BLACK 0x0000 // #000000 +#define COLOR_WHITE 0xFFFF // #FFFFFF +#define COLOR_SILVER 0xC618 // #C0C0C0 +#define COLOR_GREY 0x7BEF // #808080 +#define COLOR_DARKGREY 0x4208 // #404040 +#define COLOR_DARKGREY2 0x39E7 // #303030 +#define COLOR_DARK 0x0003 // Some dark color + +#define COLOR_RED 0xF800 // #FF0000 +#define COLOR_LIME 0x7E00 // #00FF00 +#define COLOR_BLUE 0x001F // #0000FF +#define COLOR_YELLOW 0xFFE0 // #FFFF00 +#define COLOR_MAGENTA 0xF81F // #FF00FF +#define COLOR_FUCHSIA 0xF81F // #FF00FF +#define COLOR_CYAN 0x07FF // #00FFFF +#define COLOR_AQUA 0x07FF // #00FFFF + +#define COLOR_MAROON 0x7800 // #800000 +#define COLOR_GREEN 0x27E0 // #008000 +#define COLOR_NAVY 0x000F // #000080 +#define COLOR_OLIVE 0x8400 // #808000 +#define COLOR_PURPLE 0x8010 // #800080 +#define COLOR_TEAL 0x0410 // #008080 + +#define COLOR_ORANGE 0xFC00 // #FF7F00 + +#ifndef TFT_MARLINUI_COLOR + #define TFT_MARLINUI_COLOR COLOR_WHITE +#endif +#ifndef TFT_MARLINBG_COLOR + #define TFT_MARLINBG_COLOR COLOR_NAVY +#endif +#ifndef TFT_DISABLED_COLOR + #define TFT_DISABLED_COLOR COLOR_DARK +#endif +#ifndef TFT_BTCANCEL_COLOR + #define TFT_BTCANCEL_COLOR COLOR_WHITE +#endif +#ifndef TFT_BTARROWS_COLOR + #define TFT_BTARROWS_COLOR COLOR_WHITE +#endif +#ifndef TFT_BTOKMENU_COLOR + #define TFT_BTOKMENU_COLOR COLOR_WHITE +#endif + +#ifndef TFT_PRESET_UI_0 + #define TFT_PRESET_UI_0 COLOR_WHITE +#endif +#ifndef TFT_PRESET_BG_0 + #define TFT_PRESET_BG_0 COLOR_BLACK +#endif +#ifndef TFT_PRESET_UI_1 + #define TFT_PRESET_UI_1 COLOR_WHITE +#endif +#ifndef TFT_PRESET_BG_1 + #define TFT_PRESET_BG_1 COLOR_NAVY +#endif +#ifndef TFT_PRESET_UI_2 + #define TFT_PRESET_UI_2 COLOR_BLACK +#endif +#ifndef TFT_PRESET_BG_2 + #define TFT_PRESET_BG_2 COLOR_WHITE +#endif +#ifndef TFT_PRESET_UI_3 + #define TFT_PRESET_UI_3 COLOR_DARK +#endif +#ifndef TFT_PRESET_BG_3 + #define TFT_PRESET_BG_3 COLOR_OLIVE +#endif +#ifndef TFT_PRESET_UI_4 + #define TFT_PRESET_UI_4 COLOR_SILVER +#endif +#ifndef TFT_PRESET_BG_4 + #define TFT_PRESET_BG_4 COLOR_DARKGREY +#endif + + + +static uint32_t lcd_id = 0; +uint16_t ui_color1 = TFT_BTCANCEL_COLOR; +uint16_t ui_color2 = TFT_BTARROWS_COLOR; +uint16_t ui_color3 = TFT_BTARROWS_COLOR ; +uint16_t ui_color4 = TFT_BTOKMENU_COLOR; +uint16_t bg_color = TFT_MARLINBG_COLOR; +uint16_t ui_color = TFT_MARLINUI_COLOR; +static bool reqDrawButtons = false; +static bool reqClearScreen = false; + +#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_LO), U8G_ESC_DATA(X_HI), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(Y_LO), U8G_ESC_DATA(Y_HI), + 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, U8G_ESC_DATA(LCD_FULL_PIXEL_WIDTH), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_HEIGHT), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END +}; + +//@ ToDo +// check positions for new offsets +// --> done. see marlin/src/feature/touch/xpt2046.cpp + +#if ENABLED(TOUCH_BUTTONS) + + static const uint8_t separation_line_sequence_left[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(10), U8G_ESC_DATA(159), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(170), U8G_ESC_DATA(173), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END + }; + + static const uint8_t separation_line_sequence_right[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(160), U8G_ESC_DATA(309), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(170), U8G_ESC_DATA(173), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END + }; + + static const uint8_t buttonD_sequence[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTOND_X_LO), U8G_ESC_DATA(BUTTOND_X_HI), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTON_Y_LO), U8G_ESC_DATA(BUTTON_Y_HI), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END + }; + + static const uint8_t buttonA_sequence[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTONA_X_LO), U8G_ESC_DATA(BUTTONA_X_HI), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTON_Y_LO), U8G_ESC_DATA(BUTTON_Y_HI), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END + }; + + static const uint8_t buttonB_sequence[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTONB_X_LO), U8G_ESC_DATA(BUTTONB_X_HI), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTON_Y_LO), U8G_ESC_DATA(BUTTON_Y_HI), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END + }; + + static const uint8_t buttonC_sequence[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTONC_X_LO), U8G_ESC_DATA(BUTTONC_X_HI), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(BUTTON_Y_LO), U8G_ESC_DATA(BUTTON_Y_HI), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END + }; + +#endif + +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 ili9341_init_sequence[] = { // 0x9341 - ILI9341 + U8G_ESC_ADR(0), + 0x10, + U8G_ESC_DLY(10), + 0x01, + U8G_ESC_DLY(100), U8G_ESC_DLY(100), + 0x36, U8G_ESC_ADR(1), 0xE8, + U8G_ESC_ADR(0), 0x3A, U8G_ESC_ADR(1), 0x55, + 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), 0xC5, U8G_ESC_ADR(1), 0x3E, 0x28, + U8G_ESC_ADR(0), 0xC7, U8G_ESC_ADR(1), 0x86, + U8G_ESC_ADR(0), 0xB1, U8G_ESC_ADR(1), 0x00, 0x18, + U8G_ESC_ADR(0), 0xC0, U8G_ESC_ADR(1), 0x23, + U8G_ESC_ADR(0), 0xC1, U8G_ESC_ADR(1), 0x10, + U8G_ESC_ADR(0), 0x29, + U8G_ESC_ADR(0), 0x11, + U8G_ESC_DLY(100), + U8G_ESC_END +}; + +#if ENABLED(TOUCH_BUTTONS) + + static const uint8_t buttonD[] = { + B01111111,B11111111,B11111111,B11111110, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00011000,B00110000,B00000001, + B10000000,B00001100,B01100000,B00000001, + B10000000,B00000110,B11000000,B00000001, + B10000000,B00000011,B10000000,B00000001, + B10000000,B00000011,B10000000,B00000001, + B10000000,B00000110,B11000000,B00000001, + B10000000,B00001100,B01100000,B00000001, + B10000000,B00011000,B00110000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B01111111,B11111111,B11111111,B11111110, + }; + + #if ENABLED(REVERSE_MENU_DIRECTION) + + static const uint8_t buttonA[] = { + B01111111,B11111111,B11111111,B11111110, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00111111,B11100001, + B10000111,B11111100,B00111111,B11100001, + B10000011,B11111000,B00000000,B00000001, + B10000001,B11110000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B01000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B01111111,B11111111,B11111111,B11111110, + }; + static const uint8_t buttonB[] = { + B01111111,B11111111,B11111111,B11111110, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B01100000,B00000010,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00001111,B10000001, + B10000000,B01100000,B00011111,B11000001, + B10000111,B11111110,B00111111,B11100001, + B10000111,B11111110,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B01111111,B11111111,B11111111,B11111110, + }; + + #else + + static const uint8_t buttonA[] = { + B01111111,B11111111,B11111111,B11111110, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B01000000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000001,B11110000,B00000000,B00000001, + B10000011,B11111000,B00000000,B00000001, + B10000111,B11111100,B00111111,B11100001, + B10000000,B11100000,B00111111,B11100001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B11100000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B01111111,B11111111,B11111111,B11111110, + }; + + static const uint8_t buttonB[] = { + B01111111,B11111111,B11111111,B11111110, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000111,B00000001, + B10000111,B11111110,B00000111,B00000001, + B10000111,B11111110,B00111111,B11100001, + B10000000,B01100000,B00011111,B11000001, + B10000000,B01100000,B00001111,B10000001, + B10000000,B01100000,B00000111,B00000001, + B10000000,B01100000,B00000010,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B01111111,B11111111,B11111111,B11111110, + }; + + #endif + + static const uint8_t buttonC[] = { + B01111111,B11111111,B11111111,B11111110, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00011100,B00000001, + B10000000,B00000100,B00011100,B00000001, + B10000000,B00001100,B00011100,B00000001, + B10000000,B00011111,B11111100,B00000001, + B10000000,B00111111,B11111100,B00000001, + B10000000,B00011111,B11111100,B00000001, + B10000000,B00001100,B00000000,B00000001, + B10000000,B00000100,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B10000000,B00000000,B00000000,B00000001, + B01111111,B11111111,B11111111,B11111110, + }; + + //@ ToDo + // *check for button sizes and how to upscale to fit on screen + // *check if other parts of marlin use drawImage + + static void switchColor(uint16_t uiColor, uint16_t bgColor) { + ui_color = uiColor; + bg_color = bgColor; + } + + static void clearScreen() { + reqClearScreen = true; + } + + static void drawButtons() { + reqDrawButtons = true; + } + + void switchColorPreset(uint8_t colorPreset) { + switch (colorPreset) + { + case 1: switchColor(TFT_PRESET_UI_1, TFT_PRESET_BG_1); break; + case 2: switchColor(TFT_PRESET_UI_2, TFT_PRESET_BG_2); break; + case 3: switchColor(TFT_PRESET_UI_3, TFT_PRESET_BG_3); break; + case 4: switchColor(TFT_PRESET_UI_4, TFT_PRESET_BG_4); break; + default: switchColor(TFT_PRESET_UI_0, TFT_PRESET_BG_0); break; + } + drawButtons(); + clearScreen(); + } + + static void drawImage(const uint8_t *data, u8g_t *u8g, u8g_dev_t *dev, uint16_t length, uint16_t height, uint16_t color) { + static uint16_t p_buffer[288]; + uint16_t* buffer = &p_buffer[0]; + + for (uint16_t i = 0; i < height; i++) { + uint32_t k = 0; + for (uint16_t j = 0; j < length; j++) { + uint16_t v = bg_color; + if (*(data + (i * (length >> 3) + (j >> 3))) & (0x80 >> (j & 7))) + v = color; + else + v = bg_color; + + // linear write should be faster + // optimize later + // + // buffer[k+96] = v; + // buffer[k+192] = v; + // buffer[k++] = v; + // buffer[k+96] = v; + // buffer[k+192] = v; + // buffer[k++] = v; + // buffer[k+96] = v; + // buffer[k+192] = v; + // buffer[k++] = v; + + // upscale X 3x + buffer[k++] = v; + buffer[k++] = v; + buffer[k++] = v; + } + #ifdef LCD_USE_DMA_FSMC + // if (k <= 80) { // generally is... for our buttons + // memcpy(&buffer[k], &buffer[0], k * sizeof(uint16_t)); + + // LCD_IO_WriteSequence(buffer, k * sizeof(uint16_t)); + // } + // else { + // LCD_IO_WriteSequence(buffer, k); + + // LCD_IO_WriteSequence(buffer, k); + // } + + // Upscale Y 3x + // linear write should be faster for big arrays + // + for (uint16_t l = 0; l < 96; l++) + { + buffer[l+96] = buffer[l]; + } + for (uint16_t l = 0; l < 96; l++) + { + buffer[l+192] = buffer[l]; + } + + LCD_IO_WriteSequence(p_buffer, 288); + #else + u8g_WriteSequence(u8g, dev, k << 1, (uint8_t *)buffer); + u8g_WriteSequence(u8g, dev, k << 1, (uint8_t *)buffer); + #endif + } + } + +#endif // TOUCH_BUTTONS + +// Used to fill RGB565 (16bits) background +inline void memset2(const void *ptr, uint16_t fill, size_t cnt) { + uint16_t* wptr = (uint16_t*)ptr; + for (size_t i = 0; i < cnt; i += 2) { *wptr = fill; wptr++; } +} + +static void clearScreenSequence(u8g_t *u8g, u8g_dev_t *dev) { + u8g_WriteEscSeqP(u8g, dev, clear_screen_sequence); + #ifdef LCD_USE_DMA_FSMC + LCD_IO_WriteMultiple(bg_color, (480*320)); + #endif +} + +static void drawButtonSequence(u8g_t *u8g, u8g_dev_t *dev) { + #if ENABLED(TOUCH_BUTTONS) + u8g_WriteEscSeqP(u8g, dev, buttonD_sequence); + drawImage(buttonD, u8g, dev, 32, 20, ui_color1); + + u8g_WriteEscSeqP(u8g, dev, buttonA_sequence); + drawImage(buttonA, u8g, dev, 32, 20, ui_color2); + + u8g_WriteEscSeqP(u8g, dev, buttonB_sequence); + drawImage(buttonB, u8g, dev, 32, 20, ui_color3); + + u8g_WriteEscSeqP(u8g, dev, buttonC_sequence); + drawImage(buttonC, u8g, dev, 32, 20, ui_color4); + #endif // TOUCH_BUTTONS +} + +static bool preinit = true; +static uint8_t page; + +uint8_t u8g_dev_tft_480x320_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); + #ifdef LCD_USE_DMA_FSMC + // new buffer sizes needed? + static uint16_t bufferA[1152], bufferB[1152]; + uint16_t* buffer = &bufferA[0]; + bool allow_async = true; + #else + uint16_t buffer[WIDTH*2]; // 16-bit RGB 565 pixel line buffer + #endif + 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 + + if ((lcd_id & 0xFFFF) == 0x8552) // ST7789V + u8g_WriteEscSeqP(u8g, dev, st7789v_init_sequence); + if ((lcd_id & 0xFFFF) == 0x9341) // ILI9341 + u8g_WriteEscSeqP(u8g, dev, ili9341_init_sequence); + + if (preinit) { + preinit = false; + return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); + } + + // Clear Screen Sequence + // u8g_WriteEscSeqP(u8g, dev, clear_screen_sequence); + // #ifdef LCD_USE_DMA_FSMC + // LCD_IO_WriteMultiple(bg_color, (480*320)); + // #else + // memset2(buffer, TFT_MARLINBG_COLOR, 160); + // for (uint16_t i = 0; i < 960; i++) + // u8g_WriteSequence(u8g, dev, 160, (uint8_t *)buffer); + // #endif + + clearScreenSequence(u8g, dev); + drawButtonSequence(u8g, dev); + + // // bottom line and buttons + // #if ENABLED(TOUCH_BUTTONS) + // //@ check button sizes + // u8g_WriteEscSeqP(u8g, dev, buttonD_sequence); + // drawImage(buttonD, u8g, dev, 32, 20, TFT_BTCANCEL_COLOR); + + // u8g_WriteEscSeqP(u8g, dev, buttonA_sequence); + // drawImage(buttonA, u8g, dev, 32, 20, TFT_BTARROWS_COLOR); + + // u8g_WriteEscSeqP(u8g, dev, buttonB_sequence); + // drawImage(buttonB, u8g, dev, 32, 20, TFT_BTARROWS_COLOR); + + // u8g_WriteEscSeqP(u8g, dev, buttonC_sequence); + // drawImage(buttonC, u8g, dev, 32, 20, TFT_BTOKMENU_COLOR); + // #endif // TOUCH_BUTTONS + + return 0; + + case U8G_DEV_MSG_STOP: preinit = true; break; + + case U8G_DEV_MSG_PAGE_FIRST: + page = 0; + if (reqClearScreen) + { + clearScreenSequence(u8g, dev); + reqClearScreen = false; + } + + if (reqDrawButtons) + { + drawButtonSequence(u8g, dev); + reqDrawButtons = false; + } + u8g_WriteEscSeqP(u8g, dev, page_first_sequence); + break; + + case U8G_DEV_MSG_PAGE_NEXT: + if (++page > (HEIGHT / PAGE_HEIGHT)) return 1; + + for (uint8_t y = 0; y < PAGE_HEIGHT; y++) { + uint32_t k = 0; + #ifdef LCD_USE_DMA_FSMC + buffer = (y & 1) ? bufferB : bufferA; + #endif + for (uint16_t i = 0; i < (uint32_t)pb->width; i++) { + const uint8_t b = *(((uint8_t *)pb->buf) + i); + const uint16_t c = TEST(b, y) ? ui_color : bg_color; + //@ 2x upscale X + // resulting buffersize RGB565 * 256 - 128*2 + //buffer[k++] = c; + //buffer[k++] = c; + + //@ 3x upscale X and Y in same loop + // 1 px -> 3*3 px + // resulting buffersize RGB565 * 1152 - 128*3*3 + buffer[k++] = c; + buffer[k++] = c; + buffer[k++] = c; + } + #ifdef LCD_USE_DMA_FSMC + //@ 2x upscale Y + // resulting buffersize RGB565 * 512 - 256*2 + //memcpy(&buffer[256], &buffer[0], 512); + // Upscale Y 3x + // linear write should be faster for big arrays + // + for (uint16_t l = 0; l < 384; l++) + { + buffer[l+384] = buffer[l]; + } + for (uint16_t l = 0; l < 384; l++) + { + buffer[l+768] = buffer[l]; + } + + if (allow_async) { + if (y > 0 || page > 1) LCD_IO_WaitSequence_Async(); + if (y == 7 && page == 8) + //LCD_IO_WriteSequence(buffer, 512); // last line of last page + LCD_IO_WriteSequence(buffer, 1152); + else + //LCD_IO_WriteSequence_Async(buffer, 512); + LCD_IO_WriteSequence_Async(buffer, 1152); + } + else + LCD_IO_WriteSequence(buffer, 1152); + #else + uint8_t* bufptr = (uint8_t*) buffer; + for (uint8_t i = 2; i--;) { + u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[0]); + u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH]); + u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH*2]); + u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH*3]); + } + #endif + } + break; + + case U8G_DEV_MSG_SLEEP_ON: + // Enter Sleep Mode (10h) + return 1; + case U8G_DEV_MSG_SLEEP_OFF: + // Sleep Out (11h) + return 1; + } + return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); +} + + +U8G_PB_DEV(u8g_dev_tft_480x320_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_tft_480x320_upscale_from_128x64_fn, U8G_COM_HAL_FSMC_FN); + +#endif // HAS_GRAPHICAL_LCD && FSMC_CS diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index 536b8f0bf9..bcd0ceaf87 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -174,7 +174,13 @@ // Unspecified 320x240 TFT pre-initialized by built-in bootloader - #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64 + // Unspecified 320x240 TFT pre-initialized by built-in bootloader + #if (FSMC_UPSCALE == 3) + #define U8G_CLASS U8GLIB_TFT_480X320_UPSCALE_FROM_128X64 + #else + #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64 + #endif + #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN #else @@ -199,10 +205,20 @@ // LCD_FULL_PIXEL_WIDTH = // LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X #if ENABLED(FSMC_GRAPHICAL_TFT) - #define LCD_FULL_PIXEL_WIDTH 320 - #define LCD_PIXEL_OFFSET_X 32 - #define LCD_FULL_PIXEL_HEIGHT 240 - #define LCD_PIXEL_OFFSET_Y 32 + // #define LCD_FULL_PIXEL_WIDTH 320 + // #define LCD_PIXEL_OFFSET_X 32 + // #define LCD_FULL_PIXEL_HEIGHT 240 + // #define LCD_PIXEL_OFFSET_Y 32 + + #define LCD_FULL_PIXEL_WIDTH 480 + #define LCD_PIXEL_OFFSET_X 48 + #define LCD_FULL_PIXEL_HEIGHT 320 + #define LCD_PIXEL_OFFSET_Y 32 // to leave at least 60px for UI + #if (FSMC_UPSCALE == 3) + extern uint16_t ui_color; + extern uint16_t bg_color; + extern void switchColorPreset(uint8_t preset); + #endif #endif // For selective rendering within a Y range diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index ae9118e6d0..ef2ca5e86e 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -37,6 +37,10 @@ // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role // #define DISABLE_DEBUG +#undef JTAGSWD_DISABLE + +//Case LED in instead E1 +#define CASE_LED_INSTEAD_E1 // // Limit Switches @@ -69,9 +73,13 @@ #define E0_STEP_PIN PD6 #define E0_DIR_PIN PD3 -#define E1_ENABLE_PIN PA3 -#define E1_STEP_PIN PA6 -#define E1_DIR_PIN PA1 +#ifdef CASE_LED_INSTEAD_E1 + #define LED_CASE_PIN PA3 +#else + #define E1_ENABLE_PIN PA3 + #define E1_STEP_PIN PA6 + #define E1_DIR_PIN PA1 +#endif // // Temperature Sensors @@ -99,7 +107,10 @@ // Misc. Functions // #define POWER_LOSS_PIN PA2 // PW_DET -#define PS_ON_PIN PA3 // PW_OFF +#ifndef CASE_LED_INSTEAD_E1 + #define PS_ON_PIN PA3 // PW_OFF +#endif + #define LED_PIN PB2 @@ -123,9 +134,13 @@ #define FSMC_CS_PIN PD7 // NE4 #define FSMC_RS_PIN PD11 // A0 - #define LCD_RESET_PIN PC6 // FSMC_RST + //#define LCD_RESET_PIN PC6 // FSMC_RST #define NO_LCD_REINIT // Suppress LCD re-initialization + #define LCD_USE_DMA_FSMC + #define FSMC_DMA_DEV DMA2 + #define FSMC_DMA_CHANNEL DMA_CH5 + #define LCD_BACKLIGHT_PIN PD13 #if ENABLED(TOUCH_BUTTONS) diff --git a/jlink.cmd b/jlink.cmd new file mode 100644 index 0000000000..766055b2c4 --- /dev/null +++ b/jlink.cmd @@ -0,0 +1,4 @@ +r +loadbin ./.pio/build/mks_robin_nano/firmware.bin 0x08007000 +rnh +q diff --git a/ozone.jdebug b/ozone.jdebug new file mode 100644 index 0000000000..8caa26d437 --- /dev/null +++ b/ozone.jdebug @@ -0,0 +1,240 @@ + +/********************************************************************* +* +* OnProjectLoad +* +* Function description +* Project load routine. Required. +* +********************************************************************** +*/ +void OnProjectLoad (void) { + // + // Dialog-generated settings + // + Project.SetDevice ("STM32F103VE"); + Project.SetHostIF ("USB", ""); + Project.SetTargetIF ("SWD"); + Project.SetTIFSpeed ("4 MHz"); + Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M3.svd"); + Project.AddSvdFile ("/home/sergey/Projects/STM32/F103/BluePill-F103/PWM/STM32F103.svd"); + Project.AddPathSubstitute ("/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0", "$(ProjectDir)"); + ///home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/ozone.jdebug + // User settings + // + + File.Open ("$(ProjectDir)/.pio/build/mks_robin_nano/firmware.elf"); +} + +/********************************************************************* +* +* TargetReset +* +* Function description +* Replaces the default target device reset routine. Optional. +* +* Notes +* This example demonstrates the usage when +* debugging a RAM program on a Cortex-M target device +* +********************************************************************** +*/ +//void TargetReset (void) { +// +// unsigned int SP; +// unsigned int PC; +// unsigned int VectorTableAddr; +// +// Exec.Reset(); +// +// VectorTableAddr = Elf.GetBaseAddr(); +// +// if (VectorTableAddr != 0xFFFFFFFF) { +// +// Util.Log("Resetting Program."); +// +// SP = Target.ReadU32(VectorTableAddr); +// Target.SetReg("SP", SP); +// +// PC = Target.ReadU32(VectorTableAddr + 4); +// Target.SetReg("PC", PC); +// } +//} + +/********************************************************************* +* +* BeforeTargetReset +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void BeforeTargetReset (void) { +//} + +/********************************************************************* +* +* AfterTargetReset +* +* Function description +* Event handler routine. +* - Sets the PC register to program reset value. +* - Sets the SP register to program reset value on Cortex-M. +* +********************************************************************** +*/ +void AfterTargetReset (void) { + unsigned int SP; + unsigned int PC; + unsigned int VectorTableAddr; + + VectorTableAddr = Elf.GetBaseAddr(); + + if (VectorTableAddr == 0xFFFFFFFF) { + Util.Log("Project file error: failed to get program base"); + } else { + SP = Target.ReadU32(VectorTableAddr); + Target.SetReg("SP", SP); + + PC = Target.ReadU32(VectorTableAddr + 4); + Target.SetReg("PC", PC); + } +} + +/********************************************************************* +* +* DebugStart +* +* Function description +* Replaces the default debug session startup routine. Optional. +* +********************************************************************** +*/ +//void DebugStart (void) { +//} + +/********************************************************************* +* +* TargetConnect +* +* Function description +* Replaces the default target IF connection routine. Optional. +* +********************************************************************** +*/ +//void TargetConnect (void) { +//} + +/********************************************************************* +* +* BeforeTargetConnect +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void BeforeTargetConnect (void) { +//} + +/********************************************************************* +* +* AfterTargetConnect +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void AfterTargetConnect (void) { +//} + +/********************************************************************* +* +* TargetDownload +* +* Function description +* Replaces the default program download routine. Optional. +* +********************************************************************** +*/ +//void TargetDownload (void) { +//} + +/********************************************************************* +* +* BeforeTargetDownload +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void BeforeTargetDownload (void) { +//} + +/********************************************************************* +* +* AfterTargetDownload +* +* Function description +* Event handler routine. +* - Sets the PC register to program reset value. +* - Sets the SP register to program reset value on Cortex-M. +* +********************************************************************** +*/ +void AfterTargetDownload (void) { + unsigned int SP; + unsigned int PC; + unsigned int VectorTableAddr; + + VectorTableAddr = Elf.GetBaseAddr(); + + if (VectorTableAddr == 0xFFFFFFFF) { + Util.Log("Project file error: failed to get program base"); + } else { + SP = Target.ReadU32(VectorTableAddr); + Target.SetReg("SP", SP); + + PC = Target.ReadU32(VectorTableAddr + 4); + Target.SetReg("PC", PC); + } +} + +/********************************************************************* +* +* BeforeTargetDisconnect +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void BeforeTargetDisconnect (void) { +//} + +/********************************************************************* +* +* AfterTargetDisconnect +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void AfterTargetDisconnect (void) { +//} + +/********************************************************************* +* +* AfterTargetHalt +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void AfterTargetHalt (void) { +//} diff --git a/ozone.jdebug.user b/ozone.jdebug.user new file mode 100644 index 0000000000..1e53cc4e4a --- /dev/null +++ b/ozone.jdebug.user @@ -0,0 +1,28 @@ + +Breakpoint=3119860543: 43: 0, State=BP_STATE_DISABLED +OpenDocument="main.cpp", FilePath="/home/sergey/.platformio/packages/framework-arduinoststm32-maple/STM32F1/cores/maple/main.cpp", Line=13 +OpenDocument="ultralcd.cpp", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/lcd/ultralcd.cpp", Line=745 +OpenDocument="wirish_time.h", FilePath="/home/sergey/.platformio/packages/framework-arduinoststm32-maple/STM32F1/cores/maple/wirish_time.h", Line=62 +OpenDocument="start.S", FilePath="/home/sergey/.platformio/packages/framework-arduinoststm32-maple/STM32F1/variants/generic_stm32f103v/wirish/start.S", Line=26 +OpenDocument="gpio.h", FilePath="/home/sergey/.platformio/packages/framework-arduinoststm32-maple/STM32F1/system/libmaple/stm32f1/include/series/gpio.h", Line=401 +OpenDocument="MarlinCore.cpp", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/MarlinCore.cpp", Line=1086 +OpenToolbar="Debug", Floating=0, x=0, y=0 +OpenWindow="Call Stack", DockArea=RIGHT, x=0, y=0, w=427, h=523, FilterBarShown=0, ToolBarShown=0 +OpenWindow="Registers 1", DockArea=RIGHT, x=0, y=0, w=427, h=523, FilterBarShown=0, ToolBarShown=0, FilteredItems=[], RefreshRate=1 +OpenWindow="Source Files", DockArea=LEFT, x=0, y=0, w=301, h=523, FilterBarShown=1, ToolBarShown=0 +OpenWindow="Disassembly", DockArea=LEFT, x=0, y=0, w=301, h=523, FilterBarShown=0, ToolBarShown=0, ExecCountersShown=0, InstEncodingsShown=0 +OpenWindow="Source", x=0, y=0, w=0, h=0, FilterBarShown=0, ToolBarShown=0, ExecCountersShown=0 +OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=0, w=301, h=523, FilterBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254 +OpenWindow="Memory 1", DockArea=BOTTOM, x=1, y=0, w=524, h=220, FilterBarShown=0, ToolBarShown=0, EditorAddress=0x30000000 +OpenWindow="Watched Data", DockArea=BOTTOM, x=2, y=0, w=424, h=220, FilterBarShown=0, ToolBarShown=0 +OpenWindow="Terminal", DockArea=BOTTOM, x=0, y=0, w=580, h=220, FilterBarShown=0, ToolBarShown=0 +OpenWindow="RTOS", DockArea=RIGHT, x=0, y=0, w=427, h=523, FilterBarShown=0, ToolBarShown=0, Showing="" +TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[232;195;259] +TableHeader="Vector Catches", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Vector Catch";"Description"], ColWidths=[50;300;500] +TableHeader="Break & Tracepoints", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[55;102;112;123] +TableHeader="Source Files", SortCol="Path", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[147;59;48;57;1015] +TableHeader="Watched Data", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Value";"Location";"Refresh";"Access"], ColWidths=[125;172;117;54;51] +TableHeader="Call Stack", SortCol="Function", SortOrder="ASCENDING", VisibleCols=["Function";"Stack Frame";"Source";"PC";"Return Address";"Stack Used"], ColWidths=[201;96;88;82;156;73] +TableHeader="Power Sampling", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Ch 0"], ColWidths=[100;100;100] +TableHeader="RegisterSelectionDialog", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Auto";"Name";"Address";"Description"], ColWidths=[27;27;27;27] +WatchedExpression="case_light_arg_flag" \ No newline at end of file