Browse Source

Рабочий конфиг под 4S

pull/1/head
Sergey 5 years ago
parent
commit
9b38017e8a
  1. 220
      Marlin/Configuration.h
  2. 596
      Marlin/Configuration_adv.h
  3. 12
      Marlin/src/lcd/dogm/HAL_LCD_class_defines.h
  4. 787
      Marlin/src/lcd/dogm/u8g_dev_tft_480x320_upscale_from_128x64.cpp
  5. 26
      Marlin/src/lcd/dogm/ultralcd_DOGM.h
  6. 25
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
  7. 4
      jlink.cmd
  8. 240
      ozone.jdebug
  9. 28
      ozone.jdebug.user

220
Marlin/Configuration.h

@ -71,7 +71,7 @@
// @section info // @section info
// Author info of this build printed to the host during boot and M115 // 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) //#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 ** // Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
//#define SHOW_BOOTSCREEN #define SHOW_BOOTSCREEN
// Show the bitmap in Marlin/_Bootscreen.h on startup. // Show the bitmap in Marlin/_Bootscreen.h on startup.
//#define SHOW_CUSTOM_BOOTSCREEN //#define SHOW_CUSTOM_BOOTSCREEN
@ -105,15 +105,12 @@
* *
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7] * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/ */
//@
#define SERIAL_PORT 3 #define SERIAL_PORT 3
/** /**
* Select a secondary serial port on the board to use for communication with the host. * Select a secondary serial port on the board to use for communication with the host.
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7] * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/ */
//@
#define SERIAL_PORT_2 1 #define SERIAL_PORT_2 1
#define NUM_SERIAL 2 #define NUM_SERIAL 2
@ -126,20 +123,17 @@
* *
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] * :[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 #define BAUDRATE 115200
// Enable the Bluetooth serial interface on AT90USB devices // Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH //#define BLUETOOTH
// Choose the name from boards.h that matches your setup // Choose the name from boards.h that matches your setup
//@
#ifndef MOTHERBOARD #ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_MKS_ROBIN_NANO #define MOTHERBOARD BOARD_MKS_ROBIN_NANO
#endif #endif
// Name displayed in the LCD "Ready" message and Info menu // Name displayed in the LCD "Ready" message and Info menu
//@
#define CUSTOM_MACHINE_NAME "FBGhost 4s" #define CUSTOM_MACHINE_NAME "FBGhost 4s"
// Printer's unique ID, used by some programs to differentiate between machines. // Printer's unique ID, used by some programs to differentiate between machines.
@ -149,11 +143,10 @@
// @section extruder // @section extruder
// This defines the number of extruders // This defines the number of extruders
// :[1, 2, 3, 4, 5, 6] // :[1, 2, 3, 4, 5, 6, 7, 8]
#define EXTRUDERS 1 #define EXTRUDERS 1
// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. // Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.
//@
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 #define DEFAULT_NOMINAL_FILAMENT_DIA 1.75
// For Cyclops or any "multi-extruder" that shares a single nozzle. // For Cyclops or any "multi-extruder" that shares a single nozzle.
@ -332,13 +325,14 @@
//#define PSU_NAME "Power Supply" //#define PSU_NAME "Power Supply"
#if ENABLED(PSU_CONTROL) #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) #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_E_FANS
#define AUTO_POWER_CONTROLLERFAN #define AUTO_POWER_CONTROLLERFAN
#define AUTO_POWER_CHAMBER_FAN #define AUTO_POWER_CHAMBER_FAN
@ -359,13 +353,15 @@
* *
* Temperature sensors available: * 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 * -4 : thermocouple with AD8495
* -3 : thermocouple with MAX31855 (only for sensor 0)
* -2 : thermocouple with MAX6675 (only for sensor 0)
* -1 : thermocouple with AD595 * -1 : thermocouple with AD595
* 0 : not used * 0 : not used
* 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) * 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) * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
* 202 : 200k thermistor - Copymaster 3D * 202 : 200k thermistor - Copymaster 3D
* 3 : Mendel-parts thermistor (4.7k pullup) * 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" * 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 * 15 : 100k thermistor calibration for JGAurora A5 hotend
* 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 * 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 * 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup * 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. * 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. * 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_0 1
#define TEMP_SENSOR_1 0 #define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0 #define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0 #define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0 #define TEMP_SENSOR_4 0
#define TEMP_SENSOR_5 0 #define TEMP_SENSOR_5 0
//@ #define TEMP_SENSOR_6 0
#define TEMP_SENSOR_7 0
#define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_BED 1
// #define TEMP_SENSOR_CHAMBER 1 #define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0 #define TEMP_SENSOR_CHAMBER 0
// Dummy thermistor constant temperature readings, for use with 998 and 999 // Dummy thermistor constant temperature readings, for use with 998 and 999
@ -448,6 +445,8 @@
#define HEATER_3_MINTEMP 5 #define HEATER_3_MINTEMP 5
#define HEATER_4_MINTEMP 5 #define HEATER_4_MINTEMP 5
#define HEATER_5_MINTEMP 5 #define HEATER_5_MINTEMP 5
#define HEATER_6_MINTEMP 5
#define HEATER_7_MINTEMP 5
#define BED_MINTEMP 5 #define BED_MINTEMP 5
// Above this temperature the heater will be switched off. // Above this temperature the heater will be switched off.
@ -459,8 +458,9 @@
#define HEATER_3_MAXTEMP 275 #define HEATER_3_MAXTEMP 275
#define HEATER_4_MAXTEMP 275 #define HEATER_4_MAXTEMP 275
#define HEATER_5_MAXTEMP 275 #define HEATER_5_MAXTEMP 275
//@ #define HEATER_6_MAXTEMP 275
#define BED_MAXTEMP 125 #define HEATER_7_MAXTEMP 275
#define BED_MAXTEMP 150
//=========================================================================== //===========================================================================
//============================= PID Settings ================================ //============================= 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 // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
// Ultimaker // Ultimaker
// #define DEFAULT_Kp 22.2 #define DEFAULT_Kp 22.2
// #define DEFAULT_Ki 1.08 #define DEFAULT_Ki 1.08
// #define DEFAULT_Kd 114 #define DEFAULT_Kd 114
// MakerGear // MakerGear
//#define DEFAULT_Kp 7.0 //#define DEFAULT_Kp 7.0
@ -500,11 +500,6 @@
//#define DEFAULT_Ki 2.25 //#define DEFAULT_Ki 2.25
//#define DEFAULT_Kd 440 //#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 #endif // PIDTEMP
//=========================================================================== //===========================================================================
@ -542,9 +537,9 @@
//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //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) //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_bedKp 10.00
// #define DEFAULT_bedKi .023 #define DEFAULT_bedKi .023
// #define DEFAULT_bedKd 305.4 #define DEFAULT_bedKd 305.4
//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune //from pidautotune
@ -552,11 +547,6 @@
//#define DEFAULT_bedKi 1.41 //#define DEFAULT_bedKi 1.41
//#define DEFAULT_bedKd 1675.16 //#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. // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED #endif // PIDTEMPBED
@ -577,7 +567,7 @@
* Note: For Bowden Extruders make this large enough to allow load/unload. * Note: For Bowden Extruders make this large enough to allow load/unload.
*/ */
#define PREVENT_LENGTHY_EXTRUDE #define PREVENT_LENGTHY_EXTRUDE
#define EXTRUDE_MAXLENGTH 710 //@ maybe needed for filament loading #define EXTRUDE_MAXLENGTH 710
//=========================================================================== //===========================================================================
//======================== Thermal Runaway Protection ======================= //======================== Thermal Runaway Protection =======================
@ -608,7 +598,7 @@
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
// either in the usual order or reversed // either in the usual order or reversed
//#define COREXY //@ //#define COREXY
//#define COREXZ //#define COREXZ
//#define COREYZ //#define COREYZ
//#define COREYX //#define COREYX
@ -624,7 +614,6 @@
// Specify here all the endstop connectors that are connected to any endstop or probe. // 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 // 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. // 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_XMIN_PLUG
#define USE_YMIN_PLUG #define USE_YMIN_PLUG
#define USE_ZMIN_PLUG #define USE_ZMIN_PLUG
@ -659,7 +648,6 @@
#endif #endif
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). // 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 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 Y_MIN_ENDSTOP_INVERTING true// Set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define 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. * 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, * TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE, * TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_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 X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988 #define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988 #define Z_DRIVER_TYPE A4988
@ -691,12 +679,15 @@
//#define Y2_DRIVER_TYPE A4988 //#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988 //#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988 //#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988 #define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988 //#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988 //#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988 //#define E3_DRIVER_TYPE A4988
//#define E4_DRIVER_TYPE A4988 //#define E4_DRIVER_TYPE A4988
//#define E5_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. // 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. // 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) * Default Axis Steps Per Unit (steps/mm)
* Override with M92 * 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 } #define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 400 }
/** /**
* Default Max Feed Rate (mm/s) * Default Max Feed Rate (mm/s)
* Override with M203 * 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 DEFAULT_MAX_FEEDRATE { 200, 200, 4, 70 }
//#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2 //#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 * Default Max Acceleration (change/s) change = mm/s
* (Maximum start speed for accelerated moves) * (Maximum start speed for accelerated moves)
* Override with M201 * 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 DEFAULT_MAX_ACCELERATION { 1000, 1000, 100, 1000 }
//#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2 //#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 R Retract Acceleration
* M204 T Travel Acceleration * M204 T Travel Acceleration
*/ */
//@ keep speed reasonable
#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves #define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration for retracts #define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration for travel (non printing) moves #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 * Override with M205 X Y Z E
* *
* "Jerk" specifies the minimum speed change that requires acceleration. * "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. * value set here, it may happen instantaneously.
*/ */
//#define CLASSIC_JERK //#define CLASSIC_JERK
@ -798,6 +785,8 @@
#define DEFAULT_YJERK 10.0 #define DEFAULT_YJERK 10.0
#define DEFAULT_ZJERK 0.5 #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 //#define LIMITED_JERK_EDITING // Limit edit via M205 or LCD to DEFAULT_aJERK * 2
#if ENABLED(LIMITED_JERK_EDITING) #if ENABLED(LIMITED_JERK_EDITING)
#define MAX_JERK_EDIT_VALUES { 20, 20, 0.6, 10 } // ...or, set your own edit limits #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 * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained
*/ */
//@
#define S_CURVE_ACCELERATION #define S_CURVE_ACCELERATION
//=========================================================================== //===========================================================================
@ -874,9 +862,8 @@
* Use G29 repeatedly, adjusting the Z height at each point with movement commands * Use G29 repeatedly, adjusting the Z height at each point with movement commands
* or (with LCD_BED_LEVELING) the LCD controller. * or (with LCD_BED_LEVELING) the LCD controller.
*/ */
//@
#define PROBE_MANUALLY #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. * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
@ -884,6 +871,12 @@
*/ */
//#define FIX_MOUNTED_PROBE //#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. * Z Servo Probe, such as an endstop switch on a rotating arm.
*/ */
@ -967,11 +960,11 @@
*/ */
#define NOZZLE_TO_PROBE_OFFSET { 14, -40, 0 } #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 #define MIN_PROBE_EDGE 5
// X and Y axis travel speed (mm/m) between probes // X and Y axis travel speed (mm/m) between probes
//@
#define XY_PROBE_SPEED 1000 #define XY_PROBE_SPEED 1000
// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) // 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. * 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. * 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_BETWEEN_PROBES 3 // Z Clearance between probe points
#define Z_CLEARANCE_MULTI_PROBE 1 // Z Clearance between multiple probes #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 #define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping
@ -1065,7 +1058,6 @@
// @section machine // @section machine
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. // 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_X_DIR false
#define INVERT_Y_DIR false #define INVERT_Y_DIR false
#define INVERT_Z_DIR true #define INVERT_Z_DIR true
@ -1079,30 +1071,28 @@
#define INVERT_E3_DIR false #define INVERT_E3_DIR false
#define INVERT_E4_DIR false #define INVERT_E4_DIR false
#define INVERT_E5_DIR false #define INVERT_E5_DIR false
#define INVERT_E6_DIR false
#define INVERT_E7_DIR false
// @section homing // @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 Z_HOMING_HEIGHT 2 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
//#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. // 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, ... //#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing Z
// Be sure you have this distance over your Z_MAX_POS in case.
// Direction of endstops when homing; 1=MAX, -1=MIN // Direction of endstops when homing; 1=MAX, -1=MIN
// :[-1,1] // :[-1,1]
#define X_HOME_DIR -1 #define X_HOME_DIR -1
//@ home to Y-max
#define Y_HOME_DIR -1 #define Y_HOME_DIR -1
#define Z_HOME_DIR -1 #define Z_HOME_DIR -1
// @section machine // @section machine
//@
//@ my measurements
//@
// The size of the print bed // The size of the print bed
#define X_BED_SIZE 255 #define X_BED_SIZE 255
#define Y_BED_SIZE 210 #define Y_BED_SIZE 210
@ -1112,7 +1102,7 @@
#define Y_MIN_POS 0 #define Y_MIN_POS 0
#define Z_MIN_POS 0 #define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE #define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS 210 #define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 210 #define Z_MAX_POS 210
/** /**
@ -1152,7 +1142,7 @@
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
* By default the firmware assumes HIGH=FILAMENT PRESENT. * By default the firmware assumes HIGH=FILAMENT PRESENT.
*/ */
//#define FILAMENT_RUNOUT_SENSOR #define FILAMENT_RUNOUT_SENSOR
#if ENABLED(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 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. #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 * Normally G28 leaves leveling disabled on completion. Enable
* this option to have G28 restore the prior leveling state. * this option to have G28 restore the prior leveling state.
*/ */
//@
#define RESTORE_LEVELING_AFTER_G28 #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_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool.
#define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. #define MESH_TEST_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_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
#endif #endif
@ -1323,8 +1313,7 @@
* Add a bed leveling sub-menu for ABL or MBL. * Add a bed leveling sub-menu for ABL or MBL.
* Include a guided procedure if manual probing is enabled. * Include a guided procedure if manual probing is enabled.
*/ */
//@ #define LCD_BED_LEVELING
//#define LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING) #if ENABLED(LCD_BED_LEVELING)
#define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis.
@ -1333,7 +1322,6 @@
#endif #endif
// Add a menu item to move between bed corners for manual bed adjustment // Add a menu item to move between bed corners for manual bed adjustment
//@
#define LEVEL_BED_CORNERS #define LEVEL_BED_CORNERS
#if ENABLED(LEVEL_BED_CORNERS) #if ENABLED(LEVEL_BED_CORNERS)
@ -1378,7 +1366,6 @@
#endif #endif
// Homing speeds (mm/m) // Homing speeds (mm/m)
//@
#define HOMING_FEEDRATE_XY (50*50) #define HOMING_FEEDRATE_XY (50*50)
#define HOMING_FEEDRATE_Z (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_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
#if ENABLED(EEPROM_SETTINGS) #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. #define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
#endif #endif
@ -1475,11 +1466,6 @@
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating #define 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 // G20/G21 Inch mode support
// //
@ -1493,19 +1479,16 @@
// @section temperature // @section temperature
// Preheat Constants // Preheat Constants
//@
#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_LABEL "PLA"
#define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_HOTEND 180
#define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_TEMP_BED 60
#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255
//@
#define PREHEAT_2_LABEL "PETG" #define PREHEAT_2_LABEL "PETG"
#define PREHEAT_2_TEMP_HOTEND 235 #define PREHEAT_2_TEMP_HOTEND 235
#define PREHEAT_2_TEMP_BED 70 #define PREHEAT_2_TEMP_BED 70
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
/** /**
* Nozzle Park * Nozzle Park
* *
@ -1517,7 +1500,6 @@
* P1 Raise the nozzle always to Z-park height. * P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/ */
//@
#define NOZZLE_PARK_FEATURE #define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE) #if ENABLED(NOZZLE_PARK_FEATURE)
@ -1574,9 +1556,10 @@
// Default number of triangles // Default number of triangles
#define NOZZLE_CLEAN_TRIANGLES 3 #define NOZZLE_CLEAN_TRIANGLES 3
// Specify positions as { X, Y, Z } // Specify positions for each tool as { { X, Y, Z }, { X, Y, Z } }
#define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1) } // 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_END_POINT { 100, 60, (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 // Circular pattern radius
#define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5
@ -1679,9 +1662,7 @@
* you must uncomment the following option or it won't work. * you must uncomment the following option or it won't work.
* *
*/ */
//@
#define SDSUPPORT #define SDSUPPORT
#define SDIO_SUPPORT
/** /**
* SD CARD: SPI SPEED * SD CARD: SPI SPEED
@ -1698,7 +1679,6 @@
* *
* Use CRC checks and retries on the SD communication. * Use CRC checks and retries on the SD communication.
*/ */
//@
#define SD_CHECK_AND_RETRY #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. // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu.
// //
//@
#define INDIVIDUAL_AXIS_HOMING_MENU #define INDIVIDUAL_AXIS_HOMING_MENU
// //
@ -1834,7 +1813,7 @@
// //
// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller // 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 //#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602
@ -2001,20 +1980,26 @@
// FYSETC variant of the MINI12864 graphic controller with SD support // FYSETC variant of the MINI12864 graphic controller with SD support
// https://wiki.fysetc.com/Mini12864_Panel/ // 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_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_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_0 // Type A/B. Discreet RGB Backlight
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel 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 // 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. // 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) // (For CR-10 owners who want to replace the Melzi Creality board but retain the display)
// //
//#define CR10_STOCKDISPLAY //#define CR10_STOCKDISPLAY
//
// Ender-2 OEM display, a variant of the MKS_MINI_12864
//
//#define ENDER2_STOCKDISPLAY
// //
// ANET and Tronxy Graphical Controller // ANET and Tronxy Graphical Controller
// //
@ -2026,7 +2011,7 @@
// //
// AZSMZ 12864 LCD with SD // 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 //#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 // Touch-screen LCD for Malyan M200 printers
@ -2093,10 +2080,10 @@
//#define MALYAN_LCD //#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. // See Configuration_adv.h for all configuration options.
// //
//#define LULZBOT_TOUCH_UI //#define TOUCH_UI_FTDI_EVE
// //
// Third-party or vendor-customized controller interfaces. // Third-party or vendor-customized controller interfaces.
@ -2111,16 +2098,10 @@
// //
// FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.) // FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.)
// //
#define FSMC_GRAPHICAL_TFT
//@
//#define FSMC_GRAPHICAL_TFT
#if ENABLED(FSMC_GRAPHICAL_TFT) #if ENABLED(FSMC_GRAPHICAL_TFT)
// // #define FSMC_UPSCALE 2 //2x upscaler for 320x240 displays (default)
// FSMC_UPSCALE 2 2x upscaler for 320x240 displays (default) #define FSMC_UPSCALE 3 //3x upscaler for 480x320 displays
// FSMC_UPSCALE 3 3x upscaler for 480x320 displays
//
#define FSMC_UPSCALE 3
#endif #endif
//============================================================================= //=============================================================================
@ -2130,22 +2111,15 @@
// //
// ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8 // ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8
// //
//@ testing #define TOUCH_BUTTONS
//#define TOUCH_BUTTONS
#if ENABLED(TOUCH_BUTTONS) #if ENABLED(TOUCH_BUTTONS)
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens #define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus #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_CALIBRATION 12013
#define XPT2046_X_OFFSET -32 #define XPT2046_X_OFFSET -32
#define XPT2046_Y_CALIBRATION -8711 #define XPT2046_Y_CALIBRATION -8711
#define XPT2046_Y_OFFSET 256 #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 #endif
// //

596
Marlin/Configuration_adv.h

File diff suppressed because it is too large

12
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; extern u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, u8g_dev_uc1701_mini12864_HAL_2x_hw_spi;

787
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 <http://www.gnu.org/licenses/>.
*
*/
/*
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 <string.h>
#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

26
Marlin/src/lcd/dogm/ultralcd_DOGM.h

@ -174,7 +174,13 @@
// Unspecified 320x240 TFT pre-initialized by built-in bootloader // 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 #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
#else #else
@ -199,10 +205,20 @@
// LCD_FULL_PIXEL_WIDTH = // LCD_FULL_PIXEL_WIDTH =
// LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X // LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X
#if ENABLED(FSMC_GRAPHICAL_TFT) #if ENABLED(FSMC_GRAPHICAL_TFT)
#define LCD_FULL_PIXEL_WIDTH 320 // #define LCD_FULL_PIXEL_WIDTH 320
#define LCD_PIXEL_OFFSET_X 32 // #define LCD_PIXEL_OFFSET_X 32
#define LCD_FULL_PIXEL_HEIGHT 240 // #define LCD_FULL_PIXEL_HEIGHT 240
#define LCD_PIXEL_OFFSET_Y 32 // #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 #endif
// For selective rendering within a Y range // For selective rendering within a Y range

25
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h

@ -37,6 +37,10 @@
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
// //
#define DISABLE_DEBUG #define DISABLE_DEBUG
#undef JTAGSWD_DISABLE
//Case LED in instead E1
#define CASE_LED_INSTEAD_E1
// //
// Limit Switches // Limit Switches
@ -69,9 +73,13 @@
#define E0_STEP_PIN PD6 #define E0_STEP_PIN PD6
#define E0_DIR_PIN PD3 #define E0_DIR_PIN PD3
#define E1_ENABLE_PIN PA3 #ifdef CASE_LED_INSTEAD_E1
#define E1_STEP_PIN PA6 #define LED_CASE_PIN PA3
#define E1_DIR_PIN PA1 #else
#define E1_ENABLE_PIN PA3
#define E1_STEP_PIN PA6
#define E1_DIR_PIN PA1
#endif
// //
// Temperature Sensors // Temperature Sensors
@ -99,7 +107,10 @@
// Misc. Functions // Misc. Functions
// //
#define POWER_LOSS_PIN PA2 // PW_DET #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 #define LED_PIN PB2
@ -123,9 +134,13 @@
#define FSMC_CS_PIN PD7 // NE4 #define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0 #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 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 #define LCD_BACKLIGHT_PIN PD13
#if ENABLED(TOUCH_BUTTONS) #if ENABLED(TOUCH_BUTTONS)

4
jlink.cmd

@ -0,0 +1,4 @@
r
loadbin ./.pio/build/mks_robin_nano/firmware.bin 0x08007000
rnh
q

240
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) {
//}

28
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"
Loading…
Cancel
Save