Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x
This commit is contained in:
+16
-16
@@ -58,18 +58,13 @@
|
||||
*/
|
||||
|
||||
//===========================================================================
|
||||
//============================= DELTA Printer ===============================
|
||||
//========================== DELTA / SCARA / TPARA ==========================
|
||||
//===========================================================================
|
||||
// For a Delta printer, start with one of the configuration files in the config/examples/delta directory
|
||||
// from https://github.com/MarlinFirmware/Configurations/branches/all and customize for your machine.
|
||||
//
|
||||
|
||||
//===========================================================================
|
||||
//============================= SCARA Printer ===============================
|
||||
//===========================================================================
|
||||
// For a SCARA printer, start with one of the configuration files in the config/examples/SCARA directory
|
||||
// from https://github.com/MarlinFirmware/Configurations/branches/all and customize for your machine.
|
||||
// Download configurations from the link above and customize for your machine.
|
||||
// Examples are located in config/examples/delta, .../SCARA, and .../TPARA.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
// @section info
|
||||
|
||||
@@ -168,8 +163,8 @@
|
||||
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
|
||||
* PRUSA_MMU2 : Průša MMU2
|
||||
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
|
||||
* SMUFF_EMU_MMU2 : Technik Gegg SMUFF (Průša MMU2 emulation mode)
|
||||
* SMUFF_EMU_MMU2S : Technik Gegg SMUFF (Průša MMU2S emulation mode)
|
||||
* SMUFF_EMU_MMU2 : Technik Gegg SMuFF (Průša MMU2 emulation mode)
|
||||
* SMUFF_EMU_MMU2S : Technik Gegg SMuFF (Průša MMU2S emulation mode)
|
||||
*
|
||||
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
|
||||
* See additional options in Configuration_adv.h.
|
||||
@@ -1047,13 +1042,13 @@
|
||||
#define PROBING_MARGIN 10
|
||||
|
||||
// X and Y axis travel speed (mm/min) between probes
|
||||
#define XY_PROBE_SPEED (133*60)
|
||||
#define XY_PROBE_FEEDRATE (133*60)
|
||||
|
||||
// Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2)
|
||||
#define Z_PROBE_SPEED_FAST (4*60)
|
||||
#define Z_PROBE_FEEDRATE_FAST (4*60)
|
||||
|
||||
// Feedrate (mm/min) for the "accurate" probe of each point
|
||||
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
|
||||
#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 2)
|
||||
|
||||
/**
|
||||
* Probe Activation Switch
|
||||
@@ -1278,6 +1273,8 @@
|
||||
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
|
||||
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
|
||||
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
|
||||
//#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder.
|
||||
// This is automatically enabled for MIXING_EXTRUDERs.
|
||||
|
||||
// Override individually if the runout sensors vary
|
||||
//#define FIL_RUNOUT1_STATE LOW
|
||||
@@ -1312,8 +1309,9 @@
|
||||
//#define FIL_RUNOUT8_PULLUP
|
||||
//#define FIL_RUNOUT8_PULLDOWN
|
||||
|
||||
// Set one or more commands to execute on filament runout.
|
||||
// (After 'M412 H' Marlin will ask the host to handle the process.)
|
||||
// Commands to execute on filament runout.
|
||||
// With multiple runout sensors use the %c placeholder for the current tool in commands (e.g., "M600 T%c")
|
||||
// NOTE: After 'M412 H1' the host handles filament runout and this script does not apply.
|
||||
#define FILAMENT_RUNOUT_SCRIPT "M600"
|
||||
|
||||
// After a runout is detected, continue printing this length of filament
|
||||
@@ -2349,6 +2347,7 @@
|
||||
//#define DGUS_LCD_UI_ORIGIN
|
||||
//#define DGUS_LCD_UI_FYSETC
|
||||
//#define DGUS_LCD_UI_HIPRECY
|
||||
//#define DGUS_LCD_UI_MKS
|
||||
|
||||
//
|
||||
// Touch-screen LCD for Malyan M200/M300 printers
|
||||
@@ -2650,6 +2649,7 @@
|
||||
// Use a single NeoPixel LED for static (background) lighting
|
||||
//#define NEOPIXEL_BKGD_LED_INDEX 0 // Index of the LED to use
|
||||
//#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
|
||||
//#define NEOPIXEL_BKGD_ALWAYS_ON // Keep the backlight on when other NeoPixels are off
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
+166
-123
@@ -519,12 +519,17 @@
|
||||
#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_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting.
|
||||
//#define CASE_LIGHT_MAX_PWM 128 // Limit PWM duty cycle (0-255)
|
||||
//#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.
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White }
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
//#define CASE_LIGHT_USE_NEOPIXEL // Use NeoPixel LED as case light
|
||||
#endif
|
||||
#if EITHER(RGB_LED, RGBW_LED)
|
||||
//#define CASE_LIGHT_USE_RGB_LED // Use RGB / RGBW LED as case light
|
||||
#endif
|
||||
#if EITHER(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED)
|
||||
#define CASE_LIGHT_DEFAULT_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -924,7 +929,7 @@
|
||||
// increments while checking for the contact to be broken.
|
||||
#define BACKLASH_MEASUREMENT_LIMIT 0.5 // (mm)
|
||||
#define BACKLASH_MEASUREMENT_RESOLUTION 0.005 // (mm)
|
||||
#define BACKLASH_MEASUREMENT_FEEDRATE Z_PROBE_SPEED_SLOW // (mm/min)
|
||||
#define BACKLASH_MEASUREMENT_FEEDRATE Z_PROBE_FEEDRATE_SLOW // (mm/min)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -1251,7 +1256,6 @@
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
|
||||
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
|
||||
//#define POWER_LOSS_RECOVER_ZHOME // Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
|
||||
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
|
||||
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
|
||||
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
||||
@@ -1263,6 +1267,12 @@
|
||||
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
|
||||
// especially with "vase mode" printing. Set too high and vases cannot be continued.
|
||||
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data
|
||||
|
||||
// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
|
||||
//#define POWER_LOSS_RECOVER_ZHOME
|
||||
#if ENABLED(POWER_LOSS_RECOVER_ZHOME)
|
||||
//#define POWER_LOSS_ZHOME_POS { 0, 0 } // Safe XY position to home Z while avoiding objects on the bed
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1512,12 +1522,12 @@
|
||||
|
||||
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
|
||||
|
||||
#if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
|
||||
#if ANY(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_MKS, DGUS_LCD_UI_HIPRECY)
|
||||
#define DGUS_PRINT_FILENAME // Display the filename during printing
|
||||
#define DGUS_PREHEAT_UI // Display a preheat screen during heatup
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
//#define DGUS_UI_MOVE_DIS_OPTION // Disabled by default for UI_FYSETC
|
||||
#if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_MKS)
|
||||
//#define DGUS_UI_MOVE_DIS_OPTION // Disabled by default for FYSETC and MKS
|
||||
#else
|
||||
#define DGUS_UI_MOVE_DIS_OPTION // Enabled by default for UI_HIPRECY
|
||||
#endif
|
||||
@@ -1560,6 +1570,8 @@
|
||||
//#define LCD_HAOYU_FT810CB // Haoyu with 5" (800x480)
|
||||
//#define LCD_ALEPHOBJECTS_CLCD_UI // Aleph Objects Color LCD UI
|
||||
//#define LCD_FYSETC_TFT81050 // FYSETC with 5" (800x480)
|
||||
//#define LCD_EVE3_50G // Matrix Orbital 5.0", 800x480, BT815
|
||||
//#define LCD_EVE2_50G // Matrix Orbital 5.0", 800x480, FT813
|
||||
|
||||
// Correct the resolution if not using the stock TFT panel.
|
||||
//#define TOUCH_UI_320x240
|
||||
@@ -2237,7 +2249,7 @@
|
||||
#if AXIS_DRIVER_TYPE_X2(TMC26X)
|
||||
#define X2_MAX_CURRENT 1000
|
||||
#define X2_SENSE_RESISTOR 91
|
||||
#define X2_MICROSTEPS 16
|
||||
#define X2_MICROSTEPS X_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(TMC26X)
|
||||
@@ -2249,7 +2261,7 @@
|
||||
#if AXIS_DRIVER_TYPE_Y2(TMC26X)
|
||||
#define Y2_MAX_CURRENT 1000
|
||||
#define Y2_SENSE_RESISTOR 91
|
||||
#define Y2_MICROSTEPS 16
|
||||
#define Y2_MICROSTEPS Y_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(TMC26X)
|
||||
@@ -2261,19 +2273,19 @@
|
||||
#if AXIS_DRIVER_TYPE_Z2(TMC26X)
|
||||
#define Z2_MAX_CURRENT 1000
|
||||
#define Z2_SENSE_RESISTOR 91
|
||||
#define Z2_MICROSTEPS 16
|
||||
#define Z2_MICROSTEPS Z_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(TMC26X)
|
||||
#define Z3_MAX_CURRENT 1000
|
||||
#define Z3_SENSE_RESISTOR 91
|
||||
#define Z3_MICROSTEPS 16
|
||||
#define Z3_MICROSTEPS Z_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z4(TMC26X)
|
||||
#define Z4_MAX_CURRENT 1000
|
||||
#define Z4_SENSE_RESISTOR 91
|
||||
#define Z4_MICROSTEPS 16
|
||||
#define Z4_MICROSTEPS Z_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E0(TMC26X)
|
||||
@@ -2285,43 +2297,43 @@
|
||||
#if AXIS_DRIVER_TYPE_E1(TMC26X)
|
||||
#define E1_MAX_CURRENT 1000
|
||||
#define E1_SENSE_RESISTOR 91
|
||||
#define E1_MICROSTEPS 16
|
||||
#define E1_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(TMC26X)
|
||||
#define E2_MAX_CURRENT 1000
|
||||
#define E2_SENSE_RESISTOR 91
|
||||
#define E2_MICROSTEPS 16
|
||||
#define E2_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(TMC26X)
|
||||
#define E3_MAX_CURRENT 1000
|
||||
#define E3_SENSE_RESISTOR 91
|
||||
#define E3_MICROSTEPS 16
|
||||
#define E3_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(TMC26X)
|
||||
#define E4_MAX_CURRENT 1000
|
||||
#define E4_SENSE_RESISTOR 91
|
||||
#define E4_MICROSTEPS 16
|
||||
#define E4_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(TMC26X)
|
||||
#define E5_MAX_CURRENT 1000
|
||||
#define E5_SENSE_RESISTOR 91
|
||||
#define E5_MICROSTEPS 16
|
||||
#define E5_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E6(TMC26X)
|
||||
#define E6_MAX_CURRENT 1000
|
||||
#define E6_SENSE_RESISTOR 91
|
||||
#define E6_MICROSTEPS 16
|
||||
#define E6_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E7(TMC26X)
|
||||
#define E7_MAX_CURRENT 1000
|
||||
#define E7_SENSE_RESISTOR 91
|
||||
#define E7_MICROSTEPS 16
|
||||
#define E7_MICROSTEPS E0_MICROSTEPS
|
||||
#endif
|
||||
|
||||
#endif // TMC26X
|
||||
@@ -2366,7 +2378,7 @@
|
||||
#if AXIS_IS_TMC(X2)
|
||||
#define X2_CURRENT 800
|
||||
#define X2_CURRENT_HOME X2_CURRENT
|
||||
#define X2_MICROSTEPS 16
|
||||
#define X2_MICROSTEPS X_MICROSTEPS
|
||||
#define X2_RSENSE 0.11
|
||||
#define X2_CHAIN_POS -1
|
||||
//#define X2_INTERPOLATE true
|
||||
@@ -2384,7 +2396,7 @@
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
#define Y2_CURRENT 800
|
||||
#define Y2_CURRENT_HOME Y2_CURRENT
|
||||
#define Y2_MICROSTEPS 16
|
||||
#define Y2_MICROSTEPS Y_MICROSTEPS
|
||||
#define Y2_RSENSE 0.11
|
||||
#define Y2_CHAIN_POS -1
|
||||
//#define Y2_INTERPOLATE true
|
||||
@@ -2402,7 +2414,7 @@
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
#define Z2_CURRENT 800
|
||||
#define Z2_CURRENT_HOME Z2_CURRENT
|
||||
#define Z2_MICROSTEPS 16
|
||||
#define Z2_MICROSTEPS Z_MICROSTEPS
|
||||
#define Z2_RSENSE 0.11
|
||||
#define Z2_CHAIN_POS -1
|
||||
//#define Z2_INTERPOLATE true
|
||||
@@ -2411,7 +2423,7 @@
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
#define Z3_CURRENT 800
|
||||
#define Z3_CURRENT_HOME Z3_CURRENT
|
||||
#define Z3_MICROSTEPS 16
|
||||
#define Z3_MICROSTEPS Z_MICROSTEPS
|
||||
#define Z3_RSENSE 0.11
|
||||
#define Z3_CHAIN_POS -1
|
||||
//#define Z3_INTERPOLATE true
|
||||
@@ -2420,7 +2432,7 @@
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
#define Z4_CURRENT 800
|
||||
#define Z4_CURRENT_HOME Z4_CURRENT
|
||||
#define Z4_MICROSTEPS 16
|
||||
#define Z4_MICROSTEPS Z_MICROSTEPS
|
||||
#define Z4_RSENSE 0.11
|
||||
#define Z4_CHAIN_POS -1
|
||||
//#define Z4_INTERPOLATE true
|
||||
@@ -2436,7 +2448,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E1)
|
||||
#define E1_CURRENT 800
|
||||
#define E1_MICROSTEPS 16
|
||||
#define E1_MICROSTEPS E0_MICROSTEPS
|
||||
#define E1_RSENSE 0.11
|
||||
#define E1_CHAIN_POS -1
|
||||
//#define E1_INTERPOLATE true
|
||||
@@ -2444,7 +2456,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E2)
|
||||
#define E2_CURRENT 800
|
||||
#define E2_MICROSTEPS 16
|
||||
#define E2_MICROSTEPS E0_MICROSTEPS
|
||||
#define E2_RSENSE 0.11
|
||||
#define E2_CHAIN_POS -1
|
||||
//#define E2_INTERPOLATE true
|
||||
@@ -2452,7 +2464,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E3)
|
||||
#define E3_CURRENT 800
|
||||
#define E3_MICROSTEPS 16
|
||||
#define E3_MICROSTEPS E0_MICROSTEPS
|
||||
#define E3_RSENSE 0.11
|
||||
#define E3_CHAIN_POS -1
|
||||
//#define E3_INTERPOLATE true
|
||||
@@ -2460,7 +2472,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E4)
|
||||
#define E4_CURRENT 800
|
||||
#define E4_MICROSTEPS 16
|
||||
#define E4_MICROSTEPS E0_MICROSTEPS
|
||||
#define E4_RSENSE 0.11
|
||||
#define E4_CHAIN_POS -1
|
||||
//#define E4_INTERPOLATE true
|
||||
@@ -2468,7 +2480,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E5)
|
||||
#define E5_CURRENT 800
|
||||
#define E5_MICROSTEPS 16
|
||||
#define E5_MICROSTEPS E0_MICROSTEPS
|
||||
#define E5_RSENSE 0.11
|
||||
#define E5_CHAIN_POS -1
|
||||
//#define E5_INTERPOLATE true
|
||||
@@ -2476,7 +2488,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E6)
|
||||
#define E6_CURRENT 800
|
||||
#define E6_MICROSTEPS 16
|
||||
#define E6_MICROSTEPS E0_MICROSTEPS
|
||||
#define E6_RSENSE 0.11
|
||||
#define E6_CHAIN_POS -1
|
||||
//#define E6_INTERPOLATE true
|
||||
@@ -2484,7 +2496,7 @@
|
||||
|
||||
#if AXIS_IS_TMC(E7)
|
||||
#define E7_CURRENT 800
|
||||
#define E7_MICROSTEPS 16
|
||||
#define E7_MICROSTEPS E0_MICROSTEPS
|
||||
#define E7_RSENSE 0.11
|
||||
#define E7_CHAIN_POS -1
|
||||
//#define E7_INTERPOLATE true
|
||||
@@ -2759,138 +2771,138 @@
|
||||
#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
|
||||
#define X2_MICROSTEPS X_MICROSTEPS
|
||||
#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_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
|
||||
#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_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
|
||||
#define Y2_MICROSTEPS Y_MICROSTEPS
|
||||
#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_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
|
||||
#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_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
|
||||
#define Z2_MICROSTEPS Z_MICROSTEPS
|
||||
#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_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
|
||||
#define Z3_MICROSTEPS Z_MICROSTEPS
|
||||
#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
|
||||
#define Z4_MICROSTEPS Z_MICROSTEPS
|
||||
#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_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
|
||||
#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_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
|
||||
#define E1_MICROSTEPS E0_MICROSTEPS
|
||||
#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_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
|
||||
#define E2_MICROSTEPS E0_MICROSTEPS
|
||||
#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_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
|
||||
#define E3_MICROSTEPS E0_MICROSTEPS
|
||||
#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_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
|
||||
#define E4_MICROSTEPS E0_MICROSTEPS
|
||||
#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_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
|
||||
#define E5_MICROSTEPS E0_MICROSTEPS
|
||||
#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
|
||||
#define E6_MICROSTEPS E0_MICROSTEPS
|
||||
#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
|
||||
#define E7_MICROSTEPS E0_MICROSTEPS
|
||||
#define E7_OVERCURRENT 2000
|
||||
#define E7_STALLCURRENT 1500
|
||||
#define E7_MAX_VOLTAGE 127
|
||||
#define E7_CHAIN_POS -1
|
||||
#define E7_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -3357,6 +3369,37 @@
|
||||
#define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro
|
||||
#endif
|
||||
|
||||
/**
|
||||
* User-defined buttons to run custom G-code.
|
||||
* Up to 25 may be defined.
|
||||
*/
|
||||
//#define CUSTOM_USER_BUTTONS
|
||||
#if ENABLED(CUSTOM_USER_BUTTONS)
|
||||
//#define BUTTON1_PIN -1
|
||||
#if PIN_EXISTS(BUTTON1_PIN)
|
||||
#define BUTTON1_HIT_STATE LOW // State of the triggered button. NC=LOW. NO=HIGH.
|
||||
#define BUTTON1_WHEN_PRINTING false // Button allowed to trigger during printing?
|
||||
#define BUTTON1_GCODE "G28"
|
||||
#define BUTTON1_DESC "Homing" // Optional string to set the LCD status
|
||||
#endif
|
||||
|
||||
//#define BUTTON2_PIN -1
|
||||
#if PIN_EXISTS(BUTTON2_PIN)
|
||||
#define BUTTON2_HIT_STATE LOW
|
||||
#define BUTTON2_WHEN_PRINTING false
|
||||
#define BUTTON2_GCODE "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
|
||||
#define BUTTON2_DESC "Preheat for " PREHEAT_1_LABEL
|
||||
#endif
|
||||
|
||||
//#define BUTTON3_PIN -1
|
||||
#if PIN_EXISTS(BUTTON3_PIN)
|
||||
#define BUTTON3_HIT_STATE LOW
|
||||
#define BUTTON3_WHEN_PRINTING false
|
||||
#define BUTTON3_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
|
||||
#define BUTTON3_DESC "Preheat for " PREHEAT_2_LABEL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* User-defined menu items to run custom G-code.
|
||||
* Up to 25 may be defined, but the actual number is LCD-dependent.
|
||||
|
||||
@@ -83,14 +83,13 @@ bool PersistentStore::access_finish() {
|
||||
static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
|
||||
PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
|
||||
SERIAL_CHAR(' ');
|
||||
serialprintPGM(rw_str);
|
||||
SERIAL_ECHOPGM_P(rw_str);
|
||||
SERIAL_ECHOLNPAIR("_data(", pos, ",", value, ",", size, ", ...)");
|
||||
if (total) {
|
||||
SERIAL_ECHOPGM(" f_");
|
||||
serialprintPGM(rw_str);
|
||||
SERIAL_ECHOPGM_P(rw_str);
|
||||
SERIAL_ECHOPAIR("()=", s, "\n size=", size, "\n bytes_");
|
||||
serialprintPGM(write ? PSTR("written=") : PSTR("read="));
|
||||
SERIAL_ECHOLN(total);
|
||||
SERIAL_ECHOLNPAIR_P(write ? PSTR("written=") : PSTR("read="), total);
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPAIR(" f_lseek()=", s);
|
||||
|
||||
@@ -30,6 +30,5 @@
|
||||
// LPC1768 boards seem to lose steps when saving to EEPROM during print (issue #20785)
|
||||
// TODO: Which other boards are incompatible?
|
||||
#if defined(MCU_LPC1768) && PRINTCOUNTER_SAVE_INTERVAL > 0
|
||||
#warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
|
||||
#define PRINTCOUNTER_SYNC 1
|
||||
#endif
|
||||
|
||||
@@ -8,9 +8,7 @@ from __future__ import print_function
|
||||
target_filename = "FIRMWARE.CUR"
|
||||
target_drive = "REARM"
|
||||
|
||||
import os
|
||||
import getpass
|
||||
import platform
|
||||
import os,getpass,platform
|
||||
|
||||
current_OS = platform.system()
|
||||
Import("env")
|
||||
@@ -33,9 +31,8 @@ try:
|
||||
#
|
||||
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
|
||||
# Windows - doesn't care about the disk's name, only cares about the drive letter
|
||||
import subprocess
|
||||
import subprocess,string
|
||||
from ctypes import windll
|
||||
import string
|
||||
|
||||
# getting list of drives
|
||||
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
|
||||
|
||||
@@ -50,3 +50,7 @@
|
||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
||||
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on SAMD51."
|
||||
#endif
|
||||
|
||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||
#error "POSTMORTEM_DEBUGGING is not yet supported on AGCM4."
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
|
||||
void HAL_init() {
|
||||
FastIO_init();
|
||||
|
||||
// Ensure F_CPU is a constant expression.
|
||||
// Ensure F_CPU is a constant expression.
|
||||
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
|
||||
// So better safe than sorry here.
|
||||
constexpr int cpuFreq = F_CPU;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "stm32_def.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
|
||||
#include "src/core/debug_out.h"
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||
|
||||
@@ -207,12 +207,12 @@ void TFT_SPI::Transmit(uint16_t Data) {
|
||||
while ((SPIx.Instance->SR & SPI_FLAG_BSY) == SPI_FLAG_BSY) {}
|
||||
|
||||
if (TFT_MISO_PIN != TFT_MOSI_PIN)
|
||||
__HAL_SPI_CLEAR_OVRFLAG(&SPIx); /* Clear overrun flag in 2 Lines communication mode because received is not read */
|
||||
__HAL_SPI_CLEAR_OVRFLAG(&SPIx); // Clear overrun flag in 2 Lines communication mode because received is not read
|
||||
}
|
||||
|
||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||
// Wait last dma finish, to start another
|
||||
while(isBusy()) { }
|
||||
while (isBusy()) { /* nada */ }
|
||||
|
||||
DMAtx.Init.MemInc = MemoryIncrease;
|
||||
HAL_DMA_Init(&DMAtx);
|
||||
@@ -225,7 +225,7 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
|
||||
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count);
|
||||
__HAL_SPI_ENABLE(&SPIx);
|
||||
|
||||
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
|
||||
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
|
||||
|
||||
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||
Abort();
|
||||
|
||||
@@ -109,11 +109,11 @@
|
||||
void dump_delay_accuracy_check() {
|
||||
auto report_call_time = [](PGM_P const name, PGM_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) {
|
||||
SERIAL_ECHOPGM("Calling ");
|
||||
serialprintPGM(name);
|
||||
SERIAL_ECHOPGM_P(name);
|
||||
SERIAL_ECHOLNPAIR(" for ", cycles);
|
||||
serialprintPGM(unit);
|
||||
SERIAL_ECHOPGM_P(unit);
|
||||
SERIAL_ECHOLNPAIR(" took: ", total);
|
||||
serialprintPGM(unit);
|
||||
SERIAL_ECHOPGM_P(unit);
|
||||
if (do_flush) SERIAL_FLUSHTX();
|
||||
};
|
||||
|
||||
@@ -169,10 +169,7 @@
|
||||
|
||||
void calibrate_delay_loop() {}
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
void dump_delay_accuracy_check() {
|
||||
static PGMSTR(none, "N/A on this platform");
|
||||
serialprintPGM(none);
|
||||
}
|
||||
void dump_delay_accuracy_check() { SERIAL_ECHOPGM_P(PSTR("N/A on this platform")); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -283,7 +283,7 @@ void CommonHandler_C(ContextStateFrame * frame, unsigned long lr, unsigned long
|
||||
savedFrame.CFSR = 0;
|
||||
|
||||
frame->pc = (uint32_t)resume_from_fault; // Patch where to return to
|
||||
frame->lr = 0xdeadbeef; // If our handler returns (it shouldn't), let's make it trigger an exception immediately
|
||||
frame->lr = 0xDEADBEEF; // If our handler returns (it shouldn't), let's make it trigger an exception immediately
|
||||
frame->xpsr = _BV(24); // Need to clean the PSR register to thumb II only
|
||||
MinSerial::force_using_default_output = true;
|
||||
return; // The CPU will resume in our handler hopefully, and we'll try to use default serial output
|
||||
|
||||
@@ -32,7 +32,13 @@
|
||||
#include "eeprom_if.h"
|
||||
#include <Wire.h>
|
||||
|
||||
void eeprom_init() { Wire.begin(); }
|
||||
void eeprom_init() {
|
||||
Wire.begin(
|
||||
#if PINS_EXIST(I2C_SCL, I2C_SDA)
|
||||
uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#if ENABLED(USE_SHARED_EEPROM)
|
||||
|
||||
|
||||
+196
-18
@@ -231,6 +231,10 @@
|
||||
#include "feature/password/password.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "lcd/extui/lib/dgus/DGUSScreenHandler.h"
|
||||
#endif
|
||||
|
||||
PGMSTR(M112_KILL_STR, "M112 Shutdown");
|
||||
|
||||
MarlinState marlin_state = MF_INITIALIZING;
|
||||
@@ -388,6 +392,7 @@ void startOrResumeJob() {
|
||||
if (queue.enqueue_one_P(PSTR("M1001"))) {
|
||||
marlin_state = MF_RUNNING;
|
||||
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
|
||||
TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,6 +406,7 @@ void startOrResumeJob() {
|
||||
* - Check if CHDK_PIN needs to go LOW
|
||||
* - Check for KILL button held down
|
||||
* - Check for HOME button held down
|
||||
* - Check for CUSTOM USER button held down
|
||||
* - Check if cooling fan needs to be switched on
|
||||
* - Check if an idle but hot extruder needs filament extruded (EXTRUDER_RUNOUT_PREVENT)
|
||||
* - Pulse FET_SAFETY_PIN if it exists
|
||||
@@ -493,6 +499,102 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(CUSTOM_USER_BUTTONS)
|
||||
// Handle a custom user button if defined
|
||||
const bool printer_not_busy = !printingIsActive();
|
||||
#define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE) && defined(BUTTON##N##_DESC))
|
||||
#define CHECK_CUSTOM_USER_BUTTON(N) do{ \
|
||||
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 250UL; \
|
||||
static millis_t next_cub_ms_##N; \
|
||||
if (BUTTON##N##_HIT_STATE == READ(BUTTON##N##_PIN) \
|
||||
&& (ENABLED(BUTTON##N##_WHEN_PRINTING) || printer_not_busy)) { \
|
||||
const millis_t ms = millis(); \
|
||||
if (ELAPSED(ms, next_cub_ms_##N)) { \
|
||||
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
|
||||
if (strlen(BUTTON##N##_DESC)) \
|
||||
LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC)); \
|
||||
queue.inject_P(PSTR(BUTTON##N##_GCODE)); \
|
||||
} \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#if HAS_CUSTOM_USER_BUTTON(1)
|
||||
CHECK_CUSTOM_USER_BUTTON(1);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(2)
|
||||
CHECK_CUSTOM_USER_BUTTON(2);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(3)
|
||||
CHECK_CUSTOM_USER_BUTTON(3);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(4)
|
||||
CHECK_CUSTOM_USER_BUTTON(4);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(5)
|
||||
CHECK_CUSTOM_USER_BUTTON(5);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(6)
|
||||
CHECK_CUSTOM_USER_BUTTON(6);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(7)
|
||||
CHECK_CUSTOM_USER_BUTTON(7);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(8)
|
||||
CHECK_CUSTOM_USER_BUTTON(8);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(9)
|
||||
CHECK_CUSTOM_USER_BUTTON(9);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(10)
|
||||
CHECK_CUSTOM_USER_BUTTON(10);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(11)
|
||||
CHECK_CUSTOM_USER_BUTTON(11);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(12)
|
||||
CHECK_CUSTOM_USER_BUTTON(12);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(13)
|
||||
CHECK_CUSTOM_USER_BUTTON(13);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(14)
|
||||
CHECK_CUSTOM_USER_BUTTON(14);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(15)
|
||||
CHECK_CUSTOM_USER_BUTTON(15);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(16)
|
||||
CHECK_CUSTOM_USER_BUTTON(16);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(17)
|
||||
CHECK_CUSTOM_USER_BUTTON(17);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(18)
|
||||
CHECK_CUSTOM_USER_BUTTON(18);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(19)
|
||||
CHECK_CUSTOM_USER_BUTTON(19);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(20)
|
||||
CHECK_CUSTOM_USER_BUTTON(20);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(21)
|
||||
CHECK_CUSTOM_USER_BUTTON(21);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(22)
|
||||
CHECK_CUSTOM_USER_BUTTON(22);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(23)
|
||||
CHECK_CUSTOM_USER_BUTTON(23);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(24)
|
||||
CHECK_CUSTOM_USER_BUTTON(24);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(25)
|
||||
CHECK_CUSTOM_USER_BUTTON(25);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TERN_(USE_CONTROLLER_FAN, controllerFan.update()); // Check if fan should be turned on to cool stepper drivers down
|
||||
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.check());
|
||||
@@ -852,7 +954,7 @@ inline void tmc_standby_setup() {
|
||||
|
||||
/**
|
||||
* Marlin entry-point: Set up before the program loop
|
||||
* - Set up the kill pin, filament runout, power hold
|
||||
* - Set up the kill pin, filament runout, power hold, custom user buttons
|
||||
* - Start the serial port
|
||||
* - Print startup messages and diagnostics
|
||||
* - Get EEPROM or default settings
|
||||
@@ -880,8 +982,7 @@ void setup() {
|
||||
auto log_current_ms = [&](PGM_P const msg) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHOPGM("] ");
|
||||
serialprintPGM(msg);
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNPGM_P(msg);
|
||||
};
|
||||
#define SETUP_LOG(M) log_current_ms(PSTR(M))
|
||||
#else
|
||||
@@ -915,12 +1016,6 @@ void setup() {
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
SETUP_LOG("PSU_CONTROL");
|
||||
powersupply_on = ENABLED(PSU_DEFAULT_OFF);
|
||||
if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
|
||||
#endif
|
||||
|
||||
#if EITHER(DISABLE_DEBUG, DISABLE_JTAG)
|
||||
// Disable any hardware debug to free up pins for IO
|
||||
#if ENABLED(DISABLE_DEBUG) && defined(JTAGSWD_DISABLE)
|
||||
@@ -951,10 +1046,6 @@ void setup() {
|
||||
OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers
|
||||
#endif
|
||||
|
||||
#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
|
||||
OUT_WRITE(SMART_EFFECTOR_MOD_PIN, LOW); // Put Smart Effector into NORMAL mode
|
||||
#endif
|
||||
@@ -963,10 +1054,20 @@ void setup() {
|
||||
SETUP_RUN(runout.setup());
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
SETUP_LOG("PSU_CONTROL");
|
||||
powersupply_on = ENABLED(PSU_DEFAULT_OFF);
|
||||
if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
SETUP_RUN(recovery.setup());
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers
|
||||
#endif
|
||||
|
||||
#if HAS_TMC220x
|
||||
SETUP_RUN(tmc_serial_begin());
|
||||
#endif
|
||||
@@ -998,7 +1099,7 @@ void setup() {
|
||||
if (mcu & RST_SOFTWARE) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET);
|
||||
HAL_clear_reset_source();
|
||||
|
||||
serialprintPGM(GET_TEXT(MSG_MARLIN));
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_MARLIN));
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION);
|
||||
SERIAL_EOL();
|
||||
@@ -1127,6 +1228,86 @@ void setup() {
|
||||
SET_INPUT_PULLUP(HOME_PIN);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CUSTOM_USER_BUTTONS)
|
||||
#define INIT_CUSTOM_USER_BUTTON_PIN(N) do{ SET_INPUT(BUTTON##N##_PIN); WRITE(BUTTON##N##_PIN, !BUTTON##N##_HIT_STATE); }while(0)
|
||||
|
||||
#if HAS_CUSTOM_USER_BUTTON(1)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(1);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(2)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(2);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(3)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(3);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(4)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(4);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(5)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(5);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(6)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(6);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(7)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(7);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(8)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(8);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(9)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(9);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(10)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(10);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(11)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(11);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(12)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(12);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(13)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(13);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(14)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(14);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(15)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(15);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(16)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(16);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(17)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(17);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(18)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(18);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(19)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(19);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(20)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(20);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(21)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(21);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(22)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(22);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(23)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(23);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(24)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(24);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(25)
|
||||
INIT_CUSTOM_USER_BUTTON_PIN(25);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(STAT_LED_RED)
|
||||
OUT_WRITE(STAT_LED_RED_PIN, LOW); // OFF
|
||||
#endif
|
||||
@@ -1136,10 +1317,7 @@ void setup() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#if DISABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
if (PWM_PIN(CASE_LIGHT_PIN)) SET_PWM(CASE_LIGHT_PIN); else SET_OUTPUT(CASE_LIGHT_PIN);
|
||||
#endif
|
||||
SETUP_RUN(caselight.update_brightness());
|
||||
SETUP_RUN(caselight.init());
|
||||
#endif
|
||||
|
||||
#if HAS_PRUSA_MMU1
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "debug_section.h"
|
||||
#define DEBUG_SECTION(N,S,D) SectionLog N(PSTR(S),D)
|
||||
|
||||
#define DEBUG_PRINT_P(P) serialprintPGM(P)
|
||||
#define DEBUG_ECHOPGM_P(P) SERIAL_ECHOPGM_P(P)
|
||||
#define DEBUG_ECHO_START SERIAL_ECHO_START
|
||||
#define DEBUG_ERROR_START SERIAL_ERROR_START
|
||||
#define DEBUG_CHAR SERIAL_CHAR
|
||||
@@ -89,7 +89,7 @@
|
||||
#else
|
||||
|
||||
#define DEBUG_SECTION(...) NOOP
|
||||
#define DEBUG_PRINT_P(P) NOOP
|
||||
#define DEBUG_ECHOPGM_P(P) NOOP
|
||||
#define DEBUG_ECHO_START() NOOP
|
||||
#define DEBUG_ERROR_START() NOOP
|
||||
#define DEBUG_CHAR(...) NOOP
|
||||
|
||||
@@ -38,10 +38,10 @@ private:
|
||||
bool debug;
|
||||
|
||||
void echo_msg(PGM_P const pre) {
|
||||
serialprintPGM(pre);
|
||||
SERIAL_ECHOPGM_P(pre);
|
||||
if (the_msg) {
|
||||
SERIAL_CHAR(' ');
|
||||
serialprintPGM(the_msg);
|
||||
SERIAL_ECHOPGM_P(the_msg);
|
||||
}
|
||||
SERIAL_CHAR(' ');
|
||||
print_xyz(current_position);
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
#define RADIANS(d) ((d)*float(M_PI)/180.0f)
|
||||
#define DEGREES(r) ((r)*180.0f/float(M_PI))
|
||||
#define HYPOT2(x,y) (sq(x)+sq(y))
|
||||
#define NORMSQ(x,y,z) (sq(x)+sq(y)+sq(z))
|
||||
|
||||
#define CIRCLE_AREA(R) (float(M_PI) * sq(float(R)))
|
||||
#define CIRCLE_CIRC(R) (2 * float(M_PI) * float(R))
|
||||
|
||||
@@ -92,9 +92,9 @@ void safe_delay(millis_t ms) {
|
||||
SERIAL_ECHOPGM(" (Aligned With");
|
||||
|
||||
if (probe.offset_xy.y > 0)
|
||||
serialprintPGM(ENABLED(IS_SCARA) ? PSTR("-Distal") : PSTR("-Back"));
|
||||
SERIAL_ECHOPGM_P(ENABLED(IS_SCARA) ? PSTR("-Distal") : PSTR("-Back"));
|
||||
else if (probe.offset_xy.y < 0)
|
||||
serialprintPGM(ENABLED(IS_SCARA) ? PSTR("-Proximal") : PSTR("-Front"));
|
||||
SERIAL_ECHOPGM_P(ENABLED(IS_SCARA) ? PSTR("-Proximal") : PSTR("-Front"));
|
||||
else if (probe.offset_xy.x != 0)
|
||||
SERIAL_ECHOPGM("-Center");
|
||||
|
||||
@@ -102,7 +102,7 @@ void safe_delay(millis_t ms) {
|
||||
|
||||
#endif
|
||||
|
||||
serialprintPGM(probe.offset.z < 0 ? PSTR("Below") : probe.offset.z > 0 ? PSTR("Above") : PSTR("Same Z as"));
|
||||
SERIAL_ECHOPGM_P(probe.offset.z < 0 ? PSTR("Below") : probe.offset.z > 0 ? PSTR("Above") : PSTR("Same Z as"));
|
||||
SERIAL_ECHOLNPGM(" Nozzle)");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -181,7 +181,7 @@ void unified_bed_leveling::display_map(const int map_type) {
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOPGM(" for ");
|
||||
serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
|
||||
SERIAL_ECHOPGM_P(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
|
||||
}
|
||||
|
||||
// Add XY probe offset from extruder because probe.probe_at_point() subtracts them when
|
||||
@@ -212,7 +212,7 @@ void unified_bed_leveling::display_map(const int map_type) {
|
||||
// TODO: Display on Graphical LCD
|
||||
}
|
||||
else if (isnan(f))
|
||||
serialprintPGM(human ? PSTR(" . ") : PSTR("NAN"));
|
||||
SERIAL_ECHOPGM_P(human ? PSTR(" . ") : PSTR("NAN"));
|
||||
else if (human || csv) {
|
||||
if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0)
|
||||
SERIAL_ECHO_F(f, 3); // Positive: 5 digits, Negative: 6 digits
|
||||
|
||||
@@ -908,11 +908,11 @@ void unified_bed_leveling::shift_mesh_height() {
|
||||
if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing
|
||||
|
||||
if (parser.seen('B')) {
|
||||
serialprintPGM(GET_TEXT(MSG_UBL_BC_INSERT));
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT));
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
|
||||
}
|
||||
else {
|
||||
serialprintPGM(GET_TEXT(MSG_UBL_BC_INSERT2));
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT2));
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2);
|
||||
}
|
||||
|
||||
@@ -1576,7 +1576,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
return normal.x * pos.x + normal.y * pos.y + zadd;
|
||||
};
|
||||
auto debug_pt = [](PGM_P const pre, const xy_pos_t &pos, const float &zadd) {
|
||||
d_from(); serialprintPGM(pre);
|
||||
d_from(); SERIAL_ECHOPGM_P(pre);
|
||||
DEBUG_ECHO_F(normed(pos, zadd), 6);
|
||||
DEBUG_ECHOLNPAIR_F(" Z error = ", zadd - get_z_correction(pos), 6);
|
||||
};
|
||||
|
||||
@@ -335,7 +335,7 @@
|
||||
|
||||
#if IS_KINEMATIC
|
||||
const float seconds = cart_xy_mm / scaled_fr_mm_s; // Duration of XY move at requested rate
|
||||
uint16_t segments = LROUND(delta_segments_per_second * seconds), // Preferred number of segments for distance @ feedrate
|
||||
uint16_t segments = LROUND(segments_per_second * seconds), // Preferred number of segments for distance @ feedrate
|
||||
seglimit = LROUND(cart_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length
|
||||
NOMORE(segments, seglimit); // Limit to minimum segment length (fewer segments)
|
||||
#else
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
|
||||
CaseLight caselight;
|
||||
|
||||
#if CASE_LIGHT_IS_COLOR_LED
|
||||
#include "leds/leds.h"
|
||||
#endif
|
||||
|
||||
#if CASELIGHT_USES_BRIGHTNESS && !defined(CASE_LIGHT_DEFAULT_BRIGHTNESS)
|
||||
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 0 // For use on PWM pin as non-PWM just sets a default
|
||||
#endif
|
||||
@@ -38,10 +42,10 @@ CaseLight caselight;
|
||||
|
||||
bool CaseLight::on = CASE_LIGHT_DEFAULT_ON;
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#if CASE_LIGHT_IS_COLOR_LED
|
||||
LEDColor CaseLight::color =
|
||||
#ifdef CASE_LIGHT_NEOPIXEL_COLOR
|
||||
CASE_LIGHT_NEOPIXEL_COLOR
|
||||
#ifdef CASE_LIGHT_DEFAULT_COLOR
|
||||
CASE_LIGHT_DEFAULT_COLOR
|
||||
#else
|
||||
{ 255, 255, 255, 255 }
|
||||
#endif
|
||||
@@ -71,17 +75,17 @@ void CaseLight::update(const bool sflag) {
|
||||
const uint8_t i = on ? brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#if CASE_LIGHT_IS_COLOR_LED
|
||||
|
||||
leds.set_color(
|
||||
MakeLEDColor(color.r, color.g, color.b, color.w, n10ct),
|
||||
false
|
||||
);
|
||||
|
||||
#else // !CASE_LIGHT_USE_NEOPIXEL
|
||||
#else // !CASE_LIGHT_IS_COLOR_LED
|
||||
|
||||
#if CASELIGHT_USES_BRIGHTNESS
|
||||
if (PWM_PIN(CASE_LIGHT_PIN))
|
||||
if (pin_is_pwm())
|
||||
analogWrite(pin_t(CASE_LIGHT_PIN), (
|
||||
#if CASE_LIGHT_MAX_PWM == 255
|
||||
n10ct
|
||||
@@ -96,7 +100,11 @@ void CaseLight::update(const bool sflag) {
|
||||
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
|
||||
}
|
||||
|
||||
#endif // !CASE_LIGHT_USE_NEOPIXEL
|
||||
#endif // !CASE_LIGHT_IS_COLOR_LED
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_RGB_LED)
|
||||
if (leds.lights_on) leds.update(); else leds.set_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // CASE_LIGHT_ENABLE
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#include "leds/leds.h"
|
||||
#if CASE_LIGHT_IS_COLOR_LED
|
||||
#include "leds/leds.h" // for LEDColor
|
||||
#endif
|
||||
|
||||
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS) || ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
@@ -33,19 +33,25 @@
|
||||
|
||||
class CaseLight {
|
||||
public:
|
||||
#if CASELIGHT_USES_BRIGHTNESS
|
||||
static uint8_t brightness;
|
||||
#endif
|
||||
static bool on;
|
||||
TERN_(CASELIGHT_USES_BRIGHTNESS, static uint8_t brightness);
|
||||
|
||||
static bool pin_is_pwm() { return TERN0(NEED_CASE_LIGHT_PIN, PWM_PIN(CASE_LIGHT_PIN)); }
|
||||
static bool has_brightness() { return TERN0(CASELIGHT_USES_BRIGHTNESS, TERN(CASE_LIGHT_USE_NEOPIXEL, true, pin_is_pwm())); }
|
||||
|
||||
static void init() {
|
||||
#if NEED_CASE_LIGHT_PIN
|
||||
if (pin_is_pwm()) SET_PWM(CASE_LIGHT_PIN); else SET_OUTPUT(CASE_LIGHT_PIN);
|
||||
#endif
|
||||
update_brightness();
|
||||
}
|
||||
|
||||
static void update(const bool sflag);
|
||||
static inline void update_brightness() { update(false); }
|
||||
static inline void update_enabled() { update(true); }
|
||||
static inline void update_enabled() { update(true); }
|
||||
|
||||
private:
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
static LEDColor color;
|
||||
#endif
|
||||
TERN_(CASE_LIGHT_IS_COLOR_LED, static LEDColor color);
|
||||
};
|
||||
|
||||
extern CaseLight caselight;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
void host_action(PGM_P const pstr, const bool eol) {
|
||||
PORT_REDIRECT(SERIAL_ALL);
|
||||
SERIAL_ECHOPGM("//action:");
|
||||
serialprintPGM(pstr);
|
||||
SERIAL_ECHOPGM_P(pstr);
|
||||
if (eol) SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -86,14 +86,13 @@ void host_action(PGM_P const pstr, const bool eol) {
|
||||
void host_action_notify_P(PGM_P const message) {
|
||||
PORT_REDIRECT(SERIAL_ALL);
|
||||
host_action(PSTR("notification "), false);
|
||||
serialprintPGM(message);
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNPGM_P(message);
|
||||
}
|
||||
|
||||
void host_action_prompt(PGM_P const ptype, const bool eol=true) {
|
||||
PORT_REDIRECT(SERIAL_ALL);
|
||||
host_action(PSTR("prompt_"), false);
|
||||
serialprintPGM(ptype);
|
||||
SERIAL_ECHOPGM_P(ptype);
|
||||
if (eol) SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -101,7 +100,7 @@ void host_action(PGM_P const pstr, const bool eol) {
|
||||
host_action_prompt(ptype, false);
|
||||
PORT_REDIRECT(SERIAL_ALL);
|
||||
SERIAL_CHAR(' ');
|
||||
serialprintPGM(pstr);
|
||||
SERIAL_ECHOPGM_P(pstr);
|
||||
if (extra_char != '\0') SERIAL_CHAR(extra_char);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@@ -143,24 +142,16 @@ void host_action(PGM_P const pstr, const bool eol) {
|
||||
// - Dismissal of info
|
||||
//
|
||||
void host_response_handler(const uint8_t response) {
|
||||
#ifdef DEBUG_HOST_ACTIONS
|
||||
static PGMSTR(m876_prefix, "M876 Handle Re");
|
||||
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("ason: ", host_prompt_reason);
|
||||
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("sponse: ", response);
|
||||
#endif
|
||||
PGM_P msg = PSTR("UNKNOWN STATE");
|
||||
const PromptReason hpr = host_prompt_reason;
|
||||
host_prompt_reason = PROMPT_NOT_DEFINED; // Reset now ahead of logic
|
||||
switch (hpr) {
|
||||
case PROMPT_FILAMENT_RUNOUT:
|
||||
msg = PSTR("FILAMENT_RUNOUT");
|
||||
switch (response) {
|
||||
|
||||
case 0: // "Purge More" button
|
||||
#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
|
||||
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more)
|
||||
#endif
|
||||
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: The loop in load_filament may also do this!)
|
||||
break;
|
||||
|
||||
case 1: // "Continue" / "Disable Runout" button
|
||||
@@ -178,23 +169,17 @@ void host_action(PGM_P const pstr, const bool eol) {
|
||||
break;
|
||||
case PROMPT_USER_CONTINUE:
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
|
||||
msg = PSTR("FILAMENT_RUNOUT_CONTINUE");
|
||||
break;
|
||||
case PROMPT_PAUSE_RESUME:
|
||||
msg = PSTR("LCD_PAUSE_RESUME");
|
||||
#if BOTH(ADVANCED_PAUSE_FEATURE, SDSUPPORT)
|
||||
extern const char M24_STR[];
|
||||
queue.inject_P(M24_STR);
|
||||
#endif
|
||||
break;
|
||||
case PROMPT_INFO:
|
||||
msg = PSTR("GCODE_INFO");
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
SERIAL_ECHOPGM("M876 Responding PROMPT_");
|
||||
serialprintPGM(msg);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
#endif // HOST_PROMPT_SUPPORT
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
#include "pca9533.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_RGB_LED)
|
||||
#include "../../feature/caselight.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
const LEDColor LEDLights::defaultLEDColor = MakeLEDColor(
|
||||
LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE,
|
||||
@@ -85,8 +89,11 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
|
||||
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
||||
if (NEOPIXEL_BKGD_LED_INDEX == nextLed) {
|
||||
if (++nextLed >= neo.pixels()) nextLed = 0;
|
||||
return;
|
||||
neo.set_color_background();
|
||||
if (++nextLed >= neo.pixels()) {
|
||||
nextLed = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -114,12 +121,13 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
|
||||
// This variant uses 3-4 separate pins for the RGB(W) components.
|
||||
// If the pins can do PWM then their intensity will be set.
|
||||
#define UPDATE_RGBW(C,c) do { \
|
||||
if (PWM_PIN(RGB_LED_##C##_PIN)) \
|
||||
analogWrite(pin_t(RGB_LED_##C##_PIN), incol.c); \
|
||||
else \
|
||||
WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); \
|
||||
#define _UPDATE_RGBW(C,c) do { \
|
||||
if (PWM_PIN(RGB_LED_##C##_PIN)) \
|
||||
analogWrite(pin_t(RGB_LED_##C##_PIN), c); \
|
||||
else \
|
||||
WRITE(RGB_LED_##C##_PIN, c ? HIGH : LOW); \
|
||||
}while(0)
|
||||
#define UPDATE_RGBW(C,c) _UPDATE_RGBW(C, TERN1(CASE_LIGHT_USE_RGB_LED, caselight.on) ? incol.c : 0)
|
||||
UPDATE_RGBW(R,r); UPDATE_RGBW(G,g); UPDATE_RGBW(B,b);
|
||||
#if ENABLED(RGBW_LED)
|
||||
UPDATE_RGBW(W,w);
|
||||
|
||||
@@ -194,6 +194,8 @@ public:
|
||||
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
static void toggle(); // swap "off" with color
|
||||
#endif
|
||||
#if EITHER(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED)
|
||||
static inline void update() { set_color(color); }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void Marlin_NeoPixel::set_color(const uint32_t color) {
|
||||
else {
|
||||
for (uint16_t i = 0; i < pixels(); ++i) {
|
||||
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
||||
if (i == NEOPIXEL_BKGD_LED_INDEX && color != 0x000000) {
|
||||
if (i == NEOPIXEL_BKGD_LED_INDEX && TERN(NEOPIXEL_BKGD_ALWAYS_ON, true, color != 0x000000)) {
|
||||
set_color_background();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ uint8_t Max7219::suspended; // = 0;
|
||||
void Max7219::error(const char * const func, const int32_t v1, const int32_t v2/*=-1*/) {
|
||||
#if ENABLED(MAX7219_ERRORS)
|
||||
SERIAL_ECHOPGM("??? Max7219::");
|
||||
serialprintPGM(func);
|
||||
SERIAL_ECHOPGM_P(func);
|
||||
SERIAL_CHAR('(');
|
||||
SERIAL_ECHO(v1);
|
||||
if (v2 > 0) SERIAL_ECHOPAIR(", ", v2);
|
||||
|
||||
@@ -179,7 +179,7 @@ void MeatPack::report_state() {
|
||||
SERIAL_ECHOPGM("[MP] ");
|
||||
SERIAL_ECHOPGM(MeatPack_ProtocolVersion " ");
|
||||
serialprint_onoff(TEST(state, MPConfig_Bit_Active));
|
||||
serialprintPGM(TEST(state, MPConfig_Bit_NoSpaces) ? PSTR(" NSP\n") : PSTR(" ESP\n"));
|
||||
SERIAL_ECHOPGM_P(TEST(state, MPConfig_Bit_NoSpaces) ? PSTR(" NSP\n") : PSTR(" ESP\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,29 +62,13 @@ MMU2 mmu2;
|
||||
#endif
|
||||
|
||||
#define MMU_CMD_NONE 0
|
||||
#define MMU_CMD_T0 0x10
|
||||
#define MMU_CMD_T1 0x11
|
||||
#define MMU_CMD_T2 0x12
|
||||
#define MMU_CMD_T3 0x13
|
||||
#define MMU_CMD_T4 0x14
|
||||
#define MMU_CMD_L0 0x20
|
||||
#define MMU_CMD_L1 0x21
|
||||
#define MMU_CMD_L2 0x22
|
||||
#define MMU_CMD_L3 0x23
|
||||
#define MMU_CMD_L4 0x24
|
||||
#define MMU_CMD_T0 0x10 // up to supported filaments
|
||||
#define MMU_CMD_L0 0x20 // up to supported filaments
|
||||
#define MMU_CMD_C0 0x30
|
||||
#define MMU_CMD_U0 0x40
|
||||
#define MMU_CMD_E0 0x50
|
||||
#define MMU_CMD_E1 0x51
|
||||
#define MMU_CMD_E2 0x52
|
||||
#define MMU_CMD_E3 0x53
|
||||
#define MMU_CMD_E4 0x54
|
||||
#define MMU_CMD_E0 0x50 // up to supported filaments
|
||||
#define MMU_CMD_R0 0x60
|
||||
#define MMU_CMD_F0 0x70
|
||||
#define MMU_CMD_F1 0x71
|
||||
#define MMU_CMD_F2 0x72
|
||||
#define MMU_CMD_F3 0x73
|
||||
#define MMU_CMD_F4 0x74
|
||||
#define MMU_CMD_F0 0x70 // up to supported filaments
|
||||
|
||||
#define MMU_REQUIRED_FW_BUILDNR TERN(MMU2_MODE_12V, 132, 126)
|
||||
|
||||
@@ -243,7 +227,7 @@ void MMU2::mmu_loop() {
|
||||
|
||||
case 1:
|
||||
if (cmd) {
|
||||
if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T4)) {
|
||||
if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T0 + EXTRUDERS - 1)) {
|
||||
// tool change
|
||||
int filament = cmd - MMU_CMD_T0;
|
||||
DEBUG_ECHOLNPAIR("MMU <= T", filament);
|
||||
@@ -251,7 +235,7 @@ void MMU2::mmu_loop() {
|
||||
TERN_(MMU_EXTRUDER_SENSOR, mmu_idl_sens = 1); // enable idler sensor, if any
|
||||
state = 3; // wait for response
|
||||
}
|
||||
else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L4)) {
|
||||
else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L0 + EXTRUDERS - 1)) {
|
||||
// load
|
||||
int filament = cmd - MMU_CMD_L0;
|
||||
DEBUG_ECHOLNPAIR("MMU <= L", filament);
|
||||
@@ -271,7 +255,7 @@ void MMU2::mmu_loop() {
|
||||
MMU2_COMMAND("U0");
|
||||
state = 3; // wait for response
|
||||
}
|
||||
else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E4)) {
|
||||
else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E0 + EXTRUDERS - 1)) {
|
||||
// eject filament
|
||||
int filament = cmd - MMU_CMD_E0;
|
||||
DEBUG_ECHOLNPAIR("MMU <= E", filament);
|
||||
@@ -284,7 +268,7 @@ void MMU2::mmu_loop() {
|
||||
MMU2_COMMAND("R0");
|
||||
state = 3; // wait for response
|
||||
}
|
||||
else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F4)) {
|
||||
else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F0 + EXTRUDERS - 1)) {
|
||||
// filament type
|
||||
int filament = cmd - MMU_CMD_F0;
|
||||
DEBUG_ECHOLNPAIR("MMU <= F", filament, " ", cmd_arg);
|
||||
|
||||
@@ -192,11 +192,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true; // LCD click or M108 will clear this
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
const char tool = '0'
|
||||
#if NUM_RUNOUT_SENSORS > 1
|
||||
+ active_extruder
|
||||
#endif
|
||||
;
|
||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
|
||||
#endif
|
||||
|
||||
@@ -259,7 +255,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
}
|
||||
|
||||
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
|
||||
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt.
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) {
|
||||
@@ -460,7 +456,7 @@ void show_continue_prompt(const bool is_reload) {
|
||||
|
||||
ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
|
||||
SERIAL_ECHO_START();
|
||||
serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
|
||||
SERIAL_ECHOPGM_P(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
|
||||
}
|
||||
|
||||
void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
|
||||
|
||||
@@ -384,18 +384,25 @@ void PrintJobRecovery::resume() {
|
||||
// Home safely with no Z raise
|
||||
gcode.process_subcommands_now_P(PSTR(
|
||||
"G28R0" // No raise during G28
|
||||
#if IS_CARTESIAN && DISABLED(POWER_LOSS_RECOVER_ZHOME)
|
||||
#if IS_CARTESIAN && (DISABLED(POWER_LOSS_RECOVER_ZHOME) || defined(POWER_LOSS_ZHOME_POS))
|
||||
"XY" // Don't home Z on Cartesian unless overridden
|
||||
#endif
|
||||
));
|
||||
|
||||
#endif
|
||||
|
||||
// Pretend that all axes are homed
|
||||
#ifdef POWER_LOSS_ZHOME_POS
|
||||
// If defined move to a safe Z homing position that avoids the print
|
||||
constexpr xy_pos_t p = POWER_LOSS_ZHOME_POS;
|
||||
sprintf_P(cmd, PSTR("G1 X%s Y%s F1000\nG28Z"), dtostrf(p.x, 1, 3, str_1), dtostrf(p.y, 1, 3, str_2));
|
||||
gcode.process_subcommands_now(cmd);
|
||||
#endif
|
||||
|
||||
// Ensure that all axes are marked as homed
|
||||
set_all_homed();
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVER_ZHOME)
|
||||
// Z has been homed so restore Z to ZsavedPos + POWER_LOSS_ZRAISE
|
||||
// Now move to ZsavedPos + POWER_LOSS_ZRAISE
|
||||
sprintf_P(cmd, PSTR("G1 F500 Z%s"), dtostrf(info.current_position.z + POWER_LOSS_ZRAISE, 1, 3, str_1));
|
||||
gcode.process_subcommands_now(cmd);
|
||||
#endif
|
||||
@@ -467,7 +474,7 @@ void PrintJobRecovery::resume() {
|
||||
|
||||
// Additional purge if configured
|
||||
#if POWER_LOSS_PURGE_LEN
|
||||
sprintf_P(cmd, PSTR("G1 E%d F200"), (POWER_LOSS_PURGE_LEN) + (POWER_LOSS_RETRACT_LEN));
|
||||
sprintf_P(cmd, PSTR("G1 E%d F3000"), (POWER_LOSS_PURGE_LEN) + (POWER_LOSS_RETRACT_LEN));
|
||||
gcode.process_subcommands_now(cmd);
|
||||
#endif
|
||||
|
||||
@@ -485,7 +492,7 @@ void PrintJobRecovery::resume() {
|
||||
// Move back to the saved Z
|
||||
dtostrf(info.current_position.z, 1, 3, str_1);
|
||||
#if Z_HOME_DIR > 0 || ENABLED(POWER_LOSS_RECOVER_ZHOME)
|
||||
sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1);
|
||||
sprintf_P(cmd, PSTR("G1 Z%s F500"), str_1);
|
||||
#else
|
||||
gcode.process_subcommands_now_P(PSTR("G1 Z0 F200"));
|
||||
sprintf_P(cmd, PSTR("G92.9 Z%s"), str_1);
|
||||
@@ -531,7 +538,7 @@ void PrintJobRecovery::resume() {
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
|
||||
void PrintJobRecovery::debug(PGM_P const prefix) {
|
||||
DEBUG_PRINT_P(prefix);
|
||||
DEBUG_ECHOPGM_P(prefix);
|
||||
DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot);
|
||||
if (info.valid_head) {
|
||||
if (info.valid_head == info.valid_foot) {
|
||||
|
||||
@@ -73,7 +73,7 @@ void ProbeTempComp::print_offsets() {
|
||||
LOOP_L_N(s, TSI_COUNT) {
|
||||
float temp = cali_info[s].start_temp;
|
||||
for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
|
||||
serialprintPGM(s == TSI_BED ? PSTR("Bed") :
|
||||
SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") :
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
s == TSI_EXT ? PSTR("Extruder") :
|
||||
#endif
|
||||
|
||||
@@ -47,12 +47,12 @@ bool FilamentMonitorBase::enabled = true,
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
|
||||
volatile float RunoutResponseDelayed::runout_mm_countdown[EXTRUDERS];
|
||||
volatile float RunoutResponseDelayed::runout_mm_countdown[NUM_RUNOUT_SENSORS];
|
||||
#if ENABLED(FILAMENT_MOTION_SENSOR)
|
||||
uint8_t FilamentSensorEncoder::motion_detected;
|
||||
#endif
|
||||
#else
|
||||
int8_t RunoutResponseDebounced::runout_count; // = 0
|
||||
int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -70,7 +70,7 @@ bool FilamentMonitorBase::enabled = true,
|
||||
#include "../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
void event_filament_runout() {
|
||||
void event_filament_runout(const uint8_t extruder) {
|
||||
|
||||
if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout.
|
||||
|
||||
@@ -85,14 +85,10 @@ void event_filament_runout() {
|
||||
}
|
||||
#endif
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getActiveTool()));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
|
||||
|
||||
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
|
||||
const char tool = '0'
|
||||
#if NUM_RUNOUT_SENSORS > 1
|
||||
+ active_extruder
|
||||
#endif
|
||||
;
|
||||
#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
|
||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
|
||||
#endif
|
||||
|
||||
//action:out_of_filament
|
||||
@@ -128,8 +124,22 @@ void event_filament_runout() {
|
||||
SERIAL_EOL();
|
||||
#endif // HOST_ACTION_COMMANDS
|
||||
|
||||
if (run_runout_script)
|
||||
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
||||
if (run_runout_script) {
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
char script[strlen(FILAMENT_RUNOUT_SCRIPT) + 1];
|
||||
sprintf_P(script, PSTR(FILAMENT_RUNOUT_SCRIPT), tool);
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
SERIAL_ECHOLNPAIR("Runout Command: ", script);
|
||||
#endif
|
||||
queue.inject(script);
|
||||
#else
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
SERIAL_ECHOPGM("Runout Command: ");
|
||||
SERIAL_ECHOLNPGM(FILAMENT_RUNOUT_SCRIPT);
|
||||
#endif
|
||||
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAS_FILAMENT_SENSOR
|
||||
|
||||
+78
-32
@@ -43,7 +43,7 @@
|
||||
#define FILAMENT_RUNOUT_THRESHOLD 5
|
||||
#endif
|
||||
|
||||
void event_filament_runout();
|
||||
void event_filament_runout(const uint8_t extruder);
|
||||
|
||||
template<class RESPONSE_T, class SENSOR_T>
|
||||
class TFilamentMonitor;
|
||||
@@ -119,11 +119,41 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
|
||||
response.run();
|
||||
sensor.run();
|
||||
const bool ran_out = response.has_run_out();
|
||||
const uint8_t runout_flags = response.has_run_out();
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei());
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
#if ENABLED(WATCH_ALL_RUNOUT_SENSORS)
|
||||
const bool ran_out = !!runout_flags; // any sensor triggers
|
||||
uint8_t extruder = 0;
|
||||
if (ran_out) {
|
||||
uint8_t bitmask = runout_flags;
|
||||
while (!(bitmask & 1)) {
|
||||
bitmask >>= 1;
|
||||
extruder++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
const bool ran_out = TEST(runout_flags, active_extruder); // suppress non active extruders
|
||||
uint8_t extruder = active_extruder;
|
||||
#endif
|
||||
#else
|
||||
const bool ran_out = !!runout_flags;
|
||||
uint8_t extruder = active_extruder;
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
if (runout_flags) {
|
||||
SERIAL_ECHOPGM("Runout Sensors: ");
|
||||
LOOP_L_N(i, 8) SERIAL_ECHO('0' + TEST(runout_flags, i));
|
||||
SERIAL_ECHOPAIR(" -> ", extruder);
|
||||
if (ran_out) SERIAL_ECHOPGM(" RUN OUT");
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ran_out) {
|
||||
filament_ran_out = true;
|
||||
event_filament_runout();
|
||||
event_filament_runout(extruder);
|
||||
planner.synchronize();
|
||||
}
|
||||
}
|
||||
@@ -230,7 +260,7 @@ class FilamentSensorBase {
|
||||
change = old_state ^ new_state;
|
||||
old_state = new_state;
|
||||
|
||||
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
if (change) {
|
||||
SERIAL_ECHOPGM("Motion detected:");
|
||||
LOOP_L_N(e, NUM_RUNOUT_SENSORS)
|
||||
@@ -266,12 +296,12 @@ class FilamentSensorBase {
|
||||
private:
|
||||
static inline bool poll_runout_state(const uint8_t extruder) {
|
||||
const uint8_t runout_states = poll_runout_states();
|
||||
#if NUM_RUNOUT_SENSORS == 1
|
||||
UNUSED(extruder);
|
||||
#else
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
|
||||
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
|
||||
) return TEST(runout_states, extruder); // A specific extruder ran out
|
||||
#else
|
||||
UNUSED(extruder);
|
||||
#endif
|
||||
return !!runout_states; // Any extruder ran out
|
||||
}
|
||||
@@ -280,16 +310,17 @@ class FilamentSensorBase {
|
||||
static inline void block_completed(const block_t* const) {}
|
||||
|
||||
static inline void run() {
|
||||
const bool out = poll_runout_state(active_extruder);
|
||||
if (!out) filament_present(active_extruder);
|
||||
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
|
||||
static bool was_out = false;
|
||||
if (out != was_out) {
|
||||
was_out = out;
|
||||
SERIAL_ECHOPGM("Filament ");
|
||||
serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n"));
|
||||
}
|
||||
#endif
|
||||
LOOP_L_N(s, NUM_RUNOUT_SENSORS) {
|
||||
const bool out = poll_runout_state(s);
|
||||
if (!out) filament_present(s);
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
static uint8_t was_out; // = 0
|
||||
if (out != TEST(was_out, s)) {
|
||||
TBI(was_out, s);
|
||||
SERIAL_ECHOLNPAIR_P(PSTR("Filament Sensor "), '0' + s, out ? PSTR(" OUT") : PSTR(" IN"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -305,32 +336,32 @@ class FilamentSensorBase {
|
||||
// during a runout condition.
|
||||
class RunoutResponseDelayed {
|
||||
private:
|
||||
static volatile float runout_mm_countdown[EXTRUDERS];
|
||||
static volatile float runout_mm_countdown[NUM_RUNOUT_SENSORS];
|
||||
|
||||
public:
|
||||
static float runout_distance_mm;
|
||||
|
||||
static inline void reset() {
|
||||
LOOP_L_N(i, EXTRUDERS) filament_present(i);
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i);
|
||||
}
|
||||
|
||||
static inline void run() {
|
||||
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
static millis_t t = 0;
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, t)) {
|
||||
t = millis() + 1000UL;
|
||||
LOOP_L_N(i, EXTRUDERS) {
|
||||
serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: "));
|
||||
SERIAL_ECHO(runout_mm_countdown[i]);
|
||||
}
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS)
|
||||
SERIAL_ECHOPAIR_P(i ? PSTR(", ") : PSTR("Remaining mm: "), runout_mm_countdown[i]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool has_run_out() {
|
||||
return runout_mm_countdown[active_extruder] < 0;
|
||||
static inline uint8_t has_run_out() {
|
||||
uint8_t runout_flags = 0;
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_mm_countdown[i] < 0) SBI(runout_flags, i);
|
||||
return runout_flags;
|
||||
}
|
||||
|
||||
static inline void filament_present(const uint8_t extruder) {
|
||||
@@ -355,13 +386,28 @@ class FilamentSensorBase {
|
||||
class RunoutResponseDebounced {
|
||||
private:
|
||||
static constexpr int8_t runout_threshold = FILAMENT_RUNOUT_THRESHOLD;
|
||||
static int8_t runout_count;
|
||||
static int8_t runout_count[NUM_RUNOUT_SENSORS];
|
||||
|
||||
public:
|
||||
static inline void reset() { runout_count = runout_threshold; }
|
||||
static inline void run() { if (runout_count >= 0) runout_count--; }
|
||||
static inline bool has_run_out() { return runout_count < 0; }
|
||||
static inline void block_completed(const block_t* const) { }
|
||||
static inline void filament_present(const uint8_t) { runout_count = runout_threshold; }
|
||||
static inline void reset() {
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i);
|
||||
}
|
||||
|
||||
static inline void run() {
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_count[i] >= 0) runout_count[i]--;
|
||||
}
|
||||
|
||||
static inline uint8_t has_run_out() {
|
||||
uint8_t runout_flags = 0;
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_count[i] < 0) SBI(runout_flags, i);
|
||||
return runout_flags;
|
||||
}
|
||||
|
||||
static inline void block_completed(const block_t* const) { }
|
||||
|
||||
static inline void filament_present(const uint8_t extruder) {
|
||||
runout_count[extruder] = runout_threshold;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
|
||||
@@ -546,7 +546,7 @@
|
||||
};
|
||||
|
||||
template<class TMC>
|
||||
static void print_vsense(TMC &st) { serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); }
|
||||
static void print_vsense(TMC &st) { SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); }
|
||||
|
||||
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC5130)
|
||||
static void _tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
|
||||
@@ -717,7 +717,7 @@
|
||||
SERIAL_ECHO(st.cs());
|
||||
SERIAL_ECHOPGM("/31");
|
||||
break;
|
||||
case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
|
||||
case TMC_VSENSE: SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
|
||||
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
|
||||
//case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
|
||||
//case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
|
||||
@@ -1208,7 +1208,7 @@ static bool test_connection(TMC &st) {
|
||||
case 1: stat = PSTR("HIGH"); break;
|
||||
case 2: stat = PSTR("LOW"); break;
|
||||
}
|
||||
serialprintPGM(stat);
|
||||
SERIAL_ECHOPGM_P(stat);
|
||||
SERIAL_EOL();
|
||||
|
||||
return test_result;
|
||||
|
||||
@@ -83,7 +83,7 @@ void TWIBus::send() {
|
||||
// static
|
||||
void TWIBus::echoprefix(uint8_t bytes, const char pref[], uint8_t adr) {
|
||||
SERIAL_ECHO_START();
|
||||
serialprintPGM(pref);
|
||||
SERIAL_ECHOPGM_P(pref);
|
||||
SERIAL_ECHOPAIR(": from:", adr, " bytes:", bytes, " data:");
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void TWIBus::flush() {
|
||||
// static
|
||||
void TWIBus::prefix(const char func[]) {
|
||||
SERIAL_ECHOPGM("TWIBus::");
|
||||
serialprintPGM(func);
|
||||
SERIAL_ECHOPGM_P(func);
|
||||
SERIAL_ECHOPGM(": ");
|
||||
}
|
||||
void TWIBus::debug(const char func[], uint32_t adr) {
|
||||
|
||||
@@ -114,7 +114,7 @@ void GcodeSuite::G35() {
|
||||
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
DEBUG_ECHOPAIR("Probing point ", i, " (");
|
||||
DEBUG_PRINT_P((char *)pgm_read_ptr(&tramming_point_name[i]));
|
||||
DEBUG_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
|
||||
DEBUG_CHAR(')');
|
||||
DEBUG_ECHOLNPAIR_P(SP_X_STR, screws_tilt_adjust_pos[i].x, SP_Y_STR, screws_tilt_adjust_pos[i].y, SP_Z_STR, z_probed_height);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
#if ABL_GRID
|
||||
|
||||
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED));
|
||||
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_FEEDRATE));
|
||||
|
||||
const float x_min = probe.min_x(), x_max = probe.max_x(),
|
||||
y_min = probe.min_y(), y_max = probe.max_y();
|
||||
@@ -786,7 +786,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
float min_diff = 999;
|
||||
|
||||
auto print_topo_map = [&](PGM_P const title, const bool get_min) {
|
||||
serialprintPGM(title);
|
||||
SERIAL_ECHOPGM_P(title);
|
||||
for (int8_t yy = abl_grid_points.y - 1; yy >= 0; yy--) {
|
||||
LOOP_L_N(xx, abl_grid_points.x) {
|
||||
const int ind = indexIntoAB[xx][yy];
|
||||
|
||||
@@ -259,7 +259,7 @@ void GcodeSuite::G28() {
|
||||
|
||||
#if HAS_HOMING_CURRENT
|
||||
auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b){
|
||||
serialprintPGM(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b);
|
||||
DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b);
|
||||
};
|
||||
#if HAS_CURRENT_HOME(X)
|
||||
const int16_t tmc_save_current_X = stepperX.getMilliamps();
|
||||
@@ -311,7 +311,13 @@ void GcodeSuite::G28() {
|
||||
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
|
||||
|
||||
#else // NOT DELTA
|
||||
#elif ENABLED(AXEL_TPARA)
|
||||
|
||||
constexpr bool doZ = true; // for NANODLP_Z_SYNC if your DLP is on a TPARA
|
||||
|
||||
home_TPARA();
|
||||
|
||||
#else
|
||||
|
||||
const bool homeZ = parser.seen('Z'),
|
||||
needX = homeZ && TERN0(Z_SAFE_HOMING, axes_should_home(_BV(X_AXIS))),
|
||||
@@ -392,7 +398,7 @@ void GcodeSuite::G28() {
|
||||
|
||||
sync_plan_position();
|
||||
|
||||
#endif // !DELTA (G28)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Preserve DXC mode across a G28 for IDEX printers in DXC_DUPLICATION_MODE.
|
||||
|
||||
@@ -93,7 +93,7 @@ void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) {
|
||||
|
||||
void print_signed_float(PGM_P const prefix, const float &f) {
|
||||
SERIAL_ECHOPGM(" ");
|
||||
serialprintPGM(prefix);
|
||||
SERIAL_ECHOPGM_P(prefix);
|
||||
SERIAL_CHAR(':');
|
||||
if (f >= 0) SERIAL_CHAR('+');
|
||||
SERIAL_ECHO_F(f, 2);
|
||||
@@ -449,7 +449,7 @@ void GcodeSuite::G33() {
|
||||
|
||||
// Report settings
|
||||
PGM_P const checkingac = PSTR("Checking... AC");
|
||||
serialprintPGM(checkingac);
|
||||
SERIAL_ECHOPGM_P(checkingac);
|
||||
if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)");
|
||||
SERIAL_EOL();
|
||||
ui.set_status_P(checkingac);
|
||||
@@ -625,7 +625,7 @@ void GcodeSuite::G33() {
|
||||
}
|
||||
else { // dry run
|
||||
PGM_P const enddryrun = PSTR("End DRY-RUN");
|
||||
serialprintPGM(enddryrun);
|
||||
SERIAL_ECHOPGM_P(enddryrun);
|
||||
SERIAL_ECHO_SP(35);
|
||||
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
|
||||
|
||||
|
||||
@@ -40,21 +40,21 @@
|
||||
* X = Alpha (Tower 1) angle trim
|
||||
* Y = Beta (Tower 2) angle trim
|
||||
* Z = Gamma (Tower 3) angle trim
|
||||
* A = Alpha (Tower 1) digonal rod trim
|
||||
* B = Beta (Tower 2) digonal rod trim
|
||||
* C = Gamma (Tower 3) digonal rod trim
|
||||
* A = Alpha (Tower 1) diagonal rod trim
|
||||
* B = Beta (Tower 2) diagonal rod trim
|
||||
* C = Gamma (Tower 3) diagonal rod trim
|
||||
*/
|
||||
void GcodeSuite::M665() {
|
||||
if (parser.seen('H')) delta_height = parser.value_linear_units();
|
||||
if (parser.seen('L')) delta_diagonal_rod = parser.value_linear_units();
|
||||
if (parser.seen('R')) delta_radius = parser.value_linear_units();
|
||||
if (parser.seen('S')) delta_segments_per_second = parser.value_float();
|
||||
if (parser.seen('X')) delta_tower_angle_trim.a = parser.value_float();
|
||||
if (parser.seen('Y')) delta_tower_angle_trim.b = parser.value_float();
|
||||
if (parser.seen('Z')) delta_tower_angle_trim.c = parser.value_float();
|
||||
if (parser.seen('A')) delta_diagonal_rod_trim.a = parser.value_float();
|
||||
if (parser.seen('B')) delta_diagonal_rod_trim.b = parser.value_float();
|
||||
if (parser.seen('C')) delta_diagonal_rod_trim.c = parser.value_float();
|
||||
if (parser.seenval('H')) delta_height = parser.value_linear_units();
|
||||
if (parser.seenval('L')) delta_diagonal_rod = parser.value_linear_units();
|
||||
if (parser.seenval('R')) delta_radius = parser.value_linear_units();
|
||||
if (parser.seenval('S')) segments_per_second = parser.value_float();
|
||||
if (parser.seenval('X')) delta_tower_angle_trim.a = parser.value_float();
|
||||
if (parser.seenval('Y')) delta_tower_angle_trim.b = parser.value_float();
|
||||
if (parser.seenval('Z')) delta_tower_angle_trim.c = parser.value_float();
|
||||
if (parser.seenval('A')) delta_diagonal_rod_trim.a = parser.value_float();
|
||||
if (parser.seenval('B')) delta_diagonal_rod_trim.b = parser.value_float();
|
||||
if (parser.seenval('C')) delta_diagonal_rod_trim.c = parser.value_float();
|
||||
recalc_delta_settings();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
* B, T, and Y are all aliases for the elbow angle
|
||||
*/
|
||||
void GcodeSuite::M665() {
|
||||
if (parser.seenval('S')) delta_segments_per_second = parser.value_float();
|
||||
if (parser.seenval('S')) segments_per_second = parser.value_float();
|
||||
|
||||
#if HAS_SCARA_OFFSET
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void GcodeSuite::M852() {
|
||||
|
||||
if (!ijk) {
|
||||
SERIAL_ECHO_START();
|
||||
serialprintPGM(GET_TEXT(MSG_SKEW_FACTOR));
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_SKEW_FACTOR));
|
||||
SERIAL_ECHOPAIR_F(" XY: ", planner.skew_factor.xy, 6);
|
||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||
SERIAL_ECHOPAIR_F(" XZ: ", planner.skew_factor.xz, 6);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
void M217_report(const bool eeprom=false) {
|
||||
|
||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
|
||||
SERIAL_ECHOPGM_P(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
|
||||
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
|
||||
SERIAL_ECHOPAIR_P(SP_B_STR, LINEAR_UNIT(toolchange_settings.extra_resume),
|
||||
SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime),
|
||||
|
||||
@@ -55,7 +55,7 @@ void GcodeSuite::M302() {
|
||||
// Report current state
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Cold extrudes are ");
|
||||
serialprintPGM(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis"));
|
||||
SERIAL_ECHOPGM_P(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis"));
|
||||
SERIAL_ECHOLNPAIR("abled (min temp ", thermalManager.extrude_min_temp, "C)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ void GcodeSuite::M43() {
|
||||
if (parser.seen('E')) {
|
||||
endstops.monitor_flag = parser.value_bool();
|
||||
SERIAL_ECHOPGM("endstop monitor ");
|
||||
serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
|
||||
SERIAL_ECHOPGM_P(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
|
||||
SERIAL_ECHOLNPGM("abled");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void GcodeSuite::M111() {
|
||||
LOOP_L_N(i, COUNT(debug_strings)) {
|
||||
if (TEST(marlin_debug_flags, i)) {
|
||||
if (comma++) SERIAL_CHAR(',');
|
||||
serialprintPGM((char*)pgm_read_ptr(&debug_strings[i]));
|
||||
SERIAL_ECHOPGM_P((char*)pgm_read_ptr(&debug_strings[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
// S: Report the current power supply state and exit
|
||||
if (parser.seen('S')) {
|
||||
serialprintPGM(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
|
||||
SERIAL_ECHOPGM_P(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,5 +41,5 @@ void GcodeSuite::M999() {
|
||||
|
||||
if (parser.boolval('S')) return;
|
||||
|
||||
queue.flush_and_request_resend();
|
||||
queue.flush_and_request_resend(queue.ring_buffer.command_port());
|
||||
}
|
||||
|
||||
@@ -41,16 +41,16 @@ inline void L6470_say_status(const L64XX_axis_t axis) {
|
||||
SERIAL_ECHO(temp_buf);
|
||||
print_bin(sh.STATUS_AXIS_RAW);
|
||||
switch (sh.STATUS_AXIS_LAYOUT) {
|
||||
case L6470_STATUS_LAYOUT: serialprintPGM(PSTR(" L6470")); break;
|
||||
case L6474_STATUS_LAYOUT: serialprintPGM(PSTR(" L6474")); break;
|
||||
case L6480_STATUS_LAYOUT: serialprintPGM(PSTR(" L6480/powerSTEP01")); break;
|
||||
case L6470_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6470"); break;
|
||||
case L6474_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6474"); break;
|
||||
case L6480_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6480/powerSTEP01"); break;
|
||||
}
|
||||
#endif
|
||||
SERIAL_ECHOPGM("\n...OUTPUT: ");
|
||||
serialprintPGM(sh.STATUS_AXIS & STATUS_HIZ ? PSTR("OFF") : PSTR("ON "));
|
||||
SERIAL_ECHOPGM_P(sh.STATUS_AXIS & STATUS_HIZ ? PSTR("OFF") : PSTR("ON "));
|
||||
SERIAL_ECHOPGM(" BUSY: "); echo_yes_no((sh.STATUS_AXIS & STATUS_BUSY) == 0);
|
||||
SERIAL_ECHOPGM(" DIR: ");
|
||||
serialprintPGM((((sh.STATUS_AXIS & STATUS_DIR) >> 4) ^ L64xxManager.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE"));
|
||||
SERIAL_ECHOPGM_P((((sh.STATUS_AXIS & STATUS_DIR) >> 4) ^ L64xxManager.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE"));
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6480_STATUS_LAYOUT) {
|
||||
SERIAL_ECHOPGM(" Last Command: ");
|
||||
if (sh.STATUS_AXIS & sh.STATUS_AXIS_WRONG_CMD) SERIAL_ECHOPGM("VALID");
|
||||
@@ -67,7 +67,7 @@ inline void L6470_say_status(const L64XX_axis_t axis) {
|
||||
SERIAL_ECHOPGM(" Last Command: ");
|
||||
if (!(sh.STATUS_AXIS & sh.STATUS_AXIS_WRONG_CMD)) SERIAL_ECHOPGM("IN");
|
||||
SERIAL_ECHOPGM("VALID ");
|
||||
serialprintPGM(sh.STATUS_AXIS & sh.STATUS_AXIS_NOTPERF_CMD ? PSTR("COMPLETED ") : PSTR("Not PERFORMED"));
|
||||
SERIAL_ECHOPGM_P(sh.STATUS_AXIS & sh.STATUS_AXIS_NOTPERF_CMD ? PSTR("COMPLETED ") : PSTR("Not PERFORMED"));
|
||||
SERIAL_ECHOPAIR("\n...THERMAL: ", !(sh.STATUS_AXIS & sh.STATUS_AXIS_TH_SD) ? "SHUTDOWN " : !(sh.STATUS_AXIS & sh.STATUS_AXIS_TH_WRN) ? "WARNING " : "OK ");
|
||||
}
|
||||
SERIAL_ECHOPGM(" OVERCURRENT:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_OCD) == 0);
|
||||
|
||||
@@ -132,7 +132,7 @@ void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) {
|
||||
SERIAL_ECHOPAIR("...MicroSteps: ", MicroSteps,
|
||||
" ADC_OUT: ", L6470_ADC_out);
|
||||
SERIAL_ECHOPGM(" Vs_compensation: ");
|
||||
serialprintPGM((motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED"));
|
||||
SERIAL_ECHOPGM_P((motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED"));
|
||||
SERIAL_ECHOLNPAIR(" Compensation coefficient: ~", comp_coef * 0.01f);
|
||||
|
||||
SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD),
|
||||
|
||||
@@ -60,10 +60,12 @@ void GcodeSuite::M355() {
|
||||
if (!caselight.on)
|
||||
SERIAL_ECHOLNPGM(STR_OFF);
|
||||
else {
|
||||
if (TERN0(CASELIGHT_USES_BRIGHTNESS, TERN(CASE_LIGHT_USE_NEOPIXEL, true, PWM_PIN(CASE_LIGHT_PIN)))) {
|
||||
SERIAL_ECHOLN(int(caselight.brightness));
|
||||
return;
|
||||
}
|
||||
#if CASELIGHT_USES_BRIGHTNESS
|
||||
if (TERN(CASE_LIGHT_USE_NEOPIXEL, true, PWM_PIN(CASE_LIGHT_PIN))) {
|
||||
SERIAL_ECHOLN(int(caselight.brightness));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
SERIAL_ECHOLNPGM(STR_ON);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void GcodeSuite::M600() {
|
||||
int8_t DXC_ext = target_extruder;
|
||||
if (!parser.seen('T')) { // If no tool index is specified, M600 was (probably) sent in response to filament runout.
|
||||
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
|
||||
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if (idex_is_duplicating())
|
||||
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
|
||||
#else
|
||||
|
||||
@@ -40,7 +40,7 @@ void menu_job_recovery();
|
||||
inline void plr_error(PGM_P const prefix) {
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
DEBUG_ECHO_START();
|
||||
serialprintPGM(prefix);
|
||||
DEBUG_ECHOPGM_P(prefix);
|
||||
DEBUG_ECHOLNPGM(" Job Recovery Data");
|
||||
#else
|
||||
UNUSED(prefix);
|
||||
|
||||
@@ -54,8 +54,8 @@ void GcodeSuite::M413() {
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
if (parser.seen('O')) recovery._outage();
|
||||
#endif
|
||||
if (parser.seen('E')) serialprintPGM(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n"));
|
||||
if (parser.seen('V')) serialprintPGM(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n"));
|
||||
if (parser.seen('E')) SERIAL_ECHOPGM_P(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n"));
|
||||
if (parser.seen('V')) SERIAL_ECHOPGM_P(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ void GcodeSuite::M403() {
|
||||
int8_t index = parser.intval('E', -1),
|
||||
type = parser.intval('F', -1);
|
||||
|
||||
if (WITHIN(index, 0, 4) && WITHIN(type, 0, 2))
|
||||
if (WITHIN(index, 0, EXTRUDERS - 1) && WITHIN(type, 0, 2))
|
||||
mmu2.set_filament_type(index, type);
|
||||
else
|
||||
SERIAL_ECHO_MSG("M403 - bad arguments.");
|
||||
|
||||
@@ -32,8 +32,7 @@ template<typename TMC>
|
||||
void tmc_say_stealth_status(TMC &st) {
|
||||
st.printLabel();
|
||||
SERIAL_ECHOPGM(" driver mode:\t");
|
||||
serialprintPGM(st.get_stealthChop() ? PSTR("stealthChop") : PSTR("spreadCycle"));
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNPGM_P(st.get_stealthChop() ? PSTR("stealthChop") : PSTR("spreadCycle"));
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_stealthChop(TMC &st, const bool enable) {
|
||||
|
||||
@@ -364,6 +364,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if HAS_MESH
|
||||
case 42: G42(); break; // G42: Coordinated move to a mesh point
|
||||
#endif
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
case 53: G53(); break; // G53: (prefix) Apply native workspace
|
||||
case 54: G54(); break; // G54: Switch to Workspace 1
|
||||
@@ -392,10 +396,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
|
||||
case 92: G92(); break; // G92: Set current axis position(s)
|
||||
|
||||
#if HAS_MESH
|
||||
case 42: G42(); break; // G42: Coordinated move to a mesh point
|
||||
#endif
|
||||
|
||||
#if ENABLED(CALIBRATION_GCODE)
|
||||
case 425: G425(); break; // G425: Perform calibration with calibration cube
|
||||
#endif
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
case 6: // D6 Check delay loop accuracy
|
||||
dump_delay_accuracy_check();
|
||||
break;
|
||||
break;
|
||||
|
||||
case 100: { // D100 Disable heaters and attempt a hard hang (Watchdog Test)
|
||||
SERIAL_ECHOLNPGM("Disabling heaters and attempting to trigger Watchdog");
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
inline void report_workspace_plane() {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Workspace Plane ");
|
||||
serialprintPGM(
|
||||
SERIAL_ECHOPGM_P(
|
||||
gcode.workspace_plane == GcodeSuite::PLANE_YZ ? PSTR("YZ\n")
|
||||
: gcode.workspace_plane == GcodeSuite::PLANE_ZX ? PSTR("ZX\n")
|
||||
: PSTR("XY\n")
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
|
||||
static void cap_line(PGM_P const name, bool ena=false) {
|
||||
SERIAL_ECHOPGM("Cap:");
|
||||
serialprintPGM(name);
|
||||
SERIAL_CHAR(':', ena ? '1' : '0');
|
||||
SERIAL_ECHOPGM_P(name);
|
||||
SERIAL_CHAR(':', '0' + ena);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
@@ -106,7 +106,7 @@ void GcodeSuite::M115() {
|
||||
|
||||
// TOGGLE_LIGHTS (M355)
|
||||
cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(CASE_LIGHT_ENABLE));
|
||||
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(CASE_LIGHT_ENABLE, TERN0(CASELIGHT_USES_BRIGHTNESS, TERN(CASE_LIGHT_USE_NEOPIXEL, true, PWM_PIN(CASE_LIGHT_PIN)))));
|
||||
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(CASE_LIGHT_ENABLE, caselight.has_brightness()));
|
||||
|
||||
// EMERGENCY_PARSER (M108, M112, M410, M876)
|
||||
cap_line(PSTR("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
|
||||
|
||||
@@ -34,10 +34,9 @@
|
||||
|
||||
static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8_t ind=-1) {
|
||||
SERIAL_ECHOPGM("Config:");
|
||||
if (pref) serialprintPGM(pref);
|
||||
if (pref) SERIAL_ECHOPGM_P(pref);
|
||||
if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); }
|
||||
serialprintPGM(name);
|
||||
SERIAL_CHAR(':');
|
||||
SERIAL_ECHOPAIR_P(name, AS_CHAR(':'));
|
||||
}
|
||||
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) {
|
||||
config_prefix(name, pref, ind);
|
||||
|
||||
@@ -60,10 +60,6 @@ GCodeQueue queue;
|
||||
// Frequently used G-code strings
|
||||
PGMSTR(G28_STR, "G28");
|
||||
|
||||
#if NO_TIMEOUTS > 0
|
||||
static millis_t last_command_time = 0;
|
||||
#endif
|
||||
|
||||
GCodeQueue::SerialState GCodeQueue::serial_state[NUM_SERIAL] = { 0 };
|
||||
GCodeQueue::RingBuffer GCodeQueue::ring_buffer = { 0 };
|
||||
|
||||
@@ -266,8 +262,7 @@ void GCodeQueue::RingBuffer::ok_to_send() {
|
||||
* Send a "Resend: nnn" message to the host to
|
||||
* indicate that a command needs to be re-sent.
|
||||
*/
|
||||
void GCodeQueue::flush_and_request_resend() {
|
||||
const serial_index_t serial_ind = ring_buffer.command_port();
|
||||
void GCodeQueue::flush_and_request_resend(const serial_index_t serial_ind) {
|
||||
#if HAS_MULTI_SERIAL
|
||||
if (serial_ind < 0) return; // Never mind. Command came from SD or Flash Drive
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
||||
@@ -308,10 +303,9 @@ inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); }
|
||||
void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ECHOPGM_P(err);
|
||||
SERIAL_ECHOLN(serial_state[serial_ind].last_N);
|
||||
SERIAL_ECHOLNPAIR_P(err, serial_state[serial_ind].last_N);
|
||||
while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
|
||||
flush_and_request_resend();
|
||||
flush_and_request_resend(serial_ind);
|
||||
serial_state[serial_ind].count = 0;
|
||||
}
|
||||
|
||||
@@ -616,6 +610,14 @@ void GCodeQueue::get_available_commands() {
|
||||
TERN_(SDSUPPORT, get_sdcard_commands());
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the entire queue in-place. Blocks SD completion/abort until complete.
|
||||
*/
|
||||
void GCodeQueue::exhaust() {
|
||||
while (ring_buffer.occupied()) advance();
|
||||
planner.synchronize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
||||
*/
|
||||
|
||||
@@ -93,7 +93,9 @@ public:
|
||||
|
||||
inline bool full(uint8_t cmdCount=1) const { return length > (BUFSIZE - cmdCount); }
|
||||
|
||||
inline bool empty() const { return length == 0; }
|
||||
inline bool occupied() const { return length != 0; }
|
||||
|
||||
inline bool empty() const { return !occupied(); }
|
||||
|
||||
inline CommandLine& peek_next_command() { return commands[index_r]; }
|
||||
|
||||
@@ -162,6 +164,11 @@ public:
|
||||
*/
|
||||
static void advance();
|
||||
|
||||
/**
|
||||
* Run the entire queue in-place
|
||||
*/
|
||||
static void exhaust();
|
||||
|
||||
/**
|
||||
* Add to the circular command queue the next command from:
|
||||
* - The command-injection queue (injected_commands_P)
|
||||
@@ -185,7 +192,7 @@ public:
|
||||
* Clear the serial line and request a resend of
|
||||
* the next expected line number.
|
||||
*/
|
||||
static void flush_and_request_resend();
|
||||
static void flush_and_request_resend(const serial_index_t serial_ind);
|
||||
|
||||
/**
|
||||
* (Re)Set the current line number for the last received command
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
inline bool SCARA_move_to_cal(const uint8_t delta_a, const uint8_t delta_b) {
|
||||
if (IsRunning()) {
|
||||
forward_kinematics_SCARA(delta_a, delta_b);
|
||||
forward_kinematics(delta_a, delta_b);
|
||||
do_blocking_move_to_xy(cartes);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
#include "../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "../../lcd/extui/lib/dgus/DGUSDisplayDef.h"
|
||||
#endif
|
||||
|
||||
#include "../../MarlinCore.h" // for startOrResumeJob
|
||||
|
||||
/**
|
||||
@@ -48,6 +52,11 @@
|
||||
*/
|
||||
void GcodeSuite::M24() {
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
if ((print_job_timer.isPaused() || print_job_timer.isRunning()) && !parser.seen("ST"))
|
||||
MKS_resume_print_move();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
if (parser.seenval('S')) card.setIndex(parser.value_long());
|
||||
if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
|
||||
@@ -98,9 +107,9 @@ void GcodeSuite::M25() {
|
||||
|
||||
print_job_timer.pause();
|
||||
|
||||
#if DISABLED(DWIN_CREALITY_LCD)
|
||||
ui.reset_status();
|
||||
#endif
|
||||
TERN_(DGUS_LCD_UI_MKS, MKS_pause_print_move());
|
||||
|
||||
IF_DISABLED(DWIN_CREALITY_LCD, ui.reset_status());
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
|
||||
|
||||
@@ -49,7 +49,7 @@ void GcodeSuite::M28() {
|
||||
// Binary transfer mode
|
||||
if ((card.flag.binary_mode = binary_mode)) {
|
||||
SERIAL_ECHO_MSG("Switching to Binary Protocol");
|
||||
TERN_(HAS_MULTI_SERIAL, card.transfer_port_index = queue.port[queue.index_r]);
|
||||
TERN_(HAS_MULTI_SERIAL, card.transfer_port_index = queue.ring_buffer.command_port());
|
||||
}
|
||||
else
|
||||
card.openFileWrite(p);
|
||||
|
||||
@@ -81,6 +81,9 @@ void GcodeSuite::M106() {
|
||||
|
||||
// Set speed, with constraint
|
||||
thermalManager.set_fan_speed(pfan, speed);
|
||||
|
||||
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
||||
thermalManager.set_fan_speed(1 - pfan, speed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +91,13 @@ void GcodeSuite::M106() {
|
||||
* M107: Fan Off
|
||||
*/
|
||||
void GcodeSuite::M107() {
|
||||
const uint8_t p = parser.byteval('P', _ALT_P);
|
||||
thermalManager.set_fan_speed(p, 0);
|
||||
const uint8_t pfan = parser.byteval('P', _ALT_P);
|
||||
if (pfan < _CNT_P) {
|
||||
thermalManager.set_fan_speed(pfan, 0);
|
||||
|
||||
if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating
|
||||
thermalManager.set_fan_speed(1 - pfan, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAS_FAN
|
||||
|
||||
@@ -451,7 +451,7 @@
|
||||
#endif
|
||||
|
||||
// Aliases for LCD features
|
||||
#if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
|
||||
#if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY,DGUS_LCD_UI_MKS)
|
||||
#define HAS_DGUS_LCD 1
|
||||
#endif
|
||||
|
||||
@@ -513,7 +513,7 @@
|
||||
#define HAS_PRUSA_MMU2 1
|
||||
#define HAS_PRUSA_MMU2S 1
|
||||
#endif
|
||||
#if MMU_MODEL >= SMUFF_EMU_MMU2
|
||||
#if MMU_MODEL == SMUFF_EMU_MMU2 || MMU_MODEL == SMUFF_EMU_MMU2S
|
||||
#define HAS_SMUFF 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -575,7 +575,7 @@
|
||||
#undef DISABLE_INACTIVE_EXTRUDER
|
||||
#endif
|
||||
|
||||
// Průša MMU1, MMU 2.0, MMUS 2.0 and SMUFF force SINGLENOZZLE
|
||||
// Průša MMU1, MMU 2.0, MMUS 2.0 and SMuFF force SINGLENOZZLE
|
||||
#if HAS_MMU
|
||||
#define SINGLENOZZLE
|
||||
#endif
|
||||
@@ -924,7 +924,7 @@
|
||||
#define NORMAL_AXIS Z_AXIS
|
||||
#endif
|
||||
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
#if EITHER(MORGAN_SCARA, AXEL_TPARA)
|
||||
#define IS_SCARA 1
|
||||
#define IS_KINEMATIC 1
|
||||
#elif ENABLED(DELTA)
|
||||
|
||||
@@ -128,9 +128,15 @@
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#define HAS_FILAMENT_SENSOR 1
|
||||
#if NUM_RUNOUT_SENSORS > 1
|
||||
#define MULTI_FILAMENT_SENSOR 1
|
||||
#endif
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
#define HAS_FILAMENT_RUNOUT_DISTANCE 1
|
||||
#endif
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
#define WATCH_ALL_RUNOUT_SENSORS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Let SD_FINISHED_RELEASECOMMAND stand in for SD_FINISHED_STEPPERRELEASE
|
||||
@@ -506,6 +512,15 @@
|
||||
#define NEED_HEX_PRINT 1
|
||||
#endif
|
||||
|
||||
// Flags for Case Light having a color property or a single pin
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#if EITHER(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED)
|
||||
#define CASE_LIGHT_IS_COLOR_LED 1
|
||||
#else
|
||||
#define NEED_CASE_LIGHT_PIN 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Flag whether least_squares_fit.cpp is used
|
||||
#if ANY(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_LINEAR, Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
||||
#define NEED_LSF 1
|
||||
|
||||
@@ -143,7 +143,9 @@
|
||||
*/
|
||||
#if IS_SCARA
|
||||
#undef SLOWDOWN
|
||||
#define QUICK_HOME
|
||||
#if DISABLED(AXEL_TPARA)
|
||||
#define QUICK_HOME
|
||||
#endif
|
||||
#define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
|
||||
#endif
|
||||
|
||||
@@ -2479,8 +2481,8 @@
|
||||
#ifndef Z_PROBE_OFFSET_RANGE_MAX
|
||||
#define Z_PROBE_OFFSET_RANGE_MAX 20
|
||||
#endif
|
||||
#ifndef XY_PROBE_SPEED
|
||||
#define XY_PROBE_SPEED ((homing_feedrate_mm_m.x + homing_feedrate_mm_m.y) / 2)
|
||||
#ifndef XY_PROBE_FEEDRATE
|
||||
#define XY_PROBE_FEEDRATE ((homing_feedrate_mm_m.x + homing_feedrate_mm_m.y) / 2)
|
||||
#endif
|
||||
#ifndef NOZZLE_TO_PROBE_OFFSET
|
||||
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }
|
||||
|
||||
@@ -131,7 +131,13 @@
|
||||
#elif defined(DEFAULT_XYJERK)
|
||||
#error "DEFAULT_XYJERK is deprecated. Use DEFAULT_XJERK and DEFAULT_YJERK instead."
|
||||
#elif defined(XY_TRAVEL_SPEED)
|
||||
#error "XY_TRAVEL_SPEED is deprecated. Use XY_PROBE_SPEED instead."
|
||||
#error "XY_TRAVEL_SPEED is now XY_PROBE_FEEDRATE."
|
||||
#elif defined(XY_PROBE_SPEED)
|
||||
#error "XY_PROBE_SPEED is now XY_PROBE_FEEDRATE."
|
||||
#elif defined(Z_PROBE_SPEED_FAST)
|
||||
#error "Z_PROBE_SPEED_FAST is now Z_PROBE_FEEDRATE_FAST."
|
||||
#elif defined(Z_PROBE_SPEED_SLOW)
|
||||
#error "Z_PROBE_SPEED_SLOW is now Z_PROBE_FEEDRATE_SLOW."
|
||||
#elif defined(PROBE_SERVO_DEACTIVATION_DELAY)
|
||||
#error "PROBE_SERVO_DEACTIVATION_DELAY is deprecated. Use DEACTIVATE_SERVOS_AFTER_MOVE instead."
|
||||
#elif defined(SERVO_DEACTIVATION_DELAY)
|
||||
@@ -431,6 +437,8 @@
|
||||
#error "DUAL_NOZZLE_DUPLICATION_MODE is now MULTI_NOZZLE_DUPLICATION."
|
||||
#elif defined(MENU_ITEM_CASE_LIGHT)
|
||||
#error "MENU_ITEM_CASE_LIGHT is now CASE_LIGHT_MENU."
|
||||
#elif defined(CASE_LIGHT_NEOPIXEL_COLOR)
|
||||
#error "CASE_LIGHT_NEOPIXEL_COLOR is now CASE_LIGHT_DEFAULT_COLOR."
|
||||
#elif defined(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
#error "ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED is now SD_ABORT_ON_ENDSTOP_HIT."
|
||||
#elif defined(LPC_SD_LCD) || defined(LPC_SD_ONBOARD) || defined(LPC_SD_CUSTOM_CABLE)
|
||||
@@ -815,26 +823,24 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#if !PIN_EXISTS(FIL_RUNOUT)
|
||||
#error "FILAMENT_RUNOUT_SENSOR requires FIL_RUNOUT_PIN."
|
||||
#elif NUM_RUNOUT_SENSORS > E_STEPPERS
|
||||
#if HAS_PRUSA_MMU2
|
||||
#elif HAS_PRUSA_MMU2 && NUM_RUNOUT_SENSORS != 1
|
||||
#error "NUM_RUNOUT_SENSORS must be 1 with MMU2 / MMU2S."
|
||||
#else
|
||||
#error "NUM_RUNOUT_SENSORS cannot exceed the number of E steppers."
|
||||
#endif
|
||||
#elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2)
|
||||
#error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2."
|
||||
#elif NUM_RUNOUT_SENSORS >= 3 && !PIN_EXISTS(FIL_RUNOUT3)
|
||||
#error "FIL_RUNOUT3_PIN is required with NUM_RUNOUT_SENSORS >= 3."
|
||||
#elif NUM_RUNOUT_SENSORS >= 4 && !PIN_EXISTS(FIL_RUNOUT4)
|
||||
#error "FIL_RUNOUT4_PIN is required with NUM_RUNOUT_SENSORS >= 4."
|
||||
#elif NUM_RUNOUT_SENSORS >= 5 && !PIN_EXISTS(FIL_RUNOUT5)
|
||||
#error "FIL_RUNOUT5_PIN is required with NUM_RUNOUT_SENSORS >= 5."
|
||||
#elif NUM_RUNOUT_SENSORS >= 6 && !PIN_EXISTS(FIL_RUNOUT6)
|
||||
#error "FIL_RUNOUT6_PIN is required with NUM_RUNOUT_SENSORS >= 6."
|
||||
#elif NUM_RUNOUT_SENSORS >= 7 && !PIN_EXISTS(FIL_RUNOUT7)
|
||||
#error "FIL_RUNOUT7_PIN is required with NUM_RUNOUT_SENSORS >= 7."
|
||||
#elif NUM_RUNOUT_SENSORS != 1 && NUM_RUNOUT_SENSORS != E_STEPPERS
|
||||
#error "NUM_RUNOUT_SENSORS must be either 1 or number of E steppers."
|
||||
#elif NUM_RUNOUT_SENSORS >= 8 && !PIN_EXISTS(FIL_RUNOUT8)
|
||||
#error "FIL_RUNOUT8_PIN is required with NUM_RUNOUT_SENSORS >= 8."
|
||||
#elif NUM_RUNOUT_SENSORS >= 7 && !PIN_EXISTS(FIL_RUNOUT7)
|
||||
#error "FIL_RUNOUT7_PIN is required with NUM_RUNOUT_SENSORS >= 7."
|
||||
#elif NUM_RUNOUT_SENSORS >= 6 && !PIN_EXISTS(FIL_RUNOUT6)
|
||||
#error "FIL_RUNOUT6_PIN is required with NUM_RUNOUT_SENSORS >= 6."
|
||||
#elif NUM_RUNOUT_SENSORS >= 5 && !PIN_EXISTS(FIL_RUNOUT5)
|
||||
#error "FIL_RUNOUT5_PIN is required with NUM_RUNOUT_SENSORS >= 5."
|
||||
#elif NUM_RUNOUT_SENSORS >= 4 && !PIN_EXISTS(FIL_RUNOUT4)
|
||||
#error "FIL_RUNOUT4_PIN is required with NUM_RUNOUT_SENSORS >= 4."
|
||||
#elif NUM_RUNOUT_SENSORS >= 3 && !PIN_EXISTS(FIL_RUNOUT3)
|
||||
#error "FIL_RUNOUT3_PIN is required with NUM_RUNOUT_SENSORS >= 3."
|
||||
#elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2)
|
||||
#error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2."
|
||||
#elif BOTH(FIL_RUNOUT1_PULLUP, FIL_RUNOUT1_PULLDOWN)
|
||||
#error "You can't enable FIL_RUNOUT1_PULLUP and FIL_RUNOUT1_PULLDOWN at the same time."
|
||||
#elif BOTH(FIL_RUNOUT2_PULLUP, FIL_RUNOUT2_PULLDOWN)
|
||||
@@ -913,7 +919,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Multi-Material-Unit 2 / SMUFF requirements
|
||||
* Multi-Material-Unit 2 / SMuFF requirements
|
||||
*/
|
||||
#if HAS_PRUSA_MMU2
|
||||
#if EXTRUDERS != 5
|
||||
@@ -1221,8 +1227,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
/**
|
||||
* Allow only one kinematic type to be defined
|
||||
*/
|
||||
#if MANY(DELTA, MORGAN_SCARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY)
|
||||
#error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, COREZY, or MARKFORGED_XY."
|
||||
#if MANY(DELTA, MORGAN_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY)
|
||||
#error "Please enable only one of DELTA, MORGAN_SCARA, AXEL_TPARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, COREZY, or MARKFORGED_XY."
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1635,7 +1641,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
* Allen Key
|
||||
* Deploying the Allen Key probe uses big moves in z direction. Too dangerous for an unhomed z-axis.
|
||||
*/
|
||||
#if BOTH(Z_PROBE_ALLEN_KEY, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && (Z_HOME_DIR < 0)
|
||||
#if BOTH(Z_PROBE_ALLEN_KEY, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && Z_HOME_DIR < 0
|
||||
#error "You can't home to a Z min endstop with a Z_PROBE_ALLEN_KEY."
|
||||
#endif
|
||||
|
||||
@@ -1698,9 +1704,9 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
/**
|
||||
* Case Light requirements
|
||||
*/
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#if NEED_CASE_LIGHT_PIN
|
||||
#if !PIN_EXISTS(CASE_LIGHT)
|
||||
#error "CASE_LIGHT_ENABLE requires CASE_LIGHT_PIN to be defined."
|
||||
#error "CASE_LIGHT_ENABLE requires CASE_LIGHT_PIN, CASE_LIGHT_USE_NEOPIXEL, or CASE_LIGHT_USE_RGB_LED."
|
||||
#elif CASE_LIGHT_PIN == FAN_PIN
|
||||
#error "CASE_LIGHT_PIN conflicts with FAN_PIN. Resolve before continuing."
|
||||
#endif
|
||||
@@ -2316,7 +2322,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
||||
+ (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
|
||||
+ (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
|
||||
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
|
||||
+ COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY) \
|
||||
+ COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY,DGUS_LCD_UI_MKS) \
|
||||
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY, DWIN_CREALITY_LCD) \
|
||||
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \
|
||||
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
|
||||
@@ -2907,12 +2913,16 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKUP_POWER_SUPPLY) && !PIN_EXISTS(POWER_LOSS)
|
||||
#error "BACKUP_POWER_SUPPLY requires a POWER_LOSS_PIN."
|
||||
#endif
|
||||
|
||||
#if BOTH(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN)
|
||||
#error "You can't enable POWER_LOSS_PULLUP and POWER_LOSS_PULLDOWN at the same time."
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#if ENABLED(BACKUP_POWER_SUPPLY) && !PIN_EXISTS(POWER_LOSS)
|
||||
#error "BACKUP_POWER_SUPPLY requires a POWER_LOSS_PIN."
|
||||
#elif BOTH(POWER_LOSS_RECOVER_ZHOME, Z_SAFE_HOMING)
|
||||
#error "POWER_LOSS_RECOVER_ZHOME cannot be used with Z_SAFE_HOMING."
|
||||
#elif BOTH(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN)
|
||||
#error "You can't enable POWER_LOSS_PULLUP and POWER_LOSS_PULLDOWN at the same time."
|
||||
#elif BOTH(IS_CARTESIAN, POWER_LOSS_RECOVER_ZHOME) && Z_HOME_DIR < 0 && !defined(POWER_LOSS_ZHOME_POS)
|
||||
#error "POWER_LOSS_RECOVER_ZHOME requires POWER_LOSS_ZHOME_POS for a Cartesian that homes to ZMIN."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2021-02-27"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-03-06"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,7 @@ bool DWIN_Handshake(void) {
|
||||
#endif
|
||||
LCD_SERIAL.begin(LCD_BAUDRATE);
|
||||
const millis_t serial_connect_timeout = millis() + 1000UL;
|
||||
while (!LCD_SERIAL && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
||||
while (!LCD_SERIAL.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
||||
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x00);
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* dgus_lcd.cpp
|
||||
*
|
||||
* DGUS implementation for Marlin by coldtobi, Feb-May 2019
|
||||
* lcd/extui/dgus_lcd.cpp
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
@@ -125,11 +123,10 @@ namespace ExtUI {
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS);
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void onPidTuning(const result_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace Anycubic {
|
||||
|
||||
void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEN string to the panel
|
||||
#if ACDEBUG(AC_SOME)
|
||||
serialprintPGM(str);
|
||||
SERIAL_ECHOPGM_P(str);
|
||||
#endif
|
||||
while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
|
||||
}
|
||||
@@ -310,7 +310,7 @@ namespace Anycubic {
|
||||
|
||||
bool ChironTFT::ReadTFTCommand() {
|
||||
bool command_ready = false;
|
||||
while(TFTSer.available() > 0 && command_len < MAX_CMND_LEN) {
|
||||
while (TFTSer.available() > 0 && command_len < MAX_CMND_LEN) {
|
||||
panel_command[command_len] = TFTSer.read();
|
||||
if (panel_command[command_len] == '\n') {
|
||||
command_ready = true;
|
||||
@@ -338,7 +338,7 @@ namespace Anycubic {
|
||||
|
||||
int8_t ChironTFT::Findcmndpos(const char * buff, char q) {
|
||||
int8_t pos = 0;
|
||||
do { if (buff[pos] == q) return pos; } while(++pos < MAX_CMND_LEN);
|
||||
do { if (buff[pos] == q) return pos; } while (++pos < MAX_CMND_LEN);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS implementation written by coldtobi in 2019 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
|
||||
#if HOTENDS > 2
|
||||
#error "More than 2 hotends not implemented on the Display UI design."
|
||||
#warning "More than 2 hotends not implemented on DGUS Display UI."
|
||||
#endif
|
||||
|
||||
#include "../../ui_api.h"
|
||||
@@ -46,6 +44,8 @@
|
||||
#include "DGUSVPVariable.h"
|
||||
#include "DGUSDisplayDef.h"
|
||||
|
||||
DGUSDisplay dgusdisplay;
|
||||
|
||||
// Preamble... 2 Bytes, usually 0x5A 0xA5, but configurable
|
||||
constexpr uint8_t DGUS_HEADER1 = 0x5A;
|
||||
constexpr uint8_t DGUS_HEADER2 = 0xA5;
|
||||
@@ -62,8 +62,10 @@ void DGUSDisplay::InitDisplay() {
|
||||
#define LCD_BAUDRATE 115200
|
||||
#endif
|
||||
LCD_SERIAL.begin(LCD_BAUDRATE);
|
||||
if (TERN1(POWER_LOSS_RECOVERY, !recovery.valid()))
|
||||
RequestScreen(TERN(SHOW_BOOTSCREEN, DGUSLCD_SCREEN_BOOT, DGUSLCD_SCREEN_MAIN));
|
||||
#if BOTH(DGUS_LCD_UI_MKS, POWER_LOSS_RECOVERY)
|
||||
if (!recovery.valid()) delay(LOGO_TIME_DELAY);
|
||||
#endif
|
||||
RequestScreen(TERN(SHOW_BOOTSCREEN, DGUSLCD_SCREEN_BOOT, DGUSLCD_SCREEN_MAIN));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr) {
|
||||
@@ -82,12 +84,12 @@ void DGUSDisplay::WriteVariable(uint16_t adr, const void* values, uint8_t values
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) {
|
||||
value = (value & 0xffU) << 8U | (value >> 8U);
|
||||
value = (value & 0xFFU) << 8U | (value >> 8U);
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, int16_t value) {
|
||||
value = (value & 0xffU) << 8U | (value >> 8U);
|
||||
value = (value & 0xFFU) << 8U | (value >> 8U);
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
}
|
||||
|
||||
@@ -99,15 +101,21 @@ void DGUSDisplay::WriteVariable(uint16_t adr, int8_t value) {
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(int8_t));
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
void DGUSDisplay::MKS_WriteVariable(uint16_t adr, uint8_t value) {
|
||||
WriteVariable(adr, static_cast<const void *>(&value), sizeof(uint8_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, long value) {
|
||||
union { long l; char lb[4]; } endian;
|
||||
char tmp[4];
|
||||
endian.l = value;
|
||||
tmp[0] = endian.lb[3];
|
||||
tmp[1] = endian.lb[2];
|
||||
tmp[2] = endian.lb[1];
|
||||
tmp[3] = endian.lb[0];
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
|
||||
union { long l; char lb[4]; } endian;
|
||||
char tmp[4];
|
||||
endian.l = value;
|
||||
tmp[0] = endian.lb[3];
|
||||
tmp[1] = endian.lb[2];
|
||||
tmp[2] = endian.lb[1];
|
||||
tmp[3] = endian.lb[0];
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr) {
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/* DGUS implementation written by coldtobi in 2019 for Marlin */
|
||||
/**
|
||||
* lcd/extui/lib/dgus/DGUSDisplay.h
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -34,6 +36,7 @@
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
//#define DEBUG_DGUSLCD
|
||||
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
|
||||
#include "../../../../core/debug_out.h"
|
||||
|
||||
@@ -60,6 +63,8 @@ public:
|
||||
static void WriteVariable(uint16_t adr, uint8_t value);
|
||||
static void WriteVariable(uint16_t adr, int8_t value);
|
||||
static void WriteVariable(uint16_t adr, long value);
|
||||
static void MKS_WriteVariable(uint16_t adr, uint8_t value);
|
||||
|
||||
|
||||
// Utility functions for bridging ui_api and dbus
|
||||
template<typename T, float(*Getter)(const T), T selector, typename WireType=uint16_t>
|
||||
|
||||
@@ -21,15 +21,16 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/* DGUS implementation written by coldtobi in 2019 for Marlin */
|
||||
/**
|
||||
* lcd/extui/lib/dgus/DGUSDisplayDef.h
|
||||
* Defines the interaction between Marlin and the display firmware
|
||||
*/
|
||||
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// This file defines the interaction between Marlin and the display firmware.
|
||||
|
||||
// information on which screen which VP is displayed
|
||||
// Information on which screen which VP is displayed.
|
||||
// As this is a sparse table, two arrays are needed:
|
||||
// one to list the VPs of one screen and one to map screens to the lists.
|
||||
// (Strictly this would not be necessary, but allows to only send data the display needs and reducing load on Marlin)
|
||||
@@ -47,6 +48,8 @@ extern const struct DGUS_VP_Variable ListOfVP[];
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
#include "origin/DGUSDisplayDef.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "mks/DGUSDisplayDef.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
#include "fysetc/DGUSDisplayDef.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
|
||||
@@ -25,46 +25,42 @@
|
||||
#if HAS_DGUS_LCD
|
||||
|
||||
#include "DGUSScreenHandler.h"
|
||||
#include "DGUSDisplay.h"
|
||||
#include "DGUSVPVariable.h"
|
||||
#include "DGUSDisplayDef.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../../MarlinCore.h"
|
||||
#include "../../../../gcode/queue.h"
|
||||
#include "../../../../libs/duration_t.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../gcode/queue.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../sd/cardreader.h"
|
||||
#include "../../../../libs/duration_t.h"
|
||||
#include "../../../../module/printcounter.h"
|
||||
#include "../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
DGUSScreenHandler ScreenHandler;
|
||||
|
||||
uint16_t DGUSScreenHandler::ConfirmVP;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
int16_t DGUSScreenHandler::top_file = 0;
|
||||
int16_t DGUSScreenHandler::file_to_print = 0;
|
||||
static ExtUI::FileList filelist;
|
||||
#endif
|
||||
|
||||
void (*DGUSScreenHandler::confirm_action_cb)() = nullptr;
|
||||
|
||||
//DGUSScreenHandler ScreenHandler;
|
||||
|
||||
DGUSLCD_Screens DGUSScreenHandler::current_screen;
|
||||
DGUSLCD_Screens DGUSScreenHandler::past_screens[NUM_PAST_SCREENS];
|
||||
uint8_t DGUSScreenHandler::update_ptr;
|
||||
uint16_t DGUSScreenHandler::skipVP;
|
||||
bool DGUSScreenHandler::ScreenComplete;
|
||||
|
||||
//DGUSDisplay dgusdisplay;
|
||||
void (*DGUSScreenHandler::confirm_action_cb)() = nullptr;
|
||||
|
||||
// endianness swap
|
||||
uint16_t swap16(const uint16_t value) { return (value & 0xffU) << 8U | (value >> 8U); }
|
||||
#if ENABLED(SDSUPPORT)
|
||||
int16_t DGUSScreenHandler::top_file = 0,
|
||||
DGUSScreenHandler::file_to_print = 0;
|
||||
static ExtUI::FileList filelist;
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
filament_data_t filament_data;
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) {
|
||||
DGUS_VP_Variable ramcopy;
|
||||
@@ -87,14 +83,12 @@ void DGUSScreenHandler::sendinfoscreen(const char* line1, const char* line2, con
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleUserConfirmationPopUp(uint16_t VP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1, bool l2, bool l3, bool l4) {
|
||||
if (current_screen == DGUSLCD_SCREEN_CONFIRM) {
|
||||
// Already showing a pop up, so we need to cancel that first.
|
||||
if (current_screen == DGUSLCD_SCREEN_CONFIRM) // Already showing a pop up, so we need to cancel that first.
|
||||
PopToOldScreen();
|
||||
}
|
||||
|
||||
ConfirmVP = VP;
|
||||
sendinfoscreen(line1, line2, line3, line4, l1, l2, l3, l4);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_CONFIRM);
|
||||
GotoScreen(DGUSLCD_SCREEN_CONFIRM);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::setstatusmessage(const char *msg) {
|
||||
@@ -130,7 +124,7 @@ void DGUSScreenHandler::DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
//DEBUG_ECHOPAIR(" DGUS_LCD_SendWordValueToDisplay ", var.VP);
|
||||
//DEBUG_ECHOLNPAIR(" data ", *(uint16_t *)var.memadr);
|
||||
uint16_t tmp = *(uint8_t *) var.memadr +1 ; // +1 -> avoid rounding issues for the display.
|
||||
uint16_t tmp = *(uint8_t *) var.memadr + 1; // +1 -> avoid rounding issues for the display.
|
||||
tmp = map(tmp, 0, 255, 0, 100);
|
||||
dgusdisplay.WriteVariable(var.VP, tmp);
|
||||
}
|
||||
@@ -157,7 +151,9 @@ void DGUSScreenHandler::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) {
|
||||
void DGUSScreenHandler::DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (var.memadr) {
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("FAN value get:", value);
|
||||
*(uint8_t*)var.memadr = map(constrain(value, 0, 100), 0, 100, 0, 255);
|
||||
DEBUG_ECHOLNPAIR("FAN value change:", *(uint8_t*)var.memadr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +230,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
|
||||
// Send fan status value to the display.
|
||||
#if HAS_FAN
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
DEBUG_ECHOPAIR(" DGUSLCD_SendFanStatusToDisplay ", var.VP);
|
||||
@@ -243,6 +240,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
|
||||
dgusdisplay.WriteVariable(var.VP, data_to_send);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Send heater status value to the display.
|
||||
@@ -257,6 +255,7 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
// In FYSETC UI design there are 10 statuses to loop
|
||||
static uint16_t period = 0;
|
||||
@@ -270,6 +269,7 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
period = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
@@ -319,7 +319,7 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
DEBUG_ECHOPAIR("new topfile adjusted:", top_file);
|
||||
}
|
||||
else if (!filelist.isAtRootDir()) {
|
||||
filelist.upDir();
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, filelist.upDir());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
@@ -327,54 +327,6 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
if (old_top != top_file) ForceCompleteUpdate();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
ScreenHandler.GotoScreen(
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
DGUSLCD_SCREEN_STATUS
|
||||
#else
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
case 0: // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) ExtUI::resumePrint();
|
||||
break;
|
||||
case 1: // Pause
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) ExtUI::pausePrint();
|
||||
break;
|
||||
case 2: // Abort
|
||||
ScreenHandler.HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
ExtUI::stopPrint();
|
||||
GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
@@ -385,36 +337,11 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTTUNE);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
if (filelist.seek(top_file + target_line))
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0);
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = ScreenHandler.getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardError() {
|
||||
DGUSScreenHandler::SDCardRemoved();
|
||||
ScreenHandler.sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("SD card error"), nullptr, true, true, true, true);
|
||||
ScreenHandler.SetupConfirmAction(nullptr);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("SD card error"), nullptr, true, true, true, true);
|
||||
SetupConfirmAction(nullptr);
|
||||
GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
@@ -428,7 +355,7 @@ void DGUSScreenHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr)
|
||||
const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) {
|
||||
const uint16_t *ret;
|
||||
const struct VPMapping *map = VPMap;
|
||||
while (ret = (uint16_t*) pgm_read_ptr(&(map->VPList))) {
|
||||
while ((ret = (uint16_t*) pgm_read_ptr(&(map->VPList)))) {
|
||||
if (pgm_read_byte(&(map->screen)) == screen) return ret;
|
||||
map++;
|
||||
}
|
||||
@@ -455,31 +382,9 @@ void DGUSScreenHandler::ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
// special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
thermalManager.disable_all_heaters();
|
||||
ScreenHandler.ForceCompleteUpdate(); // hint to send all data.
|
||||
ForceCompleteUpdate(); // hint to send all data.
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
@@ -490,27 +395,30 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_T_E0_Set:
|
||||
NOMORE(newvalue, HEATER_0_MAXTEMP);
|
||||
thermalManager.setTargetHotend(newvalue, 0);
|
||||
acceptedvalue = thermalManager.temp_hotend[0].target;
|
||||
acceptedvalue = thermalManager.degTargetHotend(0);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_T_E1_Set:
|
||||
NOMORE(newvalue, HEATER_1_MAXTEMP);
|
||||
thermalManager.setTargetHotend(newvalue, 1);
|
||||
acceptedvalue = thermalManager.temp_hotend[1].target;
|
||||
break;
|
||||
acceptedvalue = thermalManager.degTargetHotend(1);
|
||||
break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_T_Bed_Set:
|
||||
NOMORE(newvalue, BED_MAXTEMP);
|
||||
thermalManager.setTargetBed(newvalue);
|
||||
acceptedvalue = thermalManager.temp_bed.target;
|
||||
acceptedvalue = thermalManager.degTargetBed();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// reply to display the new value to update the view if the new value was rejected by the Thermal Manager.
|
||||
if (newvalue != acceptedvalue && var.send_to_display_handler) var.send_to_display_handler(var);
|
||||
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
@@ -528,7 +436,7 @@ void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_p
|
||||
}
|
||||
|
||||
planner.set_flow(target_extruder, newvalue);
|
||||
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
#else
|
||||
UNUSED(var); UNUSED(val_ptr);
|
||||
#endif
|
||||
@@ -563,97 +471,6 @@ void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; //FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[]="\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
//while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
return;
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleMotorLockUnlock");
|
||||
|
||||
@@ -665,22 +482,6 @@ void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_p
|
||||
queue.enqueue_one_now(buf);
|
||||
}
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
if (value) {
|
||||
queue.inject_P(PSTR("M1000"));
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
else {
|
||||
recovery.cancel();
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleSettings");
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
@@ -688,10 +489,11 @@ void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
default: break;
|
||||
case 1:
|
||||
TERN_(PRINTCOUNTER, print_job_timer.initStats());
|
||||
queue.inject_P(PSTR("M502\nM500"));
|
||||
settings.reset();
|
||||
settings.save();
|
||||
break;
|
||||
case 2: queue.inject_P(PSTR("M501")); break;
|
||||
case 3: queue.inject_P(PSTR("M500")); break;
|
||||
case 2: settings.load(); break;
|
||||
case 3: settings.save(); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,7 +502,7 @@ void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_
|
||||
|
||||
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
||||
float value = (float)value_raw/10;
|
||||
float value = (float)value_raw / 10;
|
||||
ExtUI::axis_t axis;
|
||||
switch (var.VP) {
|
||||
case VP_X_STEP_PER_MM: axis = ExtUI::axis_t::X; break;
|
||||
@@ -711,7 +513,7 @@ void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_
|
||||
DEBUG_ECHOLNPAIR_F("value:", value);
|
||||
ExtUI::setAxisSteps_per_mm(value, axis);
|
||||
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(axis));
|
||||
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -720,56 +522,24 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
|
||||
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
||||
float value = (float)value_raw/10;
|
||||
float value = (float)value_raw / 10;
|
||||
ExtUI::extruder_t extruder;
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break;
|
||||
#endif
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break;
|
||||
#endif
|
||||
}
|
||||
DEBUG_ECHOLNPAIR_F("value:", value);
|
||||
ExtUI::setAxisSteps_per_mm(value,extruder);
|
||||
ExtUI::setAxisSteps_per_mm(value, extruder);
|
||||
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(extruder));
|
||||
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
return;
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandlePIDAutotune");
|
||||
|
||||
@@ -777,23 +547,23 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
|
||||
switch (var.VP) {
|
||||
default: break;
|
||||
#if ENABLED(PIDTEMP)
|
||||
#if HOTENDS >= 1
|
||||
case VP_PID_AUTOTUNE_E0: // Autotune Extruder 0
|
||||
sprintf(buf, "M303 E%d C5 S210 U1", ExtUI::extruder_t::E0);
|
||||
#if ENABLED(PIDTEMP)
|
||||
#if HOTENDS >= 1
|
||||
case VP_PID_AUTOTUNE_E0: // Autotune Extruder 0
|
||||
sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E0);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_PID_AUTOTUNE_E1:
|
||||
sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E1);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case VP_PID_AUTOTUNE_BED:
|
||||
sprintf_P(buf, PSTR("M303 E-1 C5 S70 U1"));
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_PID_AUTOTUNE_E1:
|
||||
sprintf(buf, "M303 E%d C5 S210 U1", ExtUI::extruder_t::E1);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case VP_PID_AUTOTUNE_BED:
|
||||
sprintf(buf, "M303 E-1 C5 S70 U1");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (buf[0]) queue.enqueue_one_now(buf);
|
||||
@@ -803,7 +573,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
GotoScreen(DGUSLCD_SCREEN_WAITING);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
void DGUSScreenHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
@@ -811,19 +581,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
||||
|
||||
const float offset = float(int16_t(swap16(*(uint16_t*)val_ptr))) / 100.0f;
|
||||
ExtUI::setZOffset_mm(offset);
|
||||
ScreenHandler.skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr);
|
||||
int16_t steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -849,8 +607,8 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
|
||||
#if HOTENDS >= 3
|
||||
case VP_E2_CONTROL:
|
||||
#endif
|
||||
preheat_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
break;
|
||||
preheat_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
break;
|
||||
|
||||
case VP_BED_CONTROL:
|
||||
preheat_temp = PREHEAT_1_TEMP_BED;
|
||||
@@ -900,149 +658,49 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 0);
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 1);
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 0);
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 1);
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Go to the preheat screen to show the heating progress
|
||||
GotoScreen(DGUSLCD_SCREEN_PREHEAT);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // DGUS_PREHEAT_UI
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
typedef struct {
|
||||
ExtUI::extruder_t extruder; // which extruder to operate
|
||||
uint8_t action; // load or unload
|
||||
bool heated; // heating done ?
|
||||
float purge_length; // the length to extrude before unload, prevent filament jam
|
||||
} filament_data_t;
|
||||
|
||||
static filament_data_t filament_data;
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) // Load filament type
|
||||
filament_data.action = 1;
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t value = swap16(*(uint16_t*)val_ptr);
|
||||
if (value) {
|
||||
queue.inject_P(PSTR("M1000"));
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), 32, true);
|
||||
GotoScreen(PLR_SCREEN_RECOVER);
|
||||
}
|
||||
else // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
else {
|
||||
recovery.cancel();
|
||||
GotoScreen(PLR_SCREEN_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder)+movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void DGUSScreenHandler::UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup) {
|
||||
DEBUG_ECHOLNPAIR("SetNewScreen: ", newscreen);
|
||||
|
||||
if (!popup) {
|
||||
memmove(&past_screens[1], &past_screens[0], sizeof(past_screens) - 1);
|
||||
past_screens[0] = current_screen;
|
||||
}
|
||||
|
||||
current_screen = newscreen;
|
||||
skipVP = 0;
|
||||
ForceCompleteUpdate();
|
||||
@@ -1062,7 +720,7 @@ void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
if (!VPList) {
|
||||
DEBUG_ECHOLNPAIR(" NO SCREEN FOR: ", current_screen);
|
||||
ScreenComplete = true;
|
||||
return; // nothing to do, likely a bug or boring screen.
|
||||
return; // nothing to do, likely a bug or boring screen.
|
||||
}
|
||||
|
||||
// Round-robin updating of all VPs.
|
||||
@@ -1076,14 +734,14 @@ void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
update_ptr = 0;
|
||||
DEBUG_ECHOLNPGM(" UpdateScreenVPData done");
|
||||
ScreenComplete = true;
|
||||
return; // Screen completed.
|
||||
return; // Screen completed.
|
||||
}
|
||||
|
||||
if (VP == skipVP) { skipVP = 0; continue; }
|
||||
|
||||
DGUS_VP_Variable rcpy;
|
||||
if (populate_VPVar(VP, &rcpy)) {
|
||||
uint8_t expected_tx = 6 + rcpy.size; // expected overhead is 6 bytes + payload.
|
||||
uint8_t expected_tx = 6 + rcpy.size; // expected overhead is 6 bytes + payload.
|
||||
// Send the VP to the display, but try to avoid overrunning the Tx Buffer.
|
||||
// But send at least one VP, to avoid getting stalled.
|
||||
if (rcpy.send_to_display_handler && (!sent_one || expected_tx <= dgusdisplay.GetFreeTxBuffer())) {
|
||||
@@ -1092,11 +750,11 @@ void DGUSScreenHandler::UpdateScreenVPData() {
|
||||
rcpy.send_to_display_handler(rcpy);
|
||||
}
|
||||
else {
|
||||
//auto x=dgusdisplay.GetFreeTxBuffer();
|
||||
// auto x=dgusdisplay.GetFreeTxBuffer();
|
||||
//DEBUG_ECHOLNPAIR(" tx almost full: ", x);
|
||||
//DEBUG_ECHOPAIR(" update_ptr ", update_ptr);
|
||||
ScreenComplete = false;
|
||||
return; // please call again!
|
||||
return; // please call again!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1108,29 +766,6 @@ void DGUSScreenHandler::GotoScreen(DGUSLCD_Screens screen, bool ispopup) {
|
||||
UpdateNewScreen(screen, ispopup);
|
||||
}
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
|
||||
booted = true;
|
||||
GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
void DGUSDisplay::RequestScreen(DGUSLCD_Screens screen) {
|
||||
DEBUG_ECHOLNPAIR("GotoScreen ", screen);
|
||||
const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screen >> 8U), (unsigned char) (screen & 0xFFU) };
|
||||
|
||||
@@ -21,212 +21,38 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "DGUSDisplay.h"
|
||||
#include "DGUSVPVariable.h"
|
||||
/**
|
||||
* lcd/extui/lib/dgus/DGUSScreenHandler.h
|
||||
*/
|
||||
|
||||
#include "../../../../inc/MarlinConfig.h"
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
#include "../../ui_api.h"
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
static bool loop();
|
||||
typedef struct {
|
||||
ExtUI::extruder_t extruder; // which extruder to operate
|
||||
uint8_t action; // load or unload
|
||||
bool heated; // heating done ?
|
||||
float purge_length; // the length to extrude before unload, prevent filament jam
|
||||
} filament_data_t;
|
||||
|
||||
/// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
/// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
extern filament_data_t filament_data;
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
#endif
|
||||
|
||||
/// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char* msg);
|
||||
/// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
// Hook for manual move option
|
||||
static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for settings
|
||||
static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
// endianness swap
|
||||
inline uint16_t swap16(const uint16_t value) { return (value & 0xFFU) << 8U | (value >> 8U); }
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// User hit the pause, resume or abort button.
|
||||
static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
/// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
/// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
/// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
/// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
/// Send a float value to the display.
|
||||
/// Display will get a 4-byte integer scaled to the number of digits:
|
||||
/// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
/// Send a float value to the display.
|
||||
/// Display will get a 2-byte integer scaled to the number of digits:
|
||||
/// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
DEBUG_ECHOLNPAIR_F(" >> ", f, 6);
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (int16_t)f);
|
||||
}
|
||||
}
|
||||
|
||||
/// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
/// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; ///< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; ///< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; ///< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; ///< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; ///< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; ///< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; ///< file on top of file chooser
|
||||
static int16_t file_to_print; ///< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
#include "origin/DGUSScreenHandler.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "mks/DGUSScreenHandler.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
#include "fysetc/DGUSScreenHandler.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
#include "hiprecy/DGUSScreenHandler.h"
|
||||
#endif
|
||||
|
||||
extern DGUSScreenHandler ScreenHandler;
|
||||
|
||||
@@ -0,0 +1,418 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../../MarlinCore.h"
|
||||
#include "../../../../../gcode/queue.h"
|
||||
#include "../../../../../libs/duration_t.h"
|
||||
#include "../../../../../module/settings.h"
|
||||
#include "../../../../../module/temperature.h"
|
||||
#include "../../../../../module/motion.h"
|
||||
#include "../../../../../module/planner.h"
|
||||
#include "../../../../../module/printcounter.h"
|
||||
#include "../../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
case 0: { // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: // Pause
|
||||
|
||||
GotoScreen(MKSLCD_SCREEN_PAUSE);
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::pausePrint();
|
||||
//ExtUI::mks_pausePrint();
|
||||
}
|
||||
break;
|
||||
case 2: // Abort
|
||||
HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
|
||||
if (filelist.seek(top_file + target_line)) {
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename());
|
||||
}
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
DEBUG_ECHOLNPAIR("\n DEBUG target", target);
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
// Special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; // FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[] = "\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
// while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) { // Load filament type
|
||||
filament_data.action = 1;
|
||||
}
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
}
|
||||
else { // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
}
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
|
||||
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
|
||||
booted = true;
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_FYSETC
|
||||
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char* msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
// Hook for manual move option
|
||||
static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for settings
|
||||
static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the pause, resume or abort button.
|
||||
static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 4-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 2-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
DEBUG_ECHOLNPAIR_F(" >> ", f, 6);
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (int16_t)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; //< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; //< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; //< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#endif
|
||||
@@ -0,0 +1,418 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_HYPRECY)
|
||||
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../../MarlinCore.h"
|
||||
#include "../../../../../gcode/queue.h"
|
||||
#include "../../../../../libs/duration_t.h"
|
||||
#include "../../../../../module/settings.h"
|
||||
#include "../../../../../module/temperature.h"
|
||||
#include "../../../../../module/motion.h"
|
||||
#include "../../../../../module/planner.h"
|
||||
#include "../../../../../module/printcounter.h"
|
||||
#include "../../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
case 0: { // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: // Pause
|
||||
|
||||
GotoScreen(MKSLCD_SCREEN_PAUSE);
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::pausePrint();
|
||||
//ExtUI::mks_pausePrint();
|
||||
}
|
||||
break;
|
||||
case 2: // Abort
|
||||
HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
|
||||
if (filelist.seek(top_file + target_line)) {
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename());
|
||||
}
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
DEBUG_ECHOLNPAIR("\n DEBUG target", target);
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
// Special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; // FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[] = "\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
// while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) { // Load filament type
|
||||
filament_data.action = 1;
|
||||
}
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
}
|
||||
else { // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
}
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
|
||||
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
|
||||
booted = true;
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_HYPRECY
|
||||
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char* msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
// Hook for manual move option
|
||||
static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for settings
|
||||
static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the pause, resume or abort button.
|
||||
static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 4-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 2-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
DEBUG_ECHOLNPAIR_F(" >> ", f, 6);
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (int16_t)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; //< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; //< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; //< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#endif
|
||||
@@ -0,0 +1,795 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
|
||||
#include "DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../../module/temperature.h"
|
||||
#include "../../../../../module/motion.h"
|
||||
#include "../../../../../module/planner.h"
|
||||
|
||||
#include "../../../ui_api.h"
|
||||
#include "../../../../marlinui.h"
|
||||
|
||||
#if ENABLED(HAS_STEALTHCHOP)
|
||||
#include "../../../../module/stepper/trinamic.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
|
||||
uint16_t distanceMove = 1;
|
||||
float distanceFilament = 10;
|
||||
uint16_t FilamentSpeed = 25;
|
||||
float ZOffset_distance = 0.1;
|
||||
float mesh_adj_distance = 0.1;
|
||||
float Z_distance = 0.1;
|
||||
|
||||
int16_t level_1_x_point = 20;
|
||||
int16_t level_1_y_point = 20;
|
||||
|
||||
int16_t level_2_x_point = 20;
|
||||
int16_t level_2_y_point = 20;
|
||||
|
||||
int16_t level_3_x_point = 20;
|
||||
int16_t level_3_y_point = 20;
|
||||
|
||||
int16_t level_4_x_point = 20;
|
||||
int16_t level_4_y_point = 20;
|
||||
int16_t level_5_x_point = X_MAX_POS / 2;
|
||||
int16_t level_5_y_point = Y_MAX_POS / 2;
|
||||
|
||||
uint16_t tim_h;
|
||||
uint16_t tim_m;
|
||||
uint16_t tim_s;
|
||||
|
||||
uint16_t x_park_pos = 20;
|
||||
uint16_t y_park_pos = 20;
|
||||
uint16_t z_park_pos = 10;
|
||||
|
||||
xyz_pos_t position_before_pause;
|
||||
|
||||
void MKS_pause_print_move() {
|
||||
queue.exhaust();
|
||||
position_before_pause = current_position;
|
||||
do_blocking_move_to(X_MIN_POS + x_park_pos, Y_MIN_POS + y_park_pos, current_position.z + z_park_pos);
|
||||
}
|
||||
|
||||
void MKS_resume_print_move() { do_blocking_move_to(position_before_pause); }
|
||||
|
||||
uint16_t min_ex_temp = 0;
|
||||
|
||||
float z_offset_add = 0;
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
uint16_t tmc_x_step = 0;
|
||||
uint16_t tmc_y_step = 0;
|
||||
uint16_t tmc_z_step = 0;
|
||||
#else
|
||||
uint16_t tmc_x_step = 0;
|
||||
uint16_t tmc_y_step = 0;
|
||||
uint16_t tmc_z_step = 0;
|
||||
#endif
|
||||
|
||||
uint16_t lcd_default_light = 50;
|
||||
|
||||
EX_FILAMENT_DEF ex_filament;
|
||||
RUNOUT_MKS_DEF runout_mks;
|
||||
NOZZLE_PARK_DEF nozzle_park_mks;
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
#define MKSLIST_E_ITEM(N) VP_T_E##N##_Is, VP_T_E##N##_Set,
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
// VP_M117, for completeness, but it cannot be auto-uploaded.
|
||||
#if HOTENDS >= 1
|
||||
MKSLIST_E_ITEM(0) VP_E0_STATUS,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
MKSLIST_E_ITEM(1)
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
VP_Fan0_Percentage, VP_FAN0_STATUS,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VP_PrintProgress_Percentage,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Home[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Language
|
||||
// VP_HOME_Dis,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Setting[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Language
|
||||
VP_Setting_Dis,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Tool[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Language
|
||||
VP_Tool_Dis,
|
||||
// LCD BLK
|
||||
VP_LCD_BLK,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_EXTRUE[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
VP_Filament_distance,
|
||||
VP_Filament_speed,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_LEVEL[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MOVE[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Print[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// Print Percent
|
||||
VP_PrintProgress_Percentage,
|
||||
|
||||
VP_PrintTime,
|
||||
|
||||
VP_Flowrate_E0,
|
||||
VP_Flowrate_E1,
|
||||
VP_Feedrate_Percentage,
|
||||
|
||||
VP_PrintTime_H,
|
||||
VP_PrintTime_M,
|
||||
VP_PrintTime_S,
|
||||
|
||||
VP_XPos,
|
||||
VP_YPos,
|
||||
VP_ZPos,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_SD_File[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1,
|
||||
VP_SD_FileName2, VP_SD_FileName3,
|
||||
VP_SD_FileName4, VP_SD_FileName5,
|
||||
VP_SD_FileName6, VP_SD_FileName7,
|
||||
VP_SD_FileName8, VP_SD_FileName9,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_TempOnly[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
// LCD BLK
|
||||
VP_LCD_BLK,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Pluse[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// Pluse
|
||||
VP_X_STEP_PER_MM,
|
||||
VP_Y_STEP_PER_MM,
|
||||
VP_Z_STEP_PER_MM,
|
||||
VP_E0_STEP_PER_MM,
|
||||
VP_E1_STEP_PER_MM,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MaxSpeed[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// Pluse
|
||||
VP_X_MAX_SPEED,
|
||||
VP_Y_MAX_SPEED,
|
||||
VP_Z_MAX_SPEED,
|
||||
VP_E0_MAX_SPEED,
|
||||
VP_E1_MAX_SPEED,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MaxAcc[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// ACC
|
||||
VP_ACC_SPEED,
|
||||
VP_X_ACC_MAX_SPEED,
|
||||
VP_Y_ACC_MAX_SPEED,
|
||||
VP_Z_ACC_MAX_SPEED,
|
||||
VP_E0_ACC_MAX_SPEED,
|
||||
VP_E1_ACC_MAX_SPEED,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_PID[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// PID
|
||||
VP_E0_PID_P,
|
||||
VP_E0_PID_I,
|
||||
VP_E0_PID_D,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Level_Point[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
// FAN
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
// Level Point
|
||||
VP_Level_Point_One_X,
|
||||
VP_Level_Point_One_Y,
|
||||
VP_Level_Point_Two_X,
|
||||
VP_Level_Point_Two_Y,
|
||||
VP_Level_Point_Three_X,
|
||||
VP_Level_Point_Three_Y,
|
||||
VP_Level_Point_Four_X,
|
||||
VP_Level_Point_Four_Y,
|
||||
VP_Level_Point_Five_X,
|
||||
VP_Level_Point_Five_Y,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_Level_PrintConfig[] PROGMEM = {
|
||||
VP_T_E0_Set,
|
||||
VP_T_E1_Set,
|
||||
VP_T_Bed_Set,
|
||||
VP_Flowrate_E0,
|
||||
VP_Flowrate_E1,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_PrintPauseConfig[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
|
||||
VP_X_PARK_POS,
|
||||
VP_Y_PARK_POS,
|
||||
VP_Z_PARK_POS,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_MotoConfig[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
|
||||
VP_TRAVEL_SPEED,
|
||||
VP_FEEDRATE_MIN_SPEED,
|
||||
VP_T_F_SPEED,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_EX_Config[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
VP_MIN_EX_T,VP_Min_EX_T_E,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSTMC_Config[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
// HB Temp
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
VP_MIN_EX_T,
|
||||
|
||||
VP_TMC_X_STEP,
|
||||
VP_TMC_Y_STEP,
|
||||
VP_TMC_Z_STEP,
|
||||
VP_TMC_X1_Current,
|
||||
VP_TMC_Y1_Current,
|
||||
VP_TMC_X_Current,
|
||||
VP_TMC_Y_Current,
|
||||
VP_TMC_Z_Current,
|
||||
VP_TMC_E0_Current,
|
||||
VP_TMC_E1_Current,
|
||||
VP_TMC_Z1_Current,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSAuto_Level[] PROGMEM = {
|
||||
VP_MESH_LEVEL_POINT_DIS,
|
||||
VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSOffset_Config[] PROGMEM = {
|
||||
// E Temp
|
||||
REPEAT(EXTRUDERS, MKSLIST_E_ITEM)
|
||||
VP_OFFSET_X,
|
||||
VP_OFFSET_Y,
|
||||
VP_OFFSET_Z,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSBabyStep[] PROGMEM = {
|
||||
VP_ZOffset_DE_DIS,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t MKSList_About[] PROGMEM = {
|
||||
// Marlin version
|
||||
VP_MARLIN_VERSION,
|
||||
// H43 Version
|
||||
VP_MKS_H43_VERSION,
|
||||
VP_MKS_H43_UpdataVERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
// Page data updata
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ MKSLCD_SCREEN_BOOT, VPList_Boot }, // Boot Page to show logo 0
|
||||
{ MKSLCD_SCREEN_HOME, MKSList_Home }, // Home, Page 1
|
||||
{ MKSLCD_SCREEN_SETTING, MKSList_Setting }, // Setting, Page 2
|
||||
{ MKSLCD_SCREEM_TOOL, MKSList_Tool }, // Page 3
|
||||
{ MKSLCD_SCREEN_EXTRUDE_P1, MKSList_EXTRUE }, // Page 4
|
||||
{ MKSLCD_SCREEN_EXTRUDE_P2, MKSList_EXTRUE }, // Page 11
|
||||
{ MKSLCD_PAUSE_SETTING_EX, MKSList_EXTRUE }, // Page 57
|
||||
{ MKSLCD_PAUSE_SETTING_EX2, MKSList_EXTRUE }, // Page 61
|
||||
{ MKSLCD_SCREEN_LEVEL, MKSList_LEVEL }, // Page 5
|
||||
{ MKSLCD_SCREEN_MOVE, MKSList_MOVE }, // Page 6
|
||||
{ MKSLCD_SCREEN_PRINT, MKSList_Print }, // Page 7
|
||||
{ MKSLCD_SCREEN_PAUSE, MKSList_Print }, // Page 26
|
||||
{ MKSLCD_SCREEN_CHOOSE_FILE, MKSList_SD_File }, // Page 15
|
||||
{ MKSLCD_SCREEN_MOTOR_PLUSE, MKSList_Pluse }, // Page 51
|
||||
{ MKSLCD_SCREEN_MOTOR_SPEED, MKSList_MaxSpeed }, // Page 55
|
||||
{ MKSLCD_SCREEN_MOTOR_ACC_MAX, MKSList_MaxAcc }, // Page 53
|
||||
{ MKSLCD_SCREEN_LEVEL_DATA, MKSList_Level_Point }, // Page 48
|
||||
{ MKSLCD_PrintPause_SET, MKSList_PrintPauseConfig }, // Page 49
|
||||
{ MKSLCD_FILAMENT_DATA, MKSList_SD_File }, // Page 50
|
||||
{ MKSLCD_SCREEN_Config, MKSList_TempOnly }, // Page 46
|
||||
{ MKSLCD_SCREEN_Config_MOTOR, MKSList_MotoConfig }, // Page 47
|
||||
{ MKSLCD_PID, MKSList_PID }, // Page 56
|
||||
{ MKSLCD_ABOUT, MKSList_About }, // Page 36
|
||||
{ MKSLCD_SCREEN_PRINT_CONFIG, MKSList_Level_PrintConfig }, // Page 60
|
||||
{ MKSLCD_SCREEN_EX_CONFIG, MKSList_EX_Config }, // Page 65
|
||||
{ MKSLCD_SCREEN_TMC_Config, MKSTMC_Config }, // Page 70
|
||||
{ MKSLCD_AUTO_LEVEL, MKSAuto_Level }, // Page 73
|
||||
{ MKSLCD_Screen_Offset_Config, MKSOffset_Config }, // Page 30
|
||||
{ MKSLCD_Screen_PMove, MKSList_MOVE }, // Page 64
|
||||
{ MKSLCD_Screen_Baby, MKSBabyStep }, // Page 71
|
||||
//{ MKSLCD_SCREEN_LEVEL_DATA, MKSList_SD_File},
|
||||
//{ MKSLCD_SCREEN_HOME, VPList_Boot },
|
||||
{ 0, nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
const char H43Version[] PROGMEM = "MKS H43_V1.30";
|
||||
const char Updata_Time[] PROGMEM = STRING_DISTRIBUTION_DATE;
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR) \
|
||||
{ \
|
||||
.VP = VPADR, .memadr = VPADRVAR, .size = sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR \
|
||||
}
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR) \
|
||||
{ \
|
||||
.VP = VPADR, .memadr = VPADRVAR, .size = STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR \
|
||||
}
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr),
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
|
||||
// Back Button
|
||||
VPHELPER(VP_BACK_PAGE, nullptr, &ScreenHandler.ScreenBackChange, nullptr),
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &ScreenHandler.HandleAllHeatersOff, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_X, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
|
||||
VPHELPER(VP_X_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Y_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Z_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_DISTANCE, &distanceMove, &ScreenHandler.GetManualMovestep, nullptr),
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_LEVEL_POINT, nullptr, &ScreenHandler.ManualAssistLeveling, nullptr),
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &ScreenHandler.HandleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, &ScreenHandler.HandleZCalibration, nullptr),
|
||||
#endif
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &ScreenHandler.HandleFirstLayerCal, nullptr),
|
||||
#endif
|
||||
{.VP = VP_MARLIN_VERSION, .memadr = (void *)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{.VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay},
|
||||
{.VP = VP_MKS_H43_VERSION, .memadr = (void *)H43Version, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
{.VP = VP_MKS_H43_UpdataVERSION, .memadr = (void *)Updata_Time, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, &ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, &ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, &ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &ScreenHandler.HandlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, &ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_LOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentLoad, nullptr),
|
||||
VPHELPER(VP_UNLOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentUnLoad, nullptr),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, &ScreenHandler.HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, &ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, &ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, &ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, &ScreenHandler.HandleFilamentOption, &ScreenHandler.HandleFilamentLoadUnload),
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, &ScreenHandler.HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, &ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, &ScreenHandler.HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if HAS_FAN
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_SetUint8, &ScreenHandler.DGUSLCD_SendFanToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &ScreenHandler.HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, &ScreenHandler.DGUSLCD_SendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Level Point Set
|
||||
VPHELPER(VP_Level_Point_One_X, &level_1_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_Y, &level_1_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_X, &level_2_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_Y, &level_2_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_X, &level_3_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_Y, &level_3_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_X, &level_4_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_Y, &level_4_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_X, &level_5_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_Y, &level_5_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
|
||||
//LCD Control
|
||||
VPHELPER(VP_LCD_BLK, &lcd_default_light, &ScreenHandler.LCD_BLK_Adjust, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay_MKS),
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
|
||||
VPHELPER(VP_X_MAX_SPEED, &planner.settings.max_feedrate_mm_s[X_AXIS], ScreenHandler.HandleMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Y_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Y_AXIS], ScreenHandler.HandleMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Z_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Z_AXIS], ScreenHandler.HandleMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E0_AXIS], ScreenHandler.HandleExtruderMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E1_AXIS], ScreenHandler.HandleExtruderMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[X_AXIS], ScreenHandler.HandleMaxAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ScreenHandler.HandleMaxAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ScreenHandler.HandleMaxAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E0_AXIS], ScreenHandler.HandleExtruderAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E1_AXIS], ScreenHandler.HandleExtruderAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_TRAVEL_SPEED, (uint16_t *)&planner.settings.travel_acceleration, ScreenHandler.HandleTravelAccChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_FEEDRATE_MIN_SPEED, (uint16_t *)&planner.settings.min_feedrate_mm_s, ScreenHandler.HandleFeedRateMinChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, ScreenHandler.HandleMin_T_F_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, ScreenHandler.HandleAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_X_PARK_POS, &x_park_pos, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_PARK_POS, &y_park_pos, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_PARK_POS, &z_park_pos, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, ScreenHandler.HandleGetExMinTemp_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING) // TMC SENSORLESS Setting
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
VPHELPER(VP_TMC_X_STEP, &tmc_x_step, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
VPHELPER(VP_TMC_Y_STEP, &tmc_y_step, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
VPHELPER(VP_TMC_Z_STEP, &tmc_z_step, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG // TMC Current Setting
|
||||
#if AXIS_IS_TMC(X)
|
||||
VPHELPER(VP_TMC_X_Current, &stepperX.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y)
|
||||
VPHELPER(VP_TMC_Y_Current, &stepperY.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z)
|
||||
VPHELPER(VP_TMC_Z_Current, &stepperZ.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E0)
|
||||
VPHELPER(VP_TMC_E0_Current, &stepperE0.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
VPHELPER(VP_TMC_E1_Current, &stepperE1.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(X2)
|
||||
VPHELPER(VP_TMC_X1_Current, &stepperX2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
VPHELPER(VP_TMC_Y1_Current, &stepperY2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
VPHELPER(VP_TMC_Z1_Current, &stepperZ2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_EEPROM_CTRL, nullptr, ScreenHandler.EEPROM_CTRL, nullptr),
|
||||
VPHELPER(VP_LEVEL_BUTTON, nullptr, ScreenHandler.Level_Ctrl_MKS, nullptr),
|
||||
VPHELPER(VP_LANGUAGE_CHANGE, nullptr, ScreenHandler.LanguageChange_MKS, nullptr),
|
||||
|
||||
//VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr),
|
||||
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, ScreenHandler.ZoffsetConfirm, nullptr),
|
||||
|
||||
VPHELPER(VP_ZOffset_Distance,nullptr ,ScreenHandler.GetZoffsetDistance, nullptr),
|
||||
VPHELPER(VP_MESH_LEVEL_ADJUST, nullptr, ScreenHandler.MeshLevelDistanceConfig, nullptr),
|
||||
VPHELPER(VP_MESH_LEVEL_POINT,nullptr, ScreenHandler.MeshLevel,nullptr),
|
||||
VPHELPER(VP_Min_EX_T_E, &thermalManager.extrude_min_temp, &ScreenHandler.GetMinExtrudeTemp, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_AutoTurnOffSw, nullptr, &ScreenHandler.GetTurnOffCtrl, nullptr),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
#endif
|
||||
|
||||
|
||||
// SDCard File listing
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName5, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName6, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName7, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName8, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName9, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ,nullptr, ScreenHandler.HandleLiveAdjustZ, &ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_ZOffset_DE_DIS,&z_offset_add,nullptr, &ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_OFFSET_X, &probe.offset.x, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_Y, &probe.offset.y, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_OFFSET_Z, &probe.offset.z, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay),
|
||||
#endif
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant be autouploaded as we do not buffer content.
|
||||
//{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
//{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM},
|
||||
|
||||
{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplay_Language_MKS},
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_MKS
|
||||
@@ -0,0 +1,908 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#define USE_MKS_GREEN_UI
|
||||
//#define DGUS_MKS_RUNOUT_SENSOR
|
||||
|
||||
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
|
||||
|
||||
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
|
||||
#define MT_DET_1_PIN 1
|
||||
#define MT_DET_2_PIN 2
|
||||
#define MT_DET_PIN_INVERTING false
|
||||
#endif
|
||||
|
||||
#define MKS_FINSH
|
||||
|
||||
extern uint16_t distanceMove;
|
||||
extern float distanceFilament;
|
||||
extern uint16_t FilamentSpeed;
|
||||
extern float ZOffset_distance;
|
||||
extern float mesh_adj_distance;
|
||||
extern float Z_distance;
|
||||
|
||||
extern int16_t level_1_x_point;
|
||||
extern int16_t level_1_y_point;
|
||||
extern int16_t level_2_x_point;
|
||||
extern int16_t level_2_y_point;
|
||||
extern int16_t level_3_x_point;
|
||||
extern int16_t level_3_y_point;
|
||||
extern int16_t level_4_x_point;
|
||||
extern int16_t level_4_y_point;
|
||||
extern int16_t level_5_x_point;
|
||||
extern int16_t level_5_y_point;
|
||||
|
||||
extern uint16_t tim_h;
|
||||
extern uint16_t tim_m;
|
||||
extern uint16_t tim_s;
|
||||
|
||||
extern uint16_t x_park_pos;
|
||||
extern uint16_t y_park_pos;
|
||||
extern uint16_t z_park_pos;
|
||||
|
||||
extern xyz_pos_t position_before_pause;
|
||||
void MKS_pause_print_move();
|
||||
void MKS_resume_print_move();
|
||||
|
||||
extern uint16_t min_ex_temp;
|
||||
|
||||
extern float z_offset_add;
|
||||
|
||||
extern uint16_t tmc_x_step;
|
||||
extern uint16_t tmc_y_step;
|
||||
extern uint16_t tmc_z_step;
|
||||
|
||||
extern uint16_t lcd_default_light;
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
extern uint16_t tmc_x_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
extern uint16_t tmc_y_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
extern uint16_t tmc_z_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(E0)
|
||||
extern uint16_t tmc_e0_current;
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(E1)
|
||||
extern uint16_t tmc_e1_current;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
EX_HEATING,
|
||||
EX_HEAT_STARUS,
|
||||
EX_CHANGING,
|
||||
EX_CHANGE_STATUS,
|
||||
EX_NONE,
|
||||
} EX_STATUS_DEF;
|
||||
|
||||
typedef struct {
|
||||
//uint8_t ex_change_flag:1;
|
||||
//uint8_t ex_heat_flag:1;
|
||||
uint8_t ex_load_unload_flag:1; //0:unload 1:load
|
||||
EX_STATUS_DEF ex_status;
|
||||
uint32_t ex_tick_start;
|
||||
uint32_t ex_tick_end;
|
||||
uint32_t ex_speed;
|
||||
uint32_t ex_length;
|
||||
uint32_t ex_need_time;
|
||||
} EX_FILAMENT_DEF;
|
||||
|
||||
extern EX_FILAMENT_DEF ex_filament;
|
||||
|
||||
typedef enum {
|
||||
UNRUNOUT_STATUS,
|
||||
RUNOUT_STATUS,
|
||||
RUNOUT_WAITTING_STATUS,
|
||||
RUNOUT_BEGIN_STATUS,
|
||||
} RUNOUT_MKS_STATUS_DEF;
|
||||
|
||||
typedef struct {
|
||||
RUNOUT_MKS_STATUS_DEF runout_status;
|
||||
uint8_t pin_status;
|
||||
uint8_t de_count;
|
||||
uint8_t de_times;
|
||||
} RUNOUT_MKS_DEF;
|
||||
|
||||
extern RUNOUT_MKS_DEF runout_mks;
|
||||
|
||||
typedef struct {
|
||||
uint8_t print_pause_start_flag:1;
|
||||
uint8_t runout_flag:1;
|
||||
bool blstatus;
|
||||
uint16_t x_pos;
|
||||
uint16_t y_pos;
|
||||
uint16_t z_pos;
|
||||
} NOZZLE_PARK_DEF;
|
||||
|
||||
extern NOZZLE_PARK_DEF nozzle_park_mks;
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
#if ENABLED(USE_MKS_GREEN_UI)
|
||||
|
||||
DGUSLCD_SCREEN_BOOT = 33,
|
||||
DGUSLCD_SCREEN_MAIN = 60,
|
||||
DGUSLCD_SCREEN_STATUS = 60,
|
||||
DGUSLCD_SCREEN_STATUS2 = 60,
|
||||
DGUSLCD_SCREEN_PREHEAT = 18,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 192,
|
||||
DGUSLCD_SCREEN_UTILITY = 120,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 17,
|
||||
|
||||
MKSLCD_SCREEN_BOOT = 33,
|
||||
MKSLCD_SCREEN_HOME = 60, // MKS main page
|
||||
MKSLCD_SCREEN_SETTING = 62, // MKS Setting page / no wifi whit
|
||||
MKSLCD_SCREEM_TOOL = 64, // MKS Tool page
|
||||
MKSLCD_SCREEN_EXTRUDE_P1 = 75,
|
||||
MKSLCD_SCREEN_EXTRUDE_P2 = 77,
|
||||
MKSLCD_SCREEN_LEVEL = 73,
|
||||
MKSLCD_AUTO_LEVEL = 81,
|
||||
MKSLCD_SCREEN_MOVE = 66,
|
||||
MKSLCD_SCREEN_PRINT = 68,
|
||||
MKSLCD_SCREEN_PAUSE = 70,
|
||||
MKSLCD_SCREEN_CHOOSE_FILE = 87,
|
||||
MKSLCD_SCREEN_NO_CHOOSE_FILE = 88,
|
||||
MKSLCD_SCREEN_Config = 101,
|
||||
MKSLCD_SCREEN_Config_MOTOR = 103,
|
||||
MKSLCD_SCREEN_MOTOR_PLUSE = 104,
|
||||
MKSLCD_SCREEN_MOTOR_SPEED = 102,
|
||||
MKSLCD_SCREEN_MOTOR_ACC_MAX = 105,
|
||||
MKSLCD_SCREEN_PRINT_CONFIG = 72,
|
||||
MKSLCD_SCREEN_LEVEL_DATA = 106,
|
||||
MKSLCD_PrintPause_SET = 107,
|
||||
MKSLCD_FILAMENT_DATA = 50,
|
||||
MKSLCD_ABOUT = 83,
|
||||
MKSLCD_PID = 108,
|
||||
MKSLCD_PAUSE_SETTING_MOVE = 98,
|
||||
MKSLCD_PAUSE_SETTING_EX = 96,
|
||||
MKSLCD_PAUSE_SETTING_EX2 = 97,
|
||||
MKSLCD_SCREEN_PRINT_CONFIRM = 94,
|
||||
MKSLCD_SCREEN_EX_CONFIG = 112,
|
||||
MKSLCD_SCREEN_EEP_Config = 89,
|
||||
MKSLCD_SCREEN_PrintDone = 92,
|
||||
MKSLCD_SCREEN_TMC_Config = 111,
|
||||
MKSLCD_Screen_Offset_Config = 109,
|
||||
MKSLCD_Screen_PMove = 98,
|
||||
MKSLCD_Screen_Baby = 79,
|
||||
|
||||
#else
|
||||
|
||||
DGUSLCD_SCREEN_BOOT = 120,
|
||||
DGUSLCD_SCREEN_MAIN = 1,
|
||||
|
||||
DGUSLCD_SCREEN_STATUS = 1,
|
||||
DGUSLCD_SCREEN_STATUS2 = 1,
|
||||
DGUSLCD_SCREEN_PREHEAT = 18,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 192,
|
||||
DGUSLCD_SCREEN_UTILITY = 120,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 15,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 17,
|
||||
|
||||
MKSLCD_SCREEN_BOOT = 0,
|
||||
MKSLCD_SCREEN_HOME = 1, // MKS main page
|
||||
MKSLCD_SCREEN_SETTING = 2, // MKS Setting page / no wifi whit
|
||||
MKSLCD_SCREEM_TOOL = 3, // MKS Tool page
|
||||
MKSLCD_SCREEN_EXTRUDE_P1 = 4,
|
||||
MKSLCD_SCREEN_EXTRUDE_P2 = 11,
|
||||
MKSLCD_SCREEN_LEVEL = 5,
|
||||
MKSLCD_AUTO_LEVEL = 73,
|
||||
MKSLCD_SCREEN_LEVEL_PRESS = 9,
|
||||
MKSLCD_SCREEN_MOVE = 6,
|
||||
MKSLCD_SCREEN_PRINT = 7,
|
||||
MKSLCD_SCREEN_PRINT_PRESS = 13,
|
||||
MKSLCD_SCREEN_PAUSE = 26,
|
||||
MKSLCD_SCREEN_PAUSE_PRESS = 26,
|
||||
MKSLCD_SCREEN_CHOOSE_FILE = 15,
|
||||
MKSLCD_SCREEN_NO_CHOOSE_FILE = 17,
|
||||
MKSLCD_SCREEN_Config = 46,
|
||||
MKSLCD_SCREEN_Config_MOTOR = 47,
|
||||
MKSLCD_SCREEN_MOTOR_PLUSE = 51,
|
||||
MKSLCD_SCREEN_MOTOR_SPEED = 55,
|
||||
MKSLCD_SCREEN_MOTOR_ACC_MAX = 53,
|
||||
MKSLCD_SCREEN_PRINT_CONFIG = 60,
|
||||
MKSLCD_SCREEN_LEVEL_DATA = 48,
|
||||
MKSLCD_PrintPause_SET = 49,
|
||||
MKSLCD_FILAMENT_DATA = 50,
|
||||
MKSLCD_ABOUT = 36,
|
||||
MKSLCD_PID = 56,
|
||||
MKSLCD_PAUSE_SETTING_MOVE = 58,
|
||||
MKSLCD_PAUSE_SETTING_EX = 57,
|
||||
MKSLCD_PAUSE_SETTING_EX2 = 61,
|
||||
MKSLCD_SCREEN_NO_FILE = 42,
|
||||
MKSLCD_SCREEN_PRINT_CONFIRM = 43,
|
||||
MKSLCD_SCREEN_EX_CONFIG = 65,
|
||||
MKSLCD_SCREEN_EEP_Config = 20,
|
||||
MKSLCD_SCREEN_PrintDone = 25,
|
||||
MKSLCD_SCREEN_TMC_Config = 70,
|
||||
MKSLCD_Screen_Offset_Config = 30,
|
||||
MKSLCD_Screen_PMove = 64,
|
||||
MKSLCD_Screen_Baby = 71,
|
||||
|
||||
#endif
|
||||
|
||||
DGUSLCD_SCREEN_CONFIRM = 240,
|
||||
DGUSLCD_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUSLCD_SCREEN_WAITING = 251,
|
||||
DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUSLDC_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
// Display Memory layout used (T5UID)
|
||||
// Except system variables this is arbitrary, just to organize stuff....
|
||||
|
||||
// 0x0000 .. 0x0FFF -- System variables and reserved by the display
|
||||
// 0x1000 .. 0x1FFF -- Variables to never change location, regardless of UI Version
|
||||
// 0x2000 .. 0x2FFF -- Controls (VPs that will trigger some action)
|
||||
// 0x3000 .. 0x4FFF -- Marlin Data to be displayed
|
||||
// 0x5000 .. -- SPs (if we want to modify display elements, e.g change color or like) -- currently unused
|
||||
|
||||
// As there is plenty of space (at least most displays have >8k RAM), we do not pack them too tight,
|
||||
// so that we can keep variables nicely together in the address space.
|
||||
|
||||
// UI Version always on 0x1000...0x1002 so that the firmware can check this and bail out.
|
||||
|
||||
// constexpr uint16_t VP_UI_VERSION_MAJOR = 0x1000; // Major -- incremented when incompatible
|
||||
// constexpr uint16_t VP_UI_VERSION_MINOR = 0x1001; // Minor -- incremented on new features, but compatible
|
||||
// constexpr uint16_t VP_UI_VERSION_PATCH = 0x1002; // Patch -- fixed which do not change functionality.
|
||||
// constexpr uint16_t VP_UI_FLAVOUR = 0x1010; // lets reserve 16 bytes here to determine if UI is suitable for this Marlin. tbd.
|
||||
|
||||
// Storage space for the Killscreen messages. 0x1100 - 0x1200 . Reused for the popup.
|
||||
// constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
// constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
// constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
// constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
// constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
// constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
// constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
// constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
// Screenchange request for screens that only make sense when printer is idle.
|
||||
// e.g movement is only allowed if printer is not printing.
|
||||
// Marlin must confirm by setting the screen manually.
|
||||
// constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
|
||||
// constexpr uint16_t VP_SCREENCHANGE = 0x2001; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
// constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
|
||||
// constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
// constexpr uint16_t VP_CONFIRMED = 0x2010; // OK on confirm screen.
|
||||
|
||||
// // Buttons on the SD-Card File listing.
|
||||
// constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
// constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
|
||||
// constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
|
||||
// constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
// constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
// constexpr uint16_t VP_SD_Print_Setting = 0x2040;
|
||||
// constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x2050; // Data: 0 down, 1 up
|
||||
|
||||
// Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
|
||||
// (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
|
||||
// A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
|
||||
// the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
|
||||
// constexpr uint16_t VP_MOVE_X = 0x2100;
|
||||
// constexpr uint16_t VP_MOVE_Y = 0x2102;
|
||||
// constexpr uint16_t VP_MOVE_Z = 0x2104;
|
||||
// constexpr uint16_t VP_MOVE_E0 = 0x2110;
|
||||
// constexpr uint16_t VP_MOVE_E1 = 0x2112;
|
||||
// //constexpr uint16_t VP_MOVE_E2 = 0x2114;
|
||||
// //constexpr uint16_t VP_MOVE_E3 = 0x2116;
|
||||
// //constexpr uint16_t VP_MOVE_E4 = 0x2118;
|
||||
// //constexpr uint16_t VP_MOVE_E5 = 0x211A;
|
||||
// constexpr uint16_t VP_HOME_ALL = 0x2120;
|
||||
// constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2130;
|
||||
// constexpr uint16_t VP_XYZ_HOME = 0x2132;
|
||||
|
||||
// Power loss recovery
|
||||
// constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
|
||||
|
||||
// // Fan Control Buttons , switch between "off" and "on"
|
||||
// constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
|
||||
// constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
|
||||
// constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
|
||||
// constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
|
||||
|
||||
// // Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
// constexpr uint16_t VP_E0_CONTROL = 0x2210;
|
||||
// constexpr uint16_t VP_E1_CONTROL = 0x2212;
|
||||
// //constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
// //constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
// //constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
// //constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
// constexpr uint16_t VP_BED_CONTROL = 0x221C;
|
||||
|
||||
// // Preheat
|
||||
// constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220;
|
||||
// constexpr uint16_t VP_E1_BED_PREHEAT = 0x2222;
|
||||
// //constexpr uint16_t VP_E2_BED_PREHEAT = 0x2224;
|
||||
// //constexpr uint16_t VP_E3_BED_PREHEAT = 0x2226;
|
||||
// //constexpr uint16_t VP_E4_BED_PREHEAT = 0x2228;
|
||||
// //constexpr uint16_t VP_E5_BED_PREHEAT = 0x222A;
|
||||
|
||||
// // Filament load and unload
|
||||
// // constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300;
|
||||
// // constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302;
|
||||
|
||||
// // Settings store , reset
|
||||
|
||||
// // PID autotune
|
||||
// constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x2410;
|
||||
// constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x2412;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x2414;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x2416;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x2418;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x241A;
|
||||
// constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x2420;
|
||||
// // Calibrate Z
|
||||
// constexpr uint16_t VP_Z_CALIBRATE = 0x2430;
|
||||
|
||||
// First layer cal
|
||||
// constexpr uint16_t VP_Z_FIRST_LAYER_CAL = 0x2500; // Data: 0 - Cancel first layer cal progress, >0 filament type have loaded
|
||||
|
||||
// Firmware version on the boot screen.
|
||||
// constexpr uint16_t VP_MARLIN_VERSION = 0x3000;
|
||||
// constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
// Place for status messages.
|
||||
constexpr uint16_t VP_M117 = 0x7020;
|
||||
constexpr uint8_t VP_M117_LEN = 0x20;
|
||||
|
||||
// // Temperatures.
|
||||
// constexpr uint16_t VP_T_E0_Is = 0x3060; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E0_Set = 0x3062; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E1_Is = 0x3064; // 4 Byte Integer
|
||||
// // reserved to support up to 6 Extruders:
|
||||
// constexpr uint16_t VP_T_E1_Set = 0x3066; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E2_Is = 0x3068; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E2_Set = 0x306A; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E3_Is = 0x306C; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E3_Set = 0x306E; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E4_Is = 0x3070; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E4_Set = 0x3072; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E5_Is = 0x3074; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E5_Set = 0x3076; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E6_Is = 0x3078; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E6_Set = 0x307A; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_T_E7_Is = 0x3078; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_E7_Set = 0x307A; // 2 Byte Integer
|
||||
|
||||
|
||||
// constexpr uint16_t VP_T_Bed_Is = 0x3080; // 4 Byte Integer
|
||||
// constexpr uint16_t VP_T_Bed_Set = 0x3082; // 2 Byte Integer
|
||||
|
||||
// constexpr uint16_t VP_Flowrate_E0 = 0x3090; // 2 Byte Integer
|
||||
// constexpr uint16_t VP_Flowrate_E1 = 0x3092; // 2 Byte Integer
|
||||
// // reserved for up to 6 Extruders:
|
||||
// constexpr uint16_t VP_Flowrate_E2 = 0x3094;
|
||||
// constexpr uint16_t VP_Flowrate_E3 = 0x3096;
|
||||
// constexpr uint16_t VP_Flowrate_E4 = 0x3098;
|
||||
// constexpr uint16_t VP_Flowrate_E5 = 0x309A;
|
||||
|
||||
// constexpr uint16_t VP_Fan0_Percentage = 0x3100; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Fan1_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Fan2_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Fan3_Percentage = 0x3106; // 2 Byte Integer (0..100)
|
||||
// constexpr uint16_t VP_Feedrate_Percentage = 0x3108; // 2 Byte Integer (0..100)
|
||||
|
||||
// Actual Position
|
||||
// constexpr uint16_t VP_XPos = 0x3110; // 4 Byte Fixed point number; format xxx.yy
|
||||
// constexpr uint16_t VP_YPos = 0x3112; // 4 Byte Fixed point number; format xxx.yy
|
||||
// constexpr uint16_t VP_ZPos = 0x3114; // 4 Byte Fixed point number; format xxx.yy
|
||||
// constexpr uint16_t VP_EPos = 0x3120; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
// constexpr uint16_t VP_PrintProgress_Percentage = 0x3130; // 2 Byte Integer (0..100)
|
||||
|
||||
// constexpr uint16_t VP_PrintTime = 0x3140;
|
||||
// constexpr uint16_t VP_PrintTime_LEN = 32;
|
||||
|
||||
// constexpr uint16_t VP_PrintAccTime = 0x3160;
|
||||
// constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
|
||||
// constexpr uint16_t VP_PrintsTotal = 0x3180;
|
||||
// constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
// // SDCard File Listing
|
||||
// constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
// constexpr uint16_t DGUS_SD_FILESPERSCREEN = 8; // FIXME move that info to the display and read it from there.
|
||||
// constexpr uint16_t VP_SD_FileName0 = 0x3200;
|
||||
// constexpr uint16_t VP_SD_FileName1 = 0x3220;
|
||||
// constexpr uint16_t VP_SD_FileName2 = 0x3240;
|
||||
// constexpr uint16_t VP_SD_FileName3 = 0x3260;
|
||||
// constexpr uint16_t VP_SD_FileName4 = 0x3280;
|
||||
// constexpr uint16_t VP_SD_FileName5 = 0x32A0;
|
||||
// constexpr uint16_t VP_SD_FileName6 = 0x32C0;
|
||||
// constexpr uint16_t VP_SD_FileName7 = 0x32E0;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3410;
|
||||
constexpr uint16_t VP_E1_STATUS = 0x3412;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3414;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3416;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3418;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x341A;
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3500;
|
||||
|
||||
// // PIDs
|
||||
// constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
// constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
// constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
// constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
// constexpr uint16_t VP_E1_PID_I = 0x3708;
|
||||
// constexpr uint16_t VP_E1_PID_D = 0x370A;
|
||||
// constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
// constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
// constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
// Wating screen status
|
||||
constexpr uint16_t VP_WAITING_STATUS = 0x3800;
|
||||
|
||||
// SPs for certain variables...
|
||||
// located at 0x5000 and up
|
||||
// Not used yet!
|
||||
// This can be used e.g to make controls / data display invisible
|
||||
constexpr uint16_t SP_T_E0_Is = 0x5000;
|
||||
constexpr uint16_t SP_T_E0_Set = 0x5010;
|
||||
constexpr uint16_t SP_T_E1_Is = 0x5020;
|
||||
constexpr uint16_t SP_T_Bed_Is = 0x5030;
|
||||
constexpr uint16_t SP_T_Bed_Set = 0x5040;
|
||||
|
||||
/*************************************************************************************************************************
|
||||
*************************************************************************************************************************
|
||||
* DGUS for MKS Mem layout
|
||||
************************************************************************************************************************
|
||||
************************************************************************************************************************/
|
||||
|
||||
#if ENABLED(MKS_FINSH)
|
||||
/* -------------------------------0x1000-0x1FFF------------------------------- */
|
||||
constexpr uint16_t VP_MSGSTR1 = 0x1100;
|
||||
constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
constexpr uint16_t VP_MSGSTR2 = 0x1140;
|
||||
constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR3 = 0x1180;
|
||||
constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
|
||||
constexpr uint16_t VP_MSGSTR4 = 0x11C0;
|
||||
constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
constexpr uint16_t VP_MARLIN_VERSION = 0x1A00;
|
||||
constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
|
||||
|
||||
|
||||
constexpr uint16_t VP_SCREENCHANGE_ASK = 0x1500;
|
||||
constexpr uint16_t VP_SCREENCHANGE = 0x1501; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
constexpr uint16_t VP_TEMP_ALL_OFF = 0x1502; // Turn all heaters off. Value arbitrary ;)=
|
||||
constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x1503; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
constexpr uint16_t VP_CONFIRMED = 0x1510; // OK on confirm screen.
|
||||
|
||||
constexpr uint16_t VP_BACK_PAGE = 0x1600;
|
||||
constexpr uint16_t VP_SETTINGS = 0x1620;
|
||||
// Power loss recovery
|
||||
constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x1680;
|
||||
/* -------------------------------0x2000-0x2FFF------------------------------- */
|
||||
// Temperatures.
|
||||
constexpr uint16_t VP_T_E0_Is = 0x2000; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E0_Set = 0x2004; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Is = 0x2008; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E1_Set = 0x200B; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E2_Is = 0x2010; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E2_Set = 0x2014; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E3_Is = 0x2018; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E3_Set = 0x201B; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E4_Is = 0x2020; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E4_Set = 0x2024; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E5_Is = 0x2028; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E5_Set = 0x202B; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E6_Is = 0x2030; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E6_Set = 0x2034; // 2 Byte Integer
|
||||
constexpr uint16_t VP_T_E7_Is = 0x2038; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_E7_Set = 0x203B; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_T_Bed_Is = 0x2040; // 4 Byte Integer
|
||||
constexpr uint16_t VP_T_Bed_Set = 0x2044; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_Min_EX_T_E = 0x2100;
|
||||
|
||||
constexpr uint16_t VP_Flowrate_E0 = 0x2200; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E1 = 0x2202; // 2 Byte Integer
|
||||
constexpr uint16_t VP_Flowrate_E2 = 0x2204;
|
||||
constexpr uint16_t VP_Flowrate_E3 = 0x2206;
|
||||
constexpr uint16_t VP_Flowrate_E4 = 0x2208;
|
||||
constexpr uint16_t VP_Flowrate_E5 = 0x220A;
|
||||
constexpr uint16_t VP_Flowrate_E6 = 0x220C;
|
||||
constexpr uint16_t VP_Flowrate_E7 = 0x220E;
|
||||
|
||||
// Move
|
||||
constexpr uint16_t VP_MOVE_X = 0x2300;
|
||||
constexpr uint16_t VP_MOVE_Y = 0x2302;
|
||||
constexpr uint16_t VP_MOVE_Z = 0x2304;
|
||||
constexpr uint16_t VP_MOVE_E0 = 0x2310;
|
||||
constexpr uint16_t VP_MOVE_E1 = 0x2312;
|
||||
constexpr uint16_t VP_MOVE_E2 = 0x2314;
|
||||
constexpr uint16_t VP_MOVE_E3 = 0x2316;
|
||||
constexpr uint16_t VP_MOVE_E4 = 0x2318;
|
||||
constexpr uint16_t VP_MOVE_E5 = 0x231A;
|
||||
constexpr uint16_t VP_MOVE_E6 = 0x231C;
|
||||
constexpr uint16_t VP_MOVE_E7 = 0x231E;
|
||||
constexpr uint16_t VP_HOME_ALL = 0x2320;
|
||||
constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2330;
|
||||
constexpr uint16_t VP_MOVE_DISTANCE = 0x2334;
|
||||
constexpr uint16_t VP_X_HOME = 0x2336;
|
||||
constexpr uint16_t VP_Y_HOME = 0x2338;
|
||||
constexpr uint16_t VP_Z_HOME = 0x233A;
|
||||
|
||||
// Fan Control Buttons , switch between "off" and "on"
|
||||
constexpr uint16_t VP_FAN0_CONTROL = 0x2350;
|
||||
constexpr uint16_t VP_FAN1_CONTROL = 0x2352;
|
||||
constexpr uint16_t VP_FAN2_CONTROL = 0x2354;
|
||||
constexpr uint16_t VP_FAN3_CONTROL = 0x2356;
|
||||
constexpr uint16_t VP_FAN4_CONTROL = 0x2358;
|
||||
constexpr uint16_t VP_FAN5_CONTROL = 0x235A;
|
||||
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE = 0x2380;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE1 = 0x2382;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE2 = 0x2384;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE3 = 0x2386;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE4 = 0x2388;
|
||||
constexpr uint16_t VP_LANGUAGE_CHANGE5 = 0x238A;
|
||||
|
||||
// LEVEL
|
||||
constexpr uint16_t VP_LEVEL_POINT = 0x2400;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT = 0x2410;
|
||||
constexpr uint16_t VP_MESH_LEVEL_ADJUST = 0x2412;
|
||||
constexpr uint16_t VP_MESH_LEVEL_DIP = 0x2414;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT_X = 0x2416;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT_Y = 0x2418;
|
||||
constexpr uint16_t VP_LEVEL_BUTTON = 0x2420;
|
||||
constexpr uint16_t VP_MESH_LEVEL_POINT_DIS = 0x2422;
|
||||
constexpr uint16_t VP_MESH_LEVEL_BACK = 0x2424;
|
||||
|
||||
constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2500;
|
||||
constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2504;
|
||||
constexpr uint16_t VP_LOAD_Filament = 0x2508;
|
||||
// constexpr uint16_t VP_LOAD_UNLOAD_Cancle = 0x250A;
|
||||
constexpr uint16_t VP_UNLOAD_Filament = 0x250B;
|
||||
constexpr uint16_t VP_Filament_distance = 0x2600;
|
||||
constexpr uint16_t VP_Filament_speed = 0x2604;
|
||||
constexpr uint16_t VP_MIN_EX_T = 0x2606;
|
||||
|
||||
constexpr uint16_t VP_E1_Filament_distance = 0x2614;
|
||||
constexpr uint16_t VP_E1_Filament_speed = 0x2616;
|
||||
constexpr uint16_t VP_E1_MIN_EX_T = 0x2618;
|
||||
|
||||
constexpr uint16_t VP_Fan0_Percentage = 0x2700; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan1_Percentage = 0x2702; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan2_Percentage = 0x2704; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Fan3_Percentage = 0x2706; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x2708; // 2 Byte Integer (0..100)
|
||||
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x2710;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x2712;
|
||||
constexpr uint16_t VP_FAN2_STATUS = 0x2714;
|
||||
constexpr uint16_t VP_FAN3_STATUS = 0x2716;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x2900; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x2904;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x2908;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x2910;
|
||||
constexpr uint16_t VP_E1_STEP_PER_MM = 0x2912;
|
||||
constexpr uint16_t VP_E2_STEP_PER_MM = 0x2914;
|
||||
constexpr uint16_t VP_E3_STEP_PER_MM = 0x2916;
|
||||
constexpr uint16_t VP_E4_STEP_PER_MM = 0x2918;
|
||||
constexpr uint16_t VP_E5_STEP_PER_MM = 0x291A;
|
||||
constexpr uint16_t VP_E6_STEP_PER_MM = 0x291C;
|
||||
constexpr uint16_t VP_E7_STEP_PER_MM = 0x291E;
|
||||
|
||||
constexpr uint16_t VP_X_MAX_SPEED = 0x2A00;
|
||||
constexpr uint16_t VP_Y_MAX_SPEED = 0x2A04;
|
||||
constexpr uint16_t VP_Z_MAX_SPEED = 0x2A08;
|
||||
constexpr uint16_t VP_E0_MAX_SPEED = 0x2A0C;
|
||||
constexpr uint16_t VP_E1_MAX_SPEED = 0x2A10;
|
||||
|
||||
constexpr uint16_t VP_X_ACC_MAX_SPEED = 0x2A28;
|
||||
constexpr uint16_t VP_Y_ACC_MAX_SPEED = 0x2A2C;
|
||||
constexpr uint16_t VP_Z_ACC_MAX_SPEED = 0x2A30;
|
||||
constexpr uint16_t VP_E0_ACC_MAX_SPEED = 0x2A34;
|
||||
constexpr uint16_t VP_E1_ACC_MAX_SPEED = 0x2A38;
|
||||
|
||||
constexpr uint16_t VP_TRAVEL_SPEED = 0x2A3C;
|
||||
constexpr uint16_t VP_FEEDRATE_MIN_SPEED = 0x2A40;
|
||||
constexpr uint16_t VP_T_F_SPEED = 0x2A44;
|
||||
constexpr uint16_t VP_ACC_SPEED = 0x2A48;
|
||||
|
||||
/* -------------------------------0x3000-0x3FFF------------------------------- */
|
||||
// Buttons on the SD-Card File listing.
|
||||
constexpr uint16_t VP_SD_ScrollEvent = 0x3020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
constexpr uint16_t VP_SD_FileSelected = 0x3022; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileSelectConfirm = 0x3024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
constexpr uint16_t VP_SD_ResumePauseAbort = 0x3026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x3028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
constexpr uint16_t VP_SD_Print_Setting = 0x3040;
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x3050; // Data: 0 down, 1 up
|
||||
constexpr uint16_t VP_SD_Print_LiveAdjustZ_Confirm = 0x3060;
|
||||
constexpr uint16_t VP_ZOffset_Distance = 0x3070;
|
||||
constexpr uint16_t VP_ZOffset_DE_DIS = 0x3080;
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 10; // FIXME move that info to the display and read it from there.
|
||||
constexpr uint16_t VP_SD_FileName0 = 0x3100;
|
||||
constexpr uint16_t VP_SD_FileName1 = 0x3120;
|
||||
constexpr uint16_t VP_SD_FileName2 = 0x3140;
|
||||
constexpr uint16_t VP_SD_FileName3 = 0x3160;
|
||||
constexpr uint16_t VP_SD_FileName4 = 0x3180;
|
||||
constexpr uint16_t VP_SD_FileName5 = 0x31A0;
|
||||
constexpr uint16_t VP_SD_FileName6 = 0x31C0;
|
||||
constexpr uint16_t VP_SD_FileName7 = 0x31E0;
|
||||
constexpr uint16_t VP_SD_FileName8 = 0x3200;
|
||||
constexpr uint16_t VP_SD_FileName9 = 0x3220;
|
||||
|
||||
constexpr uint16_t VP_SD_Print_ProbeOffsetZ = 0x32A0;
|
||||
constexpr uint16_t VP_SD_Print_Baby = 0x32B0;
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0;
|
||||
|
||||
// X Y Z Point
|
||||
constexpr uint16_t VP_XPos = 0x3300; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_YPos = 0x3302; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_ZPos = 0x3304; // 4 Byte Fixed point number; format xxx.yy
|
||||
constexpr uint16_t VP_EPos = 0x3306; // 4 Byte Fixed point number; format xxx.yy
|
||||
|
||||
// Print
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3330; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_PrintTime = 0x3340;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 32;
|
||||
constexpr uint16_t VP_PrintAccTime = 0x3360;
|
||||
constexpr uint16_t VP_PrintAccTime_LEN = 32;
|
||||
constexpr uint16_t VP_PrintsTotal = 0x3380;
|
||||
constexpr uint16_t VP_PrintsTotal_LEN = 16;
|
||||
|
||||
constexpr uint16_t VP_File_Pictutr0 = 0x3400;
|
||||
constexpr uint16_t VP_File_Pictutr1 = 0x3402;
|
||||
constexpr uint16_t VP_File_Pictutr2 = 0x3404;
|
||||
constexpr uint16_t VP_File_Pictutr3 = 0x3406;
|
||||
constexpr uint16_t VP_File_Pictutr4 = 0x3408;
|
||||
constexpr uint16_t VP_File_Pictutr5 = 0x340A;
|
||||
constexpr uint16_t VP_File_Pictutr6 = 0x340C;
|
||||
constexpr uint16_t VP_File_Pictutr7 = 0x340E;
|
||||
constexpr uint16_t VP_File_Pictutr8 = 0x3410;
|
||||
constexpr uint16_t VP_File_Pictutr9 = 0x3412;
|
||||
|
||||
constexpr uint16_t VP_BED_STATUS = 0x341C;
|
||||
|
||||
constexpr uint16_t VP_TMC_X_STEP = 0x3430;
|
||||
constexpr uint16_t VP_TMC_Y_STEP = 0x3432;
|
||||
constexpr uint16_t VP_TMC_Z_STEP = 0x3434;
|
||||
|
||||
constexpr uint16_t VP_TMC_X1_Current = 0x3436;
|
||||
constexpr uint16_t VP_TMC_Y1_Current = 0x3438;
|
||||
constexpr uint16_t VP_TMC_X_Current = 0x343A;
|
||||
constexpr uint16_t VP_TMC_Y_Current = 0x343C;
|
||||
constexpr uint16_t VP_TMC_Z_Current = 0x343E;
|
||||
constexpr uint16_t VP_TMC_E0_Current = 0x3440;
|
||||
constexpr uint16_t VP_TMC_E1_Current = 0x3442;
|
||||
constexpr uint16_t VP_TMC_Z1_Current = 0x3444;
|
||||
|
||||
|
||||
constexpr uint16_t VP_PrintTime_H = 0x3500;
|
||||
constexpr uint16_t VP_PrintTime_M = 0x3502;
|
||||
constexpr uint16_t VP_PrintTime_S = 0x3504;
|
||||
|
||||
// PIDs
|
||||
constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
constexpr uint16_t VP_E1_PID_I = 0x3708;
|
||||
constexpr uint16_t VP_E1_PID_D = 0x370A;
|
||||
constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
constexpr uint16_t VP_EEPROM_CTRL = 0x3720;
|
||||
|
||||
constexpr uint16_t VP_OFFSET_X = 0x3724;
|
||||
constexpr uint16_t VP_OFFSET_Y = 0x3728;
|
||||
constexpr uint16_t VP_OFFSET_Z = 0x372B;
|
||||
|
||||
// PID autotune
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x3800;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x3802;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x3804;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x3806;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x3808;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x380A;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x380C;
|
||||
// Calibrate Z
|
||||
constexpr uint16_t VP_Z_CALIBRATE = 0x3810;
|
||||
|
||||
constexpr uint16_t VP_AutoTurnOffSw = 0x3812;
|
||||
constexpr uint16_t VP_LCD_BLK = 0x3814;
|
||||
|
||||
constexpr uint16_t VP_X_PARK_POS = 0x3900;
|
||||
constexpr uint16_t VP_Y_PARK_POS = 0x3902;
|
||||
constexpr uint16_t VP_Z_PARK_POS = 0x3904;
|
||||
|
||||
/* -------------------------------0x4000-0x4FFF------------------------------- */
|
||||
// Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
constexpr uint16_t VP_E0_CONTROL = 0x4010;
|
||||
constexpr uint16_t VP_E1_CONTROL = 0x4012;
|
||||
//constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
//constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
//constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
//constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
constexpr uint16_t VP_BED_CONTROL = 0x401C;
|
||||
|
||||
// Preheat
|
||||
constexpr uint16_t VP_E0_BED_PREHEAT = 0x4020;
|
||||
constexpr uint16_t VP_E1_BED_PREHEAT = 0x4022;
|
||||
//constexpr uint16_t VP_E2_BED_PREHEAT = 0x4024;
|
||||
//constexpr uint16_t VP_E3_BED_PREHEAT = 0x4026;
|
||||
//constexpr uint16_t VP_E4_BED_PREHEAT = 0x4028;
|
||||
//constexpr uint16_t VP_E5_BED_PREHEAT = 0x402A;
|
||||
|
||||
// Filament load and unload
|
||||
// constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x4030;
|
||||
// constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x4032;
|
||||
|
||||
// Settings store , reset
|
||||
|
||||
// Level data
|
||||
constexpr uint16_t VP_Level_Point_One_X = 0x4100;
|
||||
constexpr uint16_t VP_Level_Point_One_Y = 0x4102;
|
||||
constexpr uint16_t VP_Level_Point_Two_X = 0x4104;
|
||||
constexpr uint16_t VP_Level_Point_Two_Y = 0x4106;
|
||||
constexpr uint16_t VP_Level_Point_Three_X = 0x4108;
|
||||
constexpr uint16_t VP_Level_Point_Three_Y = 0x410A;
|
||||
constexpr uint16_t VP_Level_Point_Four_X = 0x410C;
|
||||
constexpr uint16_t VP_Level_Point_Four_Y = 0x410E;
|
||||
constexpr uint16_t VP_Level_Point_Five_X = 0x4110;
|
||||
constexpr uint16_t VP_Level_Point_Five_Y = 0x4112;
|
||||
|
||||
|
||||
/* H43 Version */
|
||||
constexpr uint16_t VP_MKS_H43_VERSION = 0x4A00; // MKS H43 V1.0.0
|
||||
constexpr uint16_t VP_MKS_H43_VERSION_LEN = 16;
|
||||
constexpr uint16_t VP_MKS_H43_UpdataVERSION = 0x4A10; // MKS H43 V1.0.0
|
||||
constexpr uint16_t VP_MKS_H43_UpdataVERSION_LEN = 16;
|
||||
|
||||
/* -------------------------------0x5000-0xFFFF------------------------------- */
|
||||
constexpr uint16_t VP_HOME_Dis = 0x5000;
|
||||
constexpr uint16_t VP_Setting_Dis = 0x5010;
|
||||
constexpr uint16_t VP_Tool_Dis = 0x5020;
|
||||
constexpr uint16_t VP_Printing_Dis = 0x5030;
|
||||
|
||||
constexpr uint16_t VP_Language_Dis = 0x5080;
|
||||
constexpr uint16_t VP_LossPoint_Dis = 0x5090;
|
||||
|
||||
constexpr uint16_t VP_PrintPauseConfig_Dis = 0x5120;
|
||||
constexpr uint16_t VP_MotorPluse_Dis = 0x5140;
|
||||
constexpr uint16_t VP_MotorMaxSpeed_Dis = 0x5150;
|
||||
constexpr uint16_t VP_MotorMaxAcc_Dis = 0x5160;
|
||||
|
||||
constexpr uint16_t VP_X_Pluse_Dis = 0x5170;
|
||||
constexpr uint16_t VP_Y_Pluse_Dis = 0x5180;
|
||||
constexpr uint16_t VP_Z_Pluse_Dis = 0x5190;
|
||||
constexpr uint16_t VP_E0_Pluse_Dis = 0x51A0;
|
||||
constexpr uint16_t VP_E1_Pluse_Dis = 0x51B0;
|
||||
|
||||
constexpr uint16_t VP_X_Max_Speed_Dis = 0x5280;
|
||||
constexpr uint16_t VP_Y_Max_Speed_Dis = 0x5290;
|
||||
constexpr uint16_t VP_Z_Max_Speed_Dis = 0x52A0;
|
||||
constexpr uint16_t VP_E0_Max_Speed_Dis = 0x52B0;
|
||||
constexpr uint16_t VP_E1_Max_Speed_Dis = 0x52C0;
|
||||
|
||||
constexpr uint16_t VP_X_Max_Acc_Speed_Dis = 0x51E0;
|
||||
constexpr uint16_t VP_Y_Max_Acc_Speed_Dis = 0x51F0;
|
||||
constexpr uint16_t VP_Z_Max_Acc_Speed_Dis = 0x5200;
|
||||
constexpr uint16_t VP_E0_Max_Acc_Speed_Dis = 0x5210;
|
||||
constexpr uint16_t VP_E1_Max_Acc_Speed_Dis = 0x5220;
|
||||
|
||||
|
||||
constexpr uint16_t VP_PrintTime_Dis = 0x5470;
|
||||
constexpr uint16_t VP_E0_Temp_Dis = 0x5310;
|
||||
constexpr uint16_t VP_E1_Temp_Dis = 0x5320;
|
||||
constexpr uint16_t VP_HB_Temp_Dis = 0x5330;
|
||||
constexpr uint16_t VP_Feedrate_Dis = 0x5350;
|
||||
constexpr uint16_t VP_PrintAcc_Dis = 0x5340;
|
||||
constexpr uint16_t VP_Fan_Speed_Dis = 0x5360;
|
||||
|
||||
constexpr uint16_t VP_Min_Ex_Temp_Dis = 0x5380;
|
||||
|
||||
|
||||
constexpr uint16_t VP_X_PARK_POS_Dis = 0x53E0;
|
||||
constexpr uint16_t VP_Y_PARK_POS_Dis = 0x53F0;
|
||||
constexpr uint16_t VP_Z_PARK_POS_Dis = 0x5400;
|
||||
|
||||
|
||||
constexpr uint16_t VP_TravelAcc_Dis = 0x5440;
|
||||
constexpr uint16_t VP_FeedRateMin_Dis = 0x5450;
|
||||
constexpr uint16_t VP_TravelFeeRateMin_Dis = 0x5460;
|
||||
constexpr uint16_t VP_ACC_Dis = 0x5480;
|
||||
|
||||
constexpr uint16_t VP_Extrusion_Dis = 0x5230;
|
||||
constexpr uint16_t VP_HeatBed_Dis = 0x5240;
|
||||
|
||||
constexpr uint16_t VP_Printting_Dis = 0x5430;
|
||||
constexpr uint16_t VP_FactoryDefaults_Dis = 0x54C0;
|
||||
constexpr uint16_t VP_StoreSetting_Dis = 0x54B0;
|
||||
constexpr uint16_t VP_Info_EEPROM_2_Dis = 0x54D0;
|
||||
constexpr uint16_t VP_Info_EEPROM_1_Dis = 0x54E0;
|
||||
|
||||
constexpr uint16_t VP_AutoLevel_1_Dis = 0x55F0;
|
||||
|
||||
constexpr uint16_t VP_TMC_X_Step_Dis = 0x5530;
|
||||
constexpr uint16_t VP_TMC_Y_Step_Dis = 0x5540;
|
||||
constexpr uint16_t VP_TMC_Z_Step_Dis = 0x5550;
|
||||
constexpr uint16_t VP_TMC_X1_Current_Dis = 0x5560;
|
||||
constexpr uint16_t VP_TMC_Y1_Current_Dis = 0x5570;
|
||||
constexpr uint16_t VP_TMC_X_Current_Dis = 0x5580;
|
||||
constexpr uint16_t VP_TMC_Y_Current_Dis = 0x5590;
|
||||
constexpr uint16_t VP_TMC_Z_Current_Dis = 0x55A0;
|
||||
constexpr uint16_t VP_TMC_E0_Current_Dis = 0x55B0;
|
||||
constexpr uint16_t VP_TMC_E1_Current_Dis = 0x55C0;
|
||||
constexpr uint16_t VP_TMC_Z1_Current_Dis = 0x55E0;
|
||||
|
||||
constexpr uint16_t VP_AutoLEVEL_INFO1 = 0x5600;
|
||||
constexpr uint16_t VP_EX_TEMP_INFO1_Dis = 0x5610;
|
||||
constexpr uint16_t VP_EX_TEMP_INFO2_Dis = 0x5620;
|
||||
constexpr uint16_t VP_EX_TEMP_INFO3_Dis = 0x5630;
|
||||
constexpr uint16_t VP_LCD_BLK_Dis = 0x56A0;
|
||||
constexpr uint16_t VP_Info_PrinfFinsh_1_Dis = 0x5C00;
|
||||
constexpr uint16_t VP_Info_PrinfFinsh_2_Dis = 0x5C10;
|
||||
|
||||
constexpr uint16_t VP_Length_Dis = 0x5B00;
|
||||
|
||||
constexpr uint16_t VP_PrintConfrim_Info_Dis = 0x5B90;
|
||||
constexpr uint16_t VP_StopPrintConfrim_Info_Dis = 0x5B80;
|
||||
|
||||
constexpr uint16_t VP_Point_One_Dis = 0x5BA0;
|
||||
constexpr uint16_t VP_Point_Two_Dis = 0x5BB0;
|
||||
constexpr uint16_t VP_Point_Three_Dis = 0x5BC0;
|
||||
constexpr uint16_t VP_Point_Four_Dis = 0x5BD0;
|
||||
constexpr uint16_t VP_Point_Five_Dis = 0x5BE0;
|
||||
|
||||
constexpr uint16_t VP_Print_Dis = 0x5250;
|
||||
|
||||
constexpr uint16_t VP_About_Dis = 0x5A00;
|
||||
constexpr uint16_t VP_Config_Dis = 0x5A10;
|
||||
constexpr uint16_t VP_Filament_Dis = 0x5A20;
|
||||
constexpr uint16_t VP_Move_Dis = 0x5A30;
|
||||
constexpr uint16_t VP_Level_Dis = 0x5A50;
|
||||
constexpr uint16_t VP_Speed_Dis = 0x5A70;
|
||||
constexpr uint16_t VP_InOut_Dis = 0x5A80;
|
||||
|
||||
constexpr uint16_t VP_MotorConfig_Dis = 0x5100;
|
||||
constexpr uint16_t VP_LevelConfig_Dis = 0x5110;
|
||||
constexpr uint16_t VP_Advance_Dis = 0x5130;
|
||||
constexpr uint16_t VP_TemperatureConfig_Dis = 0x5390;
|
||||
|
||||
#endif // MKS_FINSH
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,309 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
#if 0
|
||||
static void sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4);
|
||||
static void sendinfoscreen_en_mks(const char* line1, const char* line2, const char* line3, const char* line4) ;
|
||||
static void sendinfoscreen_mks(const void* line1, const void* line2, const void* line3, const void* line4,uint16_t language);
|
||||
#endif
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char* msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
// Hook for manual move option
|
||||
static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
static void EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MeshLevel(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void Z_offset_select(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleGetExMinTemp_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void DGUS_LanguageDisplay(uint8_t var);
|
||||
static void TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void LanguagePInit(void);
|
||||
static void DGUS_Runout_Idle(void);
|
||||
static void DGUS_RunoutInit(void);
|
||||
static void DGUS_ExtrudeLoadInit(void);
|
||||
static void LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for settings
|
||||
static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTravelAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleFeedRateMinChange_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleMin_T_F_MKS(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
|
||||
static void MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void MKS_LOAD_UNLOAD_IDLE();
|
||||
static void MKS_LOAD_Cancle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetManualFilament(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the pause, resume or abort button.
|
||||
static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
// Marlin informed us about SD print completion.
|
||||
static void SDPrintingFinished();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
|
||||
static void DGUSLCD_SendPrintTimeToDisplay_MKS(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendBabyStepToDisplay_MKS(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendFanToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendGbkToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay_Language_MKS(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 4-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 2-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
DEBUG_ECHOLNPAIR_F(" >> ", f, 6);
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (int16_t)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; //< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; //< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; //< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#define MKS_Language_Choose 0x00
|
||||
#define MKS_Language_NoChoose 0x01
|
||||
|
||||
#define MKS_SimpleChinese 0
|
||||
#define MKS_English 1
|
||||
extern uint8_t DGUSLanguageSwitch;
|
||||
extern bool DGUSAutoTurnOff;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER MKSLCD_SCREEN_PRINT
|
||||
#define PLR_SCREEN_CANCEL MKSLCD_SCREEN_HOME
|
||||
#endif
|
||||
@@ -20,7 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS implementation written by coldtobi in 2019 for Marlin */
|
||||
/**
|
||||
* lcd/extui/lib/dgus/origin/DGUSDisplayDef.cpp
|
||||
*/
|
||||
|
||||
#include "../../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -87,7 +89,7 @@ const uint16_t VPList_Status[] PROGMEM = {
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
// VP_M117, for completeness, but it cannot be auto-uploaded
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,418 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../../MarlinCore.h"
|
||||
#include "../../../../../gcode/queue.h"
|
||||
#include "../../../../../libs/duration_t.h"
|
||||
#include "../../../../../module/settings.h"
|
||||
#include "../../../../../module/temperature.h"
|
||||
#include "../../../../../module/motion.h"
|
||||
#include "../../../../../module/planner.h"
|
||||
#include "../../../../../module/printcounter.h"
|
||||
#include "../../../../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
||||
if (touched_nr > filelist.count()) return;
|
||||
if (!filelist.seek(touched_nr)) return;
|
||||
|
||||
if (filelist.isDir()) {
|
||||
filelist.changeDir(filelist.filename());
|
||||
top_file = 0;
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED(DGUS_PRINT_FILENAME)
|
||||
// Send print filename
|
||||
dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true);
|
||||
#endif
|
||||
|
||||
// Setup Confirmation screen
|
||||
file_to_print = touched_nr;
|
||||
|
||||
HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!filelist.seek(file_to_print)) return;
|
||||
ExtUI::printFile(filelist.shortFilename());
|
||||
GotoScreen(DGUSLCD_SCREEN_STATUS);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
||||
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
||||
switch (swap16(*(uint16_t*)val_ptr)) {
|
||||
case 0: { // Resume
|
||||
if (ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: // Pause
|
||||
|
||||
GotoScreen(MKSLCD_SCREEN_PAUSE);
|
||||
if (!ExtUI::isPrintingFromMediaPaused()) {
|
||||
ExtUI::pausePrint();
|
||||
//ExtUI::mks_pausePrint();
|
||||
}
|
||||
break;
|
||||
case 2: // Abort
|
||||
HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) {
|
||||
uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN;
|
||||
if (target_line > DGUS_SD_FILESPERSCREEN) return;
|
||||
char tmpfilename[VP_SD_FileName_LEN + 1] = "";
|
||||
var.memadr = (void*)tmpfilename;
|
||||
|
||||
if (filelist.seek(top_file + target_line)) {
|
||||
snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename());
|
||||
}
|
||||
DGUSLCD_SendStringToDisplay(var);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardInserted() {
|
||||
top_file = 0;
|
||||
filelist.refresh();
|
||||
auto cs = getCurrentScreen();
|
||||
if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS)
|
||||
GotoScreen(DGUSLCD_SCREEN_SDFILELIST);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::SDCardRemoved() {
|
||||
if (current_screen == DGUSLCD_SCREEN_SDFILELIST
|
||||
|| (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm))
|
||||
|| current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint8_t *tmp = (uint8_t*)val_ptr;
|
||||
|
||||
// The keycode in target is coded as <from-frame><to-frame>, so 0x0100A means
|
||||
// from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special,
|
||||
// meaning "return to previous screen"
|
||||
DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1];
|
||||
|
||||
DEBUG_ECHOLNPAIR("\n DEBUG target", target);
|
||||
|
||||
if (target == DGUSLCD_SCREEN_POPUP) {
|
||||
// Special handling for popup is to return to previous menu
|
||||
if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb();
|
||||
PopToOldScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNewScreen(target);
|
||||
|
||||
#ifdef DEBUG_DGUSLCD
|
||||
if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPAIR("WARNING: No screen Mapping found for ", target);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleManualMove");
|
||||
|
||||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
if (movevalue) {
|
||||
const uint16_t choice = *(uint16_t*)var.memadr;
|
||||
movevalue = movevalue < 0 ? -choice : choice;
|
||||
}
|
||||
#endif
|
||||
char axiscode;
|
||||
unsigned int speed = 1500; // FIXME: get default feedrate for manual moves, dont hardcode.
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
|
||||
case VP_MOVE_X:
|
||||
axiscode = 'X';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::X)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Y:
|
||||
axiscode = 'Y';
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_MOVE_Z:
|
||||
axiscode = 'Z';
|
||||
speed = 300; // default to 5mm/s
|
||||
if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove;
|
||||
break;
|
||||
|
||||
case VP_HOME_ALL: // only used for homing
|
||||
axiscode = '\0';
|
||||
movevalue = 0; // ignore value sent from display, this VP is _ONLY_ for homing.
|
||||
break;
|
||||
}
|
||||
|
||||
if (!movevalue) {
|
||||
// homing
|
||||
DEBUG_ECHOPAIR(" homing ", axiscode);
|
||||
char buf[6] = "G28 X";
|
||||
buf[4] = axiscode;
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓");
|
||||
ForceCompleteUpdate();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// movement
|
||||
DEBUG_ECHOPAIR(" move ", axiscode);
|
||||
bool old_relative_mode = relative_mode;
|
||||
if (!relative_mode) {
|
||||
//DEBUG_ECHOPGM(" G91");
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
char buf[32]; // G1 X9999.99 F12345
|
||||
unsigned int backup_speed = MMS_TO_MMM(feedrate_mm_s);
|
||||
char sign[] = "\0";
|
||||
int16_t value = movevalue / 100;
|
||||
if (movevalue < 0) { value = -value; sign[0] = '-'; }
|
||||
int16_t fraction = ABS(movevalue) % 100;
|
||||
snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (backup_speed != speed) {
|
||||
snprintf_P(buf, 32, PSTR("G0 F%d"), backup_speed);
|
||||
queue.enqueue_one_now(buf);
|
||||
//DEBUG_ECHOPAIR(" ", buf);
|
||||
}
|
||||
// while (!enqueue_and_echo_command(buf)) idle();
|
||||
//DEBUG_ECHOLNPGM(" ✓ ");
|
||||
if (!old_relative_mode) {
|
||||
//DEBUG_ECHOPGM("G90");
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
//DEBUG_ECHOPGM(" ✓ ");
|
||||
}
|
||||
}
|
||||
|
||||
ForceCompleteUpdate();
|
||||
DEBUG_ECHOLNPGM("manmv done.");
|
||||
return;
|
||||
|
||||
cannotmove:
|
||||
DEBUG_ECHOLNPAIR(" cannot move ", axiscode);
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
||||
float value = (float)rawvalue / 10;
|
||||
DEBUG_ECHOLNPAIR("V2:", value);
|
||||
float newvalue = 0;
|
||||
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_PID_P: newvalue = value; break;
|
||||
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_PID_P: newvalue = value; break;
|
||||
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
case VP_BED_PID_P: newvalue = value; break;
|
||||
case VP_BED_PID_I: newvalue = scalePID_i(value); break;
|
||||
case VP_BED_PID_D: newvalue = scalePID_d(value); break;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPAIR_F("V3:", newvalue);
|
||||
*(float *)var.memadr = newvalue;
|
||||
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
#endif // HAS_PID_HEATING
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
||||
int16_t flag = swap16(*(uint16_t*)val_ptr),
|
||||
steps = flag ? -20 : 20;
|
||||
ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true);
|
||||
ForceCompleteUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentOption");
|
||||
|
||||
uint8_t e_temp = 0;
|
||||
filament_data.heated = false;
|
||||
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
||||
if (preheat_option <= 8) { // Load filament type
|
||||
filament_data.action = 1;
|
||||
}
|
||||
else if (preheat_option >= 10) { // Unload filament type
|
||||
preheat_option -= 10;
|
||||
filament_data.action = 2;
|
||||
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
||||
}
|
||||
else { // Cancel filament operation
|
||||
filament_data.action = 0;
|
||||
}
|
||||
|
||||
switch (preheat_option) {
|
||||
case 0: // Load PLA
|
||||
#ifdef PREHEAT_1_TEMP_HOTEND
|
||||
e_temp = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
e_temp = PREHEAT_3_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 3: // Load FLEX
|
||||
#ifdef PREHEAT_4_TEMP_HOTEND
|
||||
e_temp = PREHEAT_4_TEMP_HOTEND;
|
||||
#endif
|
||||
break;
|
||||
case 9: // Cool down
|
||||
default:
|
||||
e_temp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filament_data.action == 0) { // Go back to utility screen
|
||||
#if HOTENDS >= 1
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
||||
#endif
|
||||
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
||||
}
|
||||
else { // Go to the preheat screen to show the heating progress
|
||||
switch (var.VP) {
|
||||
default: return;
|
||||
#if HOTENDS >= 1
|
||||
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E0;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
||||
filament_data.extruder = ExtUI::extruder_t::E1;
|
||||
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) {
|
||||
DEBUG_ECHOLNPGM("HandleFilamentLoadUnload");
|
||||
if (filament_data.action <= 0) return;
|
||||
|
||||
// If we close to the target temperature, we can start load or unload the filament
|
||||
if (thermalManager.hotEnoughToExtrude(filament_data.extruder) && \
|
||||
thermalManager.targetHotEnoughToExtrude(filament_data.extruder)) {
|
||||
float movevalue = DGUS_FILAMENT_LOAD_LENGTH_PER_TIME;
|
||||
|
||||
if (filament_data.action == 1) { // load filament
|
||||
if (!filament_data.heated) {
|
||||
//GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
}
|
||||
else { // unload filament
|
||||
if (!filament_data.heated) {
|
||||
GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING);
|
||||
filament_data.heated = true;
|
||||
}
|
||||
// Before unloading extrude to prevent jamming
|
||||
if (filament_data.purge_length >= 0) {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue;
|
||||
filament_data.purge_length -= movevalue;
|
||||
}
|
||||
else {
|
||||
movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) - movevalue;
|
||||
}
|
||||
}
|
||||
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
||||
}
|
||||
}
|
||||
#endif // DGUS_FILAMENT_LOADUNLOAD
|
||||
|
||||
bool DGUSScreenHandler::loop() {
|
||||
dgusdisplay.loop();
|
||||
|
||||
const millis_t ms = millis();
|
||||
static millis_t next_event_ms = 0;
|
||||
|
||||
if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) {
|
||||
next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS;
|
||||
UpdateScreenVPData();
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
|
||||
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
|
||||
booted = true;
|
||||
#endif
|
||||
return IsScreenComplete();
|
||||
}
|
||||
|
||||
#endif // DGUS_LCD_UI_ORIGIN
|
||||
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSVPVariable.h"
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#include "../../../../../inc/MarlinConfig.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifing whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char* msg);
|
||||
// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
// Hook for manual move option
|
||||
static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// Hook for manual move.
|
||||
static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for settings
|
||||
static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
// Hook for fan control
|
||||
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the pause, resume or abort button.
|
||||
static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User confirmed the abort action
|
||||
static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the tune button
|
||||
static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
#endif
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 4-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (long)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a float value to the display.
|
||||
// Display will get a 2-byte integer scaled to the number of digits:
|
||||
// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
float f = *(float *)var.memadr;
|
||||
DEBUG_ECHOLNPAIR_F(" >> ", f, 6);
|
||||
f *= cpow(10, decimals);
|
||||
dgusdisplay.WriteVariable(var.VP, (int16_t)f);
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; //< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; //< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; //< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; //< file on top of file chooser
|
||||
static int16_t file_to_print; //< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
static void (*confirm_action_cb)();
|
||||
};
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION
|
||||
#define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS
|
||||
#endif
|
||||
@@ -112,7 +112,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for the 4D Systems, 4.3" Embedded SPI Display 480x272, SPI, FT800 (4DLCD-FT843)
|
||||
* Settings for the 4D Systems, 4.3" Embedded SPI Display 480x272, SPI, FT800 (4DLCD-FT843)
|
||||
* https://4dsystems.com.au/4dlcd-ft843
|
||||
* Datasheet:
|
||||
* https://4dsystems.com.au/mwdownloads/download/link/id/52/
|
||||
@@ -177,8 +177,105 @@
|
||||
constexpr uint8_t CSpread = 0;
|
||||
constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for EVE3-50G - Matrix Orbital 5.0" 800x480, BT815
|
||||
* https://www.matrixorbital.com/ftdi-eve/eve-bt815-bt816/eve3-50g
|
||||
* use for example with: https://github.com/RudolphRiedel/EVE_display-adapter
|
||||
*/
|
||||
#elif defined(LCD_EVE3_50G)
|
||||
#if !HAS_RESOLUTION
|
||||
#define TOUCH_UI_800x480
|
||||
#define TOUCH_UI_800x480_GENERIC // use more common timing parameters as the original set
|
||||
#endif
|
||||
#ifndef FTDI_API_LEVEL
|
||||
#define FTDI_API_LEVEL 810
|
||||
#endif
|
||||
namespace FTDI {
|
||||
IS_FT810
|
||||
constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated
|
||||
constexpr bool GPIO_0_Audio_Enable = false;
|
||||
constexpr bool GPIO_1_Audio_Shutdown = false;
|
||||
#define USE_GT911 // this display uses an alternative touch-controller and we need to tell the init function to switch
|
||||
constexpr uint8_t Swizzle = 0;
|
||||
constexpr uint8_t CSpread = 1;
|
||||
constexpr uint8_t Pclkpol = 1;
|
||||
constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */
|
||||
|
||||
constexpr uint32_t default_transform_a = 0x000109E4;
|
||||
constexpr uint32_t default_transform_b = 0x000007A6;
|
||||
constexpr uint32_t default_transform_c = 0xFFEC1EBA;
|
||||
constexpr uint32_t default_transform_d = 0x0000072C;
|
||||
constexpr uint32_t default_transform_e = 0x0001096A;
|
||||
constexpr uint32_t default_transform_f = 0xFFF469CF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for EVE2-50G - Matrix Orbital 5.0" 800x480, FT813
|
||||
* https://www.matrixorbital.com/ftdi-eve/eve-bt815-bt816/eve3-50g
|
||||
* use for example with: https://github.com/RudolphRiedel/EVE_display-adapter
|
||||
*/
|
||||
#elif defined(LCD_EVE2_50G)
|
||||
#if !HAS_RESOLUTION
|
||||
#define TOUCH_UI_800x480
|
||||
#define TOUCH_UI_800x480_GENERIC // use more common timing parameters as the original set
|
||||
#endif
|
||||
#ifndef FTDI_API_LEVEL
|
||||
#define FTDI_API_LEVEL 810
|
||||
#endif
|
||||
namespace FTDI {
|
||||
IS_FT810
|
||||
constexpr bool Use_Crystal = false; // 0 = use internal oscillator, 1 = module has a crystal populated
|
||||
constexpr bool GPIO_0_Audio_Enable = false;
|
||||
constexpr bool GPIO_1_Audio_Shutdown = false;
|
||||
#define PATCH_GT911 // this display uses an alternative touch-controller and we need to tell the init function to patch the FT813 for it
|
||||
constexpr uint8_t Pclkpol = 1;
|
||||
constexpr uint8_t Swizzle = 0;
|
||||
constexpr uint8_t CSpread = 1;
|
||||
constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */
|
||||
|
||||
constexpr uint32_t default_transform_a = 0x000109E4;
|
||||
constexpr uint32_t default_transform_b = 0x000007A6;
|
||||
constexpr uint32_t default_transform_c = 0xFFEC1EBA;
|
||||
constexpr uint32_t default_transform_d = 0x0000072C;
|
||||
constexpr uint32_t default_transform_e = 0x0001096A;
|
||||
constexpr uint32_t default_transform_f = 0xFFF469CF;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown or no TOUCH_UI_FTDI_EVE board specified. To add a new board, modify this file."
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* this data is used to patch FT813 displays that use a GT911 as a touch-controller */
|
||||
#ifdef PATCH_GT911
|
||||
constexpr PROGMEM unsigned char GT911_data[] = {
|
||||
26,255,255,255,32,32,48,0,4,0,0,0,2,0,0,0,
|
||||
34,255,255,255,0,176,48,0,120,218,237,84,221,111,84,69,20,63,51,179,93,160,148,101,111,76,5,44,141,123,111,161,11,219,154,16,9,16,17,229,156,75,26,11,13,21,227,3,16,252,184,179,
|
||||
45,219,143,45,41,125,144,72,67,100,150,71,189,113,18,36,17,165,100,165,198,16,32,17,149,196,240,128,161,16,164,38,54,240,0,209,72,130,15,38,125,48,66,82,30,76,19,31,172,103,46,
|
||||
139,24,255,4,227,157,204,156,51,115,102,206,231,239,220,5,170,94,129,137,75,194,216,98,94,103,117,115,121,76,131,177,125,89,125,82,123,60,243,58,142,242,204,185,243,188,118,156,
|
||||
227,155,203,238,238,195,251,205,229,71,92,28,169,190,184,84,143,113,137,53,244,103,181,237,87,253,113,137,233,48,12,198,165,181,104,139,25,84,253,155,114,74,191,0,54,138,163,
|
||||
12,62,131,207,129,23,217,34,91,31,128,65,246,163,175,213,8,147,213,107,35,203,94,108,3,111,40,171,83,24,15,165,177,222,116,97,23,188,140,206,150,42,102,181,87,78,86,182,170,134,
|
||||
215,241,121,26,243,252,2,76,115,217,139,222,206,173,136,132,81,61,35,185,39,113,23,46,199,76,178,54,151,183,224,0,40,189,28,149,182,58,131,79,152,30,76,34,98,234,162,216,133,141,
|
||||
102,39,170,40,192,101,53,201,146,191,37,77,44,177,209,74,211,5,206,187,5,6,216,47,53,96,123,22,50,103,251,192,84,17,74,227,185,56,106,51,91,161,96,182,163,48,171,141,139,65,152,
|
||||
66,66,11,102,43,158,75,36,80,147,184,147,139,112,17,235,216,103,111,239,245,92,10,175,194,40,44,58,125,5,59,112,50,103,245,4,78,192,5,156,194,51,60,191,134,75,110,173,237,46,192,
|
||||
121,156,192,115,184,218,120,67,63,115,46,11,102,10,97,232,50,235,114,182,148,118,178,41,188,12,135,77,202,124,12,96,238,35,161,234,189,129,23,249,212,139,230,25,53,48,205,52,93,
|
||||
163,117,53,154,170,81,85,163,178,70,69,66,167,241,14,46,241,1,226,136,152,179,197,59,184,148,254,49,132,48,15,176,137,192,76,131,196,105,104,162,86,81,160,165,255,26,173,162,137,
|
||||
86,145,210,183,192,55,175,194,211,60,91,120,230,184,174,27,41,131,155,40,224,29,87,179,232,16,55,55,7,165,147,81,23,165,49,101,54,224,75,180,81,108,18,29,226,69,225,110,175,224,
|
||||
42,212,25,47,130,193,110,234,192,215,252,56,74,162,24,46,251,174,54,106,68,245,14,9,155,160,22,120,207,104,240,29,90,178,140,28,24,220,47,166,112,61,251,208,192,111,56,239,238,
|
||||
93,255,251,62,99,32,193,75,61,190,235,123,229,110,218,194,85,79,225,59,98,20,238,227,235,220,11,221,149,25,180,116,194,159,111,96,192,24,213,59,139,179,156,215,69,230,19,24,35,
|
||||
135,117,206,171,206,162,67,129,234,61,235,11,104,103,84,64,223,167,254,40,163,101,92,84,43,150,46,249,219,205,7,116,11,91,104,61,57,75,223,8,48,25,28,119,252,222,113,49,86,249,
|
||||
74,180,211,156,181,61,215,168,157,7,251,199,150,242,250,91,58,132,94,121,7,53,151,139,98,6,165,153,69,214,32,110,211,100,101,31,89,45,81,98,23,205,205,197,209,109,186,198,35,
|
||||
141,191,249,25,60,132,223,153,251,98,20,239,146,139,20,217,250,41,250,137,58,177,90,57,79,51,108,233,20,253,194,187,49,222,205,114,141,96,48,175,219,107,54,111,138,22,154,103,
|
||||
108,79,58,252,179,178,79,164,195,2,153,36,39,170,199,201,167,197,85,106,8,59,177,81,46,56,2,230,75,114,17,55,112,188,65,208,137,77,114,10,115,55,58,208,197,173,122,87,6,140,
|
||||
110,42,208,124,163,70,108,241,104,18,245,98,214,187,134,53,42,221,22,182,133,211,116,148,177,194,209,192,85,90,199,58,55,203,2,229,19,137,187,161,228,154,112,203,145,125,244,
|
||||
188,220,118,228,41,201,181,41,195,144,215,183,51,80,250,21,217,16,217,200,235,109,227,188,122,218,142,60,170,224,112,240,184,130,229,224,113,5,223,148,163,80,165,183,130,187,
|
||||
132,116,64,238,161,85,220,115,139,205,98,227,244,29,102,125,7,37,243,123,223,11,26,92,63,243,116,61,191,138,123,244,160,84,186,74,31,5,174,247,119,135,199,248,253,135,242,97,
|
||||
102,145,190,144,14,85,238,221,231,193,158,48,205,25,120,248,15,220,29,158,9,70,185,30,103,229,33,254,23,237,160,172,62,193,90,222,224,232,14,200,56,90,104,142,227,120,110,6,
|
||||
21,211,203,65,150,99,151,220,247,87,164,50,159,49,239,234,58,142,0,109,108,123,18,79,227,36,100,248,222,205,96,127,120,26,171,228,69,63,36,17,252,200,17,116,242,187,227,88,143,
|
||||
247,2,75,191,6,130,59,188,11,55,240,31,243,122,152,226,183,207,154,73,188,39,219,43,105,222,87,41,143,141,140,175,73,112,184,252,61,184,16,90,250,35,168,82,119,176,57,116,94,
|
||||
200,150,22,190,179,44,104,12,235,84,149,102,252,89,154,193,99,228,106,242,125,248,64,194,255,223,127,242,83,11,255,2,70,214,226,128,0,0
|
||||
};
|
||||
#endif // PATCH_GT911
|
||||
|
||||
@@ -1073,37 +1073,48 @@ void CLCD::init() {
|
||||
for (counter = 0; counter < 250; counter++) {
|
||||
uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C;
|
||||
if (device_id == 0x7C) {
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
SERIAL_ECHO_MSG("FTDI chip initialized");
|
||||
#endif
|
||||
if (ENABLED(TOUCH_UI_DEBUG)) SERIAL_ECHO_MSG("FTDI chip initialized ");
|
||||
break;
|
||||
}
|
||||
else
|
||||
delay(1);
|
||||
|
||||
if (counter == 249) {
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", device_id);
|
||||
#endif
|
||||
}
|
||||
if (TERN0(TOUCH_UI_DEBUG, counter > 248))
|
||||
SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", device_id);
|
||||
}
|
||||
|
||||
/* make sure that all units are in working conditions, usually the touch-controller needs a little more time */
|
||||
/* Ensure all units are in working condition, usually the touch-controller needs a little more time */
|
||||
for (counter = 0; counter < 100; counter++) {
|
||||
uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03;
|
||||
if (reset_status == 0x00) {
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
SERIAL_ECHO_MSG("FTDI chip all units running ");
|
||||
#endif
|
||||
if (ENABLED(TOUCH_UI_DEBUG)) SERIAL_ECHO_MSG("FTDI chip all units running ");
|
||||
break;
|
||||
}
|
||||
else
|
||||
delay(1);
|
||||
|
||||
if (ENABLED(TOUCH_UI_DEBUG) && counter == 99)
|
||||
if (TERN0(TOUCH_UI_DEBUG, counter > 98))
|
||||
SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", reset_status);
|
||||
}
|
||||
|
||||
#if ENABLED(USE_GT911) /* switch BT815 to use Goodix GT911 touch controller */
|
||||
mem_write_32(REG::TOUCH_CONFIG, 0x000005D1);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PATCH_GT911) /* patch FT813 use Goodix GT911 touch controller */
|
||||
mem_write_pgm(REG::CMDB_WRITE, GT911_data, sizeof(GT911_data)); /* write binary blob to command-fifo */
|
||||
delay(10);
|
||||
mem_write_8(REG::TOUCH_OVERSAMPLE, 0x0F); /* setup oversample to 0x0f as "hidden" in binary-blob for AN_336 */
|
||||
mem_write_16(REG::TOUCH_CONFIG, 0x05d0); /* write magic cookie as requested by AN_336 */
|
||||
|
||||
/* specific to the EVE2 modules from Matrix-Orbital we have to use GPIO3 to reset GT911 */
|
||||
mem_write_16(REG::GPIOX_DIR,0x8008); /* Reset-Value is 0x8000, adding 0x08 sets GPIO3 to output, default-value for REG_GPIOX is 0x8000 -> Low output on GPIO3 */
|
||||
delay(1); /* wait more than 100µs */
|
||||
mem_write_8(REG::CPURESET, 0x00); /* clear all resets */
|
||||
delay(56); /* wait more than 55ms */
|
||||
mem_write_16(REG::GPIOX_DIR,0x8000); /* setting GPIO3 back to input */
|
||||
#endif
|
||||
|
||||
mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default
|
||||
|
||||
/* Configure the FT8xx Registers */
|
||||
@@ -1140,13 +1151,13 @@ void CLCD::init() {
|
||||
if (GPIO_1_Audio_Shutdown) {
|
||||
mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP1);
|
||||
mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP1);
|
||||
} else if (GPIO_0_Audio_Enable) {
|
||||
}
|
||||
else if (GPIO_0_Audio_Enable) {
|
||||
mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP0);
|
||||
mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
mem_write_8(REG::GPIO, GPIO_DISP); /* REG::GPIO_DIR is set to output for GPIO_DISP by default */
|
||||
}
|
||||
|
||||
mem_write_8(REG::PCLK, Pclk); // Turns on Clock by setting PCLK Register to the value necessary for the module
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
constexpr uint16_t Vsync0 = tvfp - 1; \
|
||||
constexpr uint16_t Vsync1 = tvfp + tvpw - 1; \
|
||||
static_assert(thfp + thb + Hsize == th, "Mismatch in display th"); \
|
||||
static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv");
|
||||
static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv")
|
||||
|
||||
#if ENABLED(TOUCH_UI_320x240)
|
||||
namespace FTDI {
|
||||
@@ -85,7 +85,7 @@
|
||||
constexpr uint16_t tvb = 2; // VS Back porch (blanking)
|
||||
constexpr uint16_t tvpw = 10; // VS pulse width
|
||||
|
||||
COMPUTE_REGS_FROM_DATASHEET
|
||||
COMPUTE_REGS_FROM_DATASHEET;
|
||||
|
||||
constexpr uint32_t default_transform_a = 0x00008100;
|
||||
constexpr uint32_t default_transform_b = 0x00000000;
|
||||
@@ -97,29 +97,44 @@
|
||||
|
||||
#elif defined(TOUCH_UI_800x480)
|
||||
namespace FTDI {
|
||||
constexpr uint8_t Pclk = 3;
|
||||
constexpr uint8_t Pclkpol = 1;
|
||||
constexpr uint16_t Hsize = 800;
|
||||
constexpr uint16_t Vsize = 480;
|
||||
#if defined(TOUCH_UI_800x480_GENERIC)
|
||||
constexpr uint8_t Pclk = 2;
|
||||
constexpr uint16_t Hsize = 800;
|
||||
constexpr uint16_t Vsize = 480;
|
||||
|
||||
constexpr uint16_t th = 1056; // One horizontal line
|
||||
constexpr uint16_t thfp = 210; // HS Front porch
|
||||
constexpr uint16_t thb = 46; // HS Back porch (blanking)
|
||||
constexpr uint16_t thpw = 23; // HS pulse width
|
||||
constexpr uint16_t Vsync0 = 0;
|
||||
constexpr uint16_t Vsync1 = 3;
|
||||
constexpr uint16_t Voffset = 32;
|
||||
constexpr uint16_t Vcycle = 525;
|
||||
constexpr uint16_t Hsync0 = 0;
|
||||
constexpr uint16_t Hsync1 = 48;
|
||||
constexpr uint16_t Hoffset = 88;
|
||||
constexpr uint16_t Hcycle = 928;
|
||||
#else
|
||||
constexpr uint8_t Pclk = 3;
|
||||
constexpr uint8_t Pclkpol = 1;
|
||||
constexpr uint16_t Hsize = 800;
|
||||
constexpr uint16_t Vsize = 480;
|
||||
|
||||
constexpr uint16_t tv = 525; // Vertical period time
|
||||
constexpr uint16_t tvfp = 22; // VS Front porch
|
||||
constexpr uint16_t tvb = 23; // VS Back porch (blanking)
|
||||
constexpr uint16_t tvpw = 10; // VS pulse width
|
||||
constexpr uint16_t th = 1056; // One horizontal line
|
||||
constexpr uint16_t thfp = 210; // HS Front porch
|
||||
constexpr uint16_t thb = 46; // HS Back porch (blanking)
|
||||
constexpr uint16_t thpw = 23; // HS pulse width
|
||||
|
||||
COMPUTE_REGS_FROM_DATASHEET
|
||||
constexpr uint16_t tv = 525; // Vertical period time
|
||||
constexpr uint16_t tvfp = 22; // VS Front porch
|
||||
constexpr uint16_t tvb = 23; // VS Back porch (blanking)
|
||||
constexpr uint16_t tvpw = 10; // VS pulse width
|
||||
|
||||
constexpr uint32_t default_transform_a = 0x0000D8B9;
|
||||
constexpr uint32_t default_transform_b = 0x00000124;
|
||||
constexpr uint32_t default_transform_c = 0xFFE23926;
|
||||
constexpr uint32_t default_transform_d = 0xFFFFFF51;
|
||||
constexpr uint32_t default_transform_e = 0xFFFF7E4F;
|
||||
constexpr uint32_t default_transform_f = 0x01F0AF70;
|
||||
COMPUTE_REGS_FROM_DATASHEET;
|
||||
|
||||
constexpr uint32_t default_transform_a = 0x0000D8B9;
|
||||
constexpr uint32_t default_transform_b = 0x00000124;
|
||||
constexpr uint32_t default_transform_c = 0xFFE23926;
|
||||
constexpr uint32_t default_transform_d = 0xFFFFFF51;
|
||||
constexpr uint32_t default_transform_e = 0xFFFF7E4F;
|
||||
constexpr uint32_t default_transform_f = 0x01F0AF70;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# location: <https://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse, re, sys
|
||||
import argparse,re,sys
|
||||
|
||||
usage = '''
|
||||
This program extracts line segments from a SVG file and writes
|
||||
|
||||
@@ -187,7 +187,7 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) {
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
if (get_chocolate_fill_level() > 0.9) {
|
||||
if (get_chocolate_fill_level() > 0.75) {
|
||||
mydata.repeat_tag = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ struct LoadChocolateScreenData {
|
||||
|
||||
class LoadChocolateScreen : public BaseScreen, public CachedScreen<LOAD_CHOCOLATE_SCREEN_CACHE> {
|
||||
private:
|
||||
static void setManualFeedrateAndIncrement(float feedrate_mm_s, float &increment);
|
||||
static void draw_syringe(draw_mode_t what);
|
||||
static void draw_arrows(draw_mode_t what);
|
||||
static void draw_buttons(draw_mode_t what);
|
||||
static void draw_text(draw_mode_t what);
|
||||
public:
|
||||
static void setManualFeedrateAndIncrement(float feedrate_mm_s, float &increment);
|
||||
static void onEntry();
|
||||
static void onIdle();
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
@@ -34,7 +34,7 @@ constexpr static MoveAxisScreenData &mydata = screen_data.MoveAxisScreen;
|
||||
|
||||
void MoveEScreen::onRedraw(draw_mode_t what) {
|
||||
widgets_t w(what);
|
||||
w.precision(1);
|
||||
w.precision(1, DEFAULT_MIDRANGE);
|
||||
w.units(GET_TEXT_F(MSG_UNITS_MM));
|
||||
w.heading( GET_TEXT_F(MSG_E_MOVE));
|
||||
w.color(Theme::e_axis);
|
||||
|
||||
@@ -235,7 +235,7 @@ bool StatusScreen::onTouchStart(uint8_t) {
|
||||
|
||||
bool StatusScreen::onTouchEnd(uint8_t tag) {
|
||||
switch (tag) {
|
||||
case 1: SpinnerDialogBox::enqueueAndWait_P(F("G0 X0 Y0")); break;
|
||||
case 1: SpinnerDialogBox::enqueueAndWait_P(F("G28 O\nG27")); break;
|
||||
case 2: GOTO_SCREEN(LoadChocolateScreen); break;
|
||||
case 3: GOTO_SCREEN(PreheatMenu); break;
|
||||
case 4: GOTO_SCREEN(MainMenu); break;
|
||||
@@ -274,8 +274,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
|
||||
|
||||
bool StatusScreen::onTouchHeld(uint8_t tag) {
|
||||
if (tag == 8 && !ExtUI::isMoving()) {
|
||||
increment = 0.05;
|
||||
MoveAxisScreen::setManualFeedrate(E0, increment);
|
||||
LoadChocolateScreen::setManualFeedrateAndIncrement(1, increment);
|
||||
UI_INCREMENT(AxisPosition_mm, E0);
|
||||
current_screen.onRefresh();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ SCREEN_TABLE {
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_BIO_CONFIRMOME_E)
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_STATUS_SCREEN)
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_MAIN_MENU)
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_ADVANCED_SETTINGS_MENU)
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_PREHEAT_MENU)
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_PREHEAT_SCREEN)
|
||||
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_UNLOAD_CARTRIDGE_SCREEN)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user