Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x
This commit is contained in:
+3
-1
@@ -1 +1,3 @@
|
||||
custom: http://www.thinkyhead.com/donate-to-marlin
|
||||
github: [thinkyhead]
|
||||
patreon: thinkyhead
|
||||
custom: ["http://www.thinkyhead.com/donate-to-marlin"]
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# bump-date.yml
|
||||
# Bump the distribution date once per day
|
||||
#
|
||||
|
||||
name: Bump Distribution Date
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
bump_date:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Check out bugfix-2.0.x
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: bugfix-2.0.x
|
||||
|
||||
- name: Bump Distribution Date
|
||||
run: source ./buildroot/bin/bump_date
|
||||
@@ -54,6 +54,7 @@ jobs:
|
||||
- BIGTREE_SKR_PRO
|
||||
- mks_robin
|
||||
- ARMED
|
||||
- FYSETC_S6
|
||||
|
||||
# Put lengthy tests last
|
||||
|
||||
@@ -94,6 +95,8 @@ jobs:
|
||||
|
||||
- name: Run ${{ matrix.test-platform }} Tests
|
||||
run: |
|
||||
# Inline tests script
|
||||
[[ "$GITHUB_REPOSITORY" == "MarlinFirmware/Marlin" ]] || exit 0
|
||||
chmod +x buildroot/bin/*
|
||||
chmod +x buildroot/share/tests/*
|
||||
export PATH=./buildroot/bin/:./buildroot/share/tests/:${PATH}
|
||||
|
||||
+18
-8
@@ -412,6 +412,7 @@
|
||||
#define TEMP_SENSOR_4 0
|
||||
#define TEMP_SENSOR_5 0
|
||||
#define TEMP_SENSOR_BED 0
|
||||
#define TEMP_SENSOR_PROBE 0
|
||||
#define TEMP_SENSOR_CHAMBER 0
|
||||
|
||||
// Dummy thermistor constant temperature readings, for use with 998 and 999
|
||||
@@ -654,12 +655,13 @@
|
||||
*
|
||||
* A4988 is assumed for unspecified drivers.
|
||||
*
|
||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100,
|
||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
|
||||
* TB6560, TB6600, TMC2100,
|
||||
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
||||
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
|
||||
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
|
||||
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||
*/
|
||||
//#define X_DRIVER_TYPE A4988
|
||||
//#define Y_DRIVER_TYPE A4988
|
||||
@@ -1943,10 +1945,11 @@
|
||||
// FYSETC variant of the MINI12864 graphic controller with SD support
|
||||
// https://wiki.fysetc.com/Mini12864_Panel/
|
||||
//
|
||||
//#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default
|
||||
//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on)
|
||||
//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight
|
||||
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight
|
||||
//#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default
|
||||
//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on)
|
||||
//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight
|
||||
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight
|
||||
//#define FYSETC_GENERIC_12864_1_1 // Larger display with basic ON/OFF backlight.
|
||||
|
||||
//
|
||||
// Factory display for Creality CR-10
|
||||
@@ -1957,6 +1960,11 @@
|
||||
//
|
||||
//#define CR10_STOCKDISPLAY
|
||||
|
||||
//
|
||||
// Ender-2 OEM display, a variant of the MKS_MINI_12864
|
||||
//
|
||||
//#define ENDER2_STOCKDISPLAY
|
||||
|
||||
//
|
||||
// ANET and Tronxy Graphical Controller
|
||||
//
|
||||
@@ -2025,9 +2033,11 @@
|
||||
//=============================================================================
|
||||
|
||||
//
|
||||
// DGUS Touch Display with DWIN OS
|
||||
// DGUS Touch Display with DWIN OS. (Choose one.)
|
||||
//
|
||||
//#define DGUS_LCD
|
||||
//#define DGUS_LCD_UI_ORIGIN
|
||||
//#define DGUS_LCD_UI_FYSETC
|
||||
//#define DGUS_LCD_UI_HIPRECY
|
||||
|
||||
//
|
||||
// Touch-screen LCD for Malyan M200 printers
|
||||
|
||||
+151
-33
@@ -368,7 +368,7 @@
|
||||
* FAST_PWM_FAN_FREQUENCY [undefined by default]
|
||||
* Set this to your desired frequency.
|
||||
* If left undefined this defaults to F = F_CPU/(2*255*1)
|
||||
* ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers
|
||||
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
|
||||
* These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required
|
||||
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
|
||||
*
|
||||
@@ -1243,6 +1243,44 @@
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
//
|
||||
// Additional options for DGUS / DWIN displays
|
||||
//
|
||||
#if HAS_DGUS_LCD
|
||||
#define DGUS_SERIAL_PORT 2
|
||||
#define DGUS_BAUDRATE 115200
|
||||
|
||||
#define DGUS_RX_BUFFER_SIZE 128
|
||||
#define DGUS_TX_BUFFER_SIZE 48
|
||||
//#define DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS // Fix Rx overrun situation (Currently only for AVR)
|
||||
|
||||
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
|
||||
#define BOOTSCREEN_TIMEOUT 3000 // (ms) Duration to display the boot screen
|
||||
|
||||
#if EITHER(DGUS_LCD_UI_FYSETC, 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 DUGS_UI_MOVE_DIS_OPTION // Disabled by default for UI_FYSETC
|
||||
#else
|
||||
#define DUGS_UI_MOVE_DIS_OPTION // Enabled by default for UI_HIPRECY
|
||||
#endif
|
||||
|
||||
#define DGUS_FILAMENT_LOADUNLOAD
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
#define DGUS_FILAMENT_PURGE_LENGTH 10
|
||||
#define DGUS_FILAMENT_LOAD_LENGTH_PER_TIME 0.5 // (mm) Adjust in proportion to DGUS_UPDATE_INTERVAL_MS
|
||||
#endif
|
||||
|
||||
#define DGUS_UI_WAITING // Show a "waiting" screen between some screens
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
#define DGUS_UI_WAITING_STATUS 10
|
||||
#define DGUS_UI_WAITING_STATUS_PERIOD 8 // Increase to slower waiting status looping
|
||||
#endif
|
||||
#endif
|
||||
#endif // HAS_DGUS_LCD
|
||||
|
||||
//
|
||||
// Touch UI for the FTDI Embedded Video Engine (EVE)
|
||||
//
|
||||
@@ -1341,6 +1379,13 @@
|
||||
//#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan
|
||||
#endif
|
||||
|
||||
//
|
||||
// ADC Button Debounce
|
||||
//
|
||||
#if HAS_ADC_BUTTONS
|
||||
#define ADC_BUTTON_DEBOUNCE_DELAY 16 // (ms) Increase if buttons bounce or repeat too fast
|
||||
#endif
|
||||
|
||||
// @section safety
|
||||
|
||||
/**
|
||||
@@ -1484,6 +1529,38 @@
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thermal Probe Compensation
|
||||
* Probe measurements are adjusted to compensate for temperature distortion.
|
||||
* Use G76 to calibrate this feature. Use M871 to set values manually.
|
||||
* For a more detailed explanation of the process see G76_M871.cpp.
|
||||
*/
|
||||
#if HAS_BED_PROBE && TEMP_SENSOR_PROBE && TEMP_SENSOR_BED
|
||||
// Enable thermal first layer compensation using bed and probe temperatures
|
||||
#define PROBE_TEMP_COMPENSATION
|
||||
|
||||
// Add additional compensation depending on hotend temperature
|
||||
// Note: this values cannot be calibrated and have to be set manually
|
||||
#ifdef PROBE_TEMP_COMPENSATION
|
||||
// Max temperature that can be reached by heated bed.
|
||||
// This is required only for the calibration process.
|
||||
#define PTC_MAX_BED_TEMP 110
|
||||
|
||||
// Park position to wait for probe cooldown
|
||||
#define PTC_PARK_POS_X 0.0F
|
||||
#define PTC_PARK_POS_Y 0.0F
|
||||
#define PTC_PARK_POS_Z 100.0F
|
||||
|
||||
// Probe position to probe and wait for probe to reach target temperature
|
||||
#define PTC_PROBE_POS_X 90.0F
|
||||
#define PTC_PROBE_POS_Y 100.0F
|
||||
|
||||
// Enable additional compensation using hotend temperature
|
||||
// Note: this values cannot be calibrated automatically but have to be set manually
|
||||
//#define USE_TEMP_EXT_COMPENSATION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// @section extras
|
||||
|
||||
//
|
||||
@@ -1491,9 +1568,10 @@
|
||||
//
|
||||
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
|
||||
#if ENABLED(ARC_SUPPORT)
|
||||
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
|
||||
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
|
||||
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
||||
#define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment
|
||||
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
|
||||
//#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum)
|
||||
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
||||
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
|
||||
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
|
||||
#endif
|
||||
@@ -2178,12 +2256,12 @@
|
||||
|
||||
#endif // HAS_TRINAMIC
|
||||
|
||||
// @section L6470
|
||||
// @section L64XX
|
||||
|
||||
/**
|
||||
* L6470 Stepper Driver options
|
||||
* L64XX Stepper Driver options
|
||||
*
|
||||
* Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
|
||||
* Arduino-L6470 library (0.8.0 or higher) is required.
|
||||
* https://github.com/ameyer/Arduino-L6470
|
||||
*
|
||||
* Requires the following to be defined in your pins_YOUR_BOARD file
|
||||
@@ -2191,114 +2269,133 @@
|
||||
* L6470_CHAIN_MISO_PIN
|
||||
* L6470_CHAIN_MOSI_PIN
|
||||
* L6470_CHAIN_SS_PIN
|
||||
* L6470_RESET_CHAIN_PIN (optional)
|
||||
* ENABLE_RESET_L64XX_CHIPS(Q) where Q is 1 to enable and 0 to reset
|
||||
*/
|
||||
#if HAS_DRIVER(L6470)
|
||||
|
||||
#if HAS_L64XX
|
||||
|
||||
//#define L6470_CHITCHAT // Display additional status info
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
#define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128)
|
||||
#define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
|
||||
#define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down)
|
||||
#define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper
|
||||
#define X_CHAIN_POS -1 // Position in SPI chain. (<=0 : Not in chain. 1 : Nearest MOSI)
|
||||
#if AXIS_IS_L64XX(X)
|
||||
#define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) - L6474 max is 16
|
||||
#define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current
|
||||
// L6470 & L6474 - VALID: 375 x (1 - 16) - 6A max - rounds down
|
||||
// POWERSTEP01: VALID: 1000 x (1 - 32) - 32A max - rounds down
|
||||
#define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down)
|
||||
// L6470 & L6474 - VALID: 31.25 * (1-128) - 4A max - rounds down
|
||||
// POWERSTEP01: VALID: 200 x (1 - 32) - 6.4A max - rounds down
|
||||
// L6474 - STALLCURRENT setting is used to set the nominal (TVAL) current
|
||||
#define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper - not used by L6474
|
||||
#define X_CHAIN_POS -1 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI
|
||||
#define X_SLEW_RATE 1 // 0-3, Slew 0 is slowest, 3 is fastest
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
#if AXIS_IS_L64XX(X2)
|
||||
#define X2_MICROSTEPS 128
|
||||
#define X2_OVERCURRENT 2000
|
||||
#define X2_STALLCURRENT 1500
|
||||
#define X2_MAX_VOLTAGE 127
|
||||
#define X2_CHAIN_POS -1
|
||||
#define X2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
#if AXIS_IS_L64XX(Y)
|
||||
#define Y_MICROSTEPS 128
|
||||
#define Y_OVERCURRENT 2000
|
||||
#define Y_STALLCURRENT 1500
|
||||
#define Y_MAX_VOLTAGE 127
|
||||
#define Y_CHAIN_POS -1
|
||||
#define Y_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
#if AXIS_IS_L64XX(Y2)
|
||||
#define Y2_MICROSTEPS 128
|
||||
#define Y2_OVERCURRENT 2000
|
||||
#define Y2_STALLCURRENT 1500
|
||||
#define Y2_MAX_VOLTAGE 127
|
||||
#define Y2_CHAIN_POS -1
|
||||
#define Y2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
#if AXIS_IS_L64XX(Z)
|
||||
#define Z_MICROSTEPS 128
|
||||
#define Z_OVERCURRENT 2000
|
||||
#define Z_STALLCURRENT 1500
|
||||
#define Z_MAX_VOLTAGE 127
|
||||
#define Z_CHAIN_POS -1
|
||||
#define Z_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
#if AXIS_IS_L64XX(Z2)
|
||||
#define Z2_MICROSTEPS 128
|
||||
#define Z2_OVERCURRENT 2000
|
||||
#define Z2_STALLCURRENT 1500
|
||||
#define Z2_MAX_VOLTAGE 127
|
||||
#define Z2_CHAIN_POS -1
|
||||
#define Z2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
#if AXIS_IS_L64XX(Z3)
|
||||
#define Z3_MICROSTEPS 128
|
||||
#define Z3_OVERCURRENT 2000
|
||||
#define Z3_STALLCURRENT 1500
|
||||
#define Z3_MAX_VOLTAGE 127
|
||||
#define Z3_CHAIN_POS -1
|
||||
#define Z3_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
#define E0_MICROSTEPS 128
|
||||
#define E0_OVERCURRENT 2000
|
||||
#define E0_STALLCURRENT 1500
|
||||
#define E0_MAX_VOLTAGE 127
|
||||
#define E0_CHAIN_POS -1
|
||||
#define E0_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
#if AXIS_IS_L64XX(E1)
|
||||
#define E1_MICROSTEPS 128
|
||||
#define E1_OVERCURRENT 2000
|
||||
#define E1_STALLCURRENT 1500
|
||||
#define E1_MAX_VOLTAGE 127
|
||||
#define E1_CHAIN_POS -1
|
||||
#define E1_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
#if AXIS_IS_L64XX(E2)
|
||||
#define E2_MICROSTEPS 128
|
||||
#define E2_OVERCURRENT 2000
|
||||
#define E2_STALLCURRENT 1500
|
||||
#define E2_MAX_VOLTAGE 127
|
||||
#define E2_CHAIN_POS -1
|
||||
#define E2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
#if AXIS_IS_L64XX(E3)
|
||||
#define E3_MICROSTEPS 128
|
||||
#define E3_OVERCURRENT 2000
|
||||
#define E3_STALLCURRENT 1500
|
||||
#define E3_MAX_VOLTAGE 127
|
||||
#define E3_CHAIN_POS -1
|
||||
#define E3_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
#if AXIS_IS_L64XX(E4)
|
||||
#define E4_MICROSTEPS 128
|
||||
#define E4_OVERCURRENT 2000
|
||||
#define E4_STALLCURRENT 1500
|
||||
#define E4_MAX_VOLTAGE 127
|
||||
#define E4_CHAIN_POS -1
|
||||
#define E4_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
#if AXIS_IS_L64XX(E5)
|
||||
#define E5_MICROSTEPS 128
|
||||
#define E5_OVERCURRENT 2000
|
||||
#define E5_STALLCURRENT 1500
|
||||
#define E5_MAX_VOLTAGE 127
|
||||
#define E5_CHAIN_POS -1
|
||||
#define E5_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2324,7 +2421,7 @@
|
||||
//#define L6470_STOP_ON_ERROR
|
||||
#endif
|
||||
|
||||
#endif // L6470
|
||||
#endif // HAS_L64XX
|
||||
|
||||
/**
|
||||
* TWI/I2C BUS
|
||||
@@ -2386,6 +2483,20 @@
|
||||
|
||||
// Duration to hold the switch or keep CHDK_PIN high
|
||||
//#define PHOTO_SWITCH_MS 50 // (ms) (M240 D)
|
||||
|
||||
/**
|
||||
* PHOTO_PULSES_US may need adjustment depending on board and camera model.
|
||||
* Pin must be running at 48.4kHz.
|
||||
* Be sure to use a PHOTOGRAPH_PIN which can rise and fall quick enough.
|
||||
* (e.g., MKS SBase temp sensor pin was too slow, so used P1.23 on J8.)
|
||||
*
|
||||
* Example pulse data for Nikon: https://bit.ly/2FKD0Aq
|
||||
* IR Wiring: https://git.io/JvJf7
|
||||
*/
|
||||
//#define PHOTO_PULSES_US { 2000, 27850, 400, 1580, 400, 3580, 400 } // (µs) Durations for each 48.4kHz oscillation
|
||||
#ifdef PHOTO_PULSES_US
|
||||
#define PHOTO_PULSE_DELAY_US 13 // (µs) Approximate duration of each HIGH and LOW pulse in the oscillation
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2725,7 +2836,11 @@
|
||||
#define JOY_Z_PIN 12 // RAMPS: Suggested pin A12 on AUX2
|
||||
#define JOY_EN_PIN 44 // RAMPS: Suggested pin D44 on AUX2
|
||||
|
||||
// Use M119 to find reasonable values after connecting your hardware:
|
||||
//#define INVERT_JOY_X // Enable if X direction is reversed
|
||||
//#define INVERT_JOY_Y // Enable if Y direction is reversed
|
||||
//#define INVERT_JOY_Z // Enable if Z direction is reversed
|
||||
|
||||
// Use M119 with JOYSTICK_DEBUG to find reasonable values after connecting:
|
||||
#define JOY_X_LIMITS { 5600, 8190-100, 8190+100, 10800 } // min, deadzone start, deadzone end, max
|
||||
#define JOY_Y_LIMITS { 5600, 8250-100, 8250+100, 11000 }
|
||||
#define JOY_Z_LIMITS { 4800, 8080-100, 8080+100, 11550 }
|
||||
@@ -2780,12 +2895,15 @@
|
||||
/**
|
||||
* WiFi Support (Espressif ESP32 WiFi)
|
||||
*/
|
||||
//#define WIFISUPPORT
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
//#define WIFISUPPORT // Marlin embedded WiFi managenent
|
||||
//#define ESP3D_WIFISUPPORT // ESP3D Library WiFi management (https://github.com/luc-github/ESP3DLib)
|
||||
|
||||
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||
#define WIFI_SSID "Wifi SSID"
|
||||
#define WIFI_PWD "Wifi Password"
|
||||
//#define WEBSUPPORT // Start a webserver with auto-discovery
|
||||
//#define OTASUPPORT // Support over-the-air firmware updates
|
||||
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery)
|
||||
//#define OTASUPPORT // Support over-the-air firmware updates
|
||||
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -109,6 +109,19 @@ typedef int8_t pin_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#endif
|
||||
#define DGUS_SERIAL internalDgusSerial
|
||||
|
||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
// ------------------------
|
||||
@@ -345,9 +358,9 @@ void TIMER0_COMPB_vect_bottom()
|
||||
|
||||
// ADC
|
||||
#ifdef DIDR2
|
||||
#define HAL_ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin & 0x07); }while(0)
|
||||
#define HAL_ANALOG_SELECT(ind) do{ if (ind < 8) SBI(DIDR0, ind); else SBI(DIDR2, ind & 0x07); }while(0)
|
||||
#else
|
||||
#define HAL_ANALOG_SELECT(pin) do{ SBI(DIDR0, pin); }while(0)
|
||||
#define HAL_ANALOG_SELECT(ind) SBI(DIDR0, ind);
|
||||
#endif
|
||||
|
||||
inline void HAL_adc_init() {
|
||||
@@ -358,11 +371,11 @@ inline void HAL_adc_init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#define SET_ADMUX_ADCSRA(pin) ADMUX = _BV(REFS0) | (pin & 0x07); SBI(ADCSRA, ADSC)
|
||||
#define SET_ADMUX_ADCSRA(ch) ADMUX = _BV(REFS0) | (ch & 0x07); SBI(ADCSRA, ADSC)
|
||||
#ifdef MUX5
|
||||
#define HAL_START_ADC(pin) if (pin > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
|
||||
#define HAL_START_ADC(ch) if (ch > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
|
||||
#else
|
||||
#define HAL_START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
|
||||
#define HAL_START_ADC(ch) ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
|
||||
#endif
|
||||
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
|
||||
@@ -757,6 +757,33 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
|
||||
template<typename Cfg>
|
||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||
h = tx_buffer.head; // next pos for queue.
|
||||
int ret = t - h - 1;
|
||||
if (ret < 0) ret += Cfg::TX_SIZE + 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_RX_vect)) {
|
||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
|
||||
}
|
||||
|
||||
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_UDRE_vect)) {
|
||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||
}
|
||||
|
||||
// Preinstantiate
|
||||
template class MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>;
|
||||
|
||||
// Instantiate
|
||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
|
||||
|
||||
#endif
|
||||
|
||||
// For AT90USB targets use the UART for BT interfacing
|
||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||
HardwareSerial bluetoothSerial;
|
||||
|
||||
@@ -217,6 +217,9 @@
|
||||
static ring_buffer_pos_t available();
|
||||
static void write(const uint8_t c);
|
||||
static void flushTX();
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
static ring_buffer_pos_t get_tx_buffer_free();
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
||||
@@ -292,6 +295,23 @@
|
||||
extern MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
template <uint8_t serial>
|
||||
struct MarlinInternalSerialCfg {
|
||||
static constexpr int PORT = serial;
|
||||
static constexpr unsigned int RX_SIZE = 128;
|
||||
static constexpr unsigned int TX_SIZE = 48;
|
||||
static constexpr bool XONOFF = false;
|
||||
static constexpr bool EMERGENCYPARSER = false;
|
||||
static constexpr bool DROPPED_RX = false;
|
||||
static constexpr bool RX_OVERRUNS = bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS;
|
||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
||||
static constexpr bool MAX_RX_QUEUED = false;
|
||||
};
|
||||
|
||||
extern MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
|
||||
#endif
|
||||
|
||||
// Use the UART for Bluetooth in AT90USB configurations
|
||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||
extern HardwareSerial bluetoothSerial;
|
||||
|
||||
@@ -234,8 +234,7 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin");
|
||||
void com_print(uint8_t N, uint8_t Z) {
|
||||
const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
|
||||
SERIAL_ECHOPGM(" COM");
|
||||
SERIAL_CHAR('0' + N);
|
||||
SERIAL_CHAR('A' + Z);
|
||||
SERIAL_CHAR('0' + N, 'A' + Z);
|
||||
SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
|
||||
}
|
||||
|
||||
@@ -247,8 +246,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
|
||||
if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
|
||||
|
||||
SERIAL_ECHOPGM(" TIMER");
|
||||
SERIAL_CHAR(T + '0');
|
||||
SERIAL_CHAR(L);
|
||||
SERIAL_CHAR(T + '0', L);
|
||||
SERIAL_ECHO_SP(3);
|
||||
|
||||
if (N == 3) {
|
||||
|
||||
@@ -94,8 +94,8 @@ int freeMemory() {
|
||||
// ADC
|
||||
// ------------------------
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
HAL_adc_result = analogRead(adc_pin);
|
||||
void HAL_adc_start_conversion(const uint8_t ch) {
|
||||
HAL_adc_result = analogRead(ch);
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result() {
|
||||
|
||||
@@ -74,6 +74,27 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL internalDgusSerial
|
||||
#elif DGUS_SERIAL_PORT == 0
|
||||
#define DGUS_SERIAL Serial
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL Serial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL Serial3
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include "MarlinSerial.h"
|
||||
#include "MarlinSerialUSB.h"
|
||||
|
||||
@@ -127,16 +148,16 @@ extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
||||
#endif
|
||||
|
||||
#define HAL_ANALOG_SELECT(pin)
|
||||
#define HAL_ANALOG_SELECT(ch)
|
||||
|
||||
inline void HAL_adc_init() {}//todo
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_START_ADC(ch) HAL_adc_start_conversion(ch)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
void HAL_adc_start_conversion(const uint8_t ch);
|
||||
uint16_t HAL_adc_get_result();
|
||||
|
||||
//
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
}
|
||||
|
||||
// all the others
|
||||
static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4uS => 125khz
|
||||
static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4µs => 125khz
|
||||
|
||||
static uint8_t spiTransferX(uint8_t b) { // using Mode 0
|
||||
int bits = 8;
|
||||
|
||||
@@ -1479,7 +1479,7 @@ static void udd_ctrl_in_sent(void)
|
||||
// The IN data don't must be written in endpoint 0 DPRAM during
|
||||
// a next setup reception in same endpoint 0 DPRAM.
|
||||
// Thereby, an OUT ZLP reception must check before IN data write
|
||||
// and if no OUT ZLP is recevied the data must be written quickly (800us)
|
||||
// and if no OUT ZLP is received the data must be written quickly (800µs)
|
||||
// before an eventually ZLP OUT and SETUP reception
|
||||
flags = cpu_irq_save();
|
||||
if (Is_udd_out_received(0)) {
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#include "spiffs.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include "wifi.h"
|
||||
@@ -41,6 +37,7 @@
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#include "spiffs.h"
|
||||
#include "web.h"
|
||||
#endif
|
||||
#endif
|
||||
@@ -78,21 +75,32 @@ volatile int numPWMUsed = 0,
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
void HAL_init() {
|
||||
i2s_init();
|
||||
}
|
||||
#if ENABLED(WIFI_CUSTOM_COMMAND)
|
||||
|
||||
bool wifi_custom_command(char * const command_ptr) {
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
return esp3dlib.parse(command_ptr);
|
||||
#else
|
||||
UNUSED(command_ptr);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void HAL_init() { i2s_init(); }
|
||||
|
||||
void HAL_init_board() {
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
spiffs_init();
|
||||
#endif
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
esp3dlib.init();
|
||||
#elif ENABLED(WIFISUPPORT)
|
||||
wifi_init();
|
||||
#if ENABLED(OTASUPPORT)
|
||||
OTA_init();
|
||||
#endif
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
spiffs_init();
|
||||
web_init();
|
||||
#endif
|
||||
server.begin();
|
||||
@@ -100,7 +108,7 @@ void HAL_init_board() {
|
||||
}
|
||||
|
||||
void HAL_idletask() {
|
||||
#if ENABLED(OTASUPPORT)
|
||||
#if BOTH(WIFISUPPORT, OTASUPPORT)
|
||||
OTA_handle();
|
||||
#endif
|
||||
}
|
||||
@@ -183,7 +191,7 @@ void HAL_adc_init() {
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_adc_start_conversion(uint8_t adc_pin) {
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
const adc1_channel_t chan = get_channel(adc_pin);
|
||||
uint32_t mv;
|
||||
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
||||
|
||||
@@ -36,7 +36,14 @@
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
#include "WebSocketSerial.h"
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include "WebSocketSerial.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
#include "esp3dlib.h"
|
||||
#endif
|
||||
|
||||
#include "FlushableHardwareSerial.h"
|
||||
|
||||
// ------------------------
|
||||
@@ -47,8 +54,12 @@ extern portMUX_TYPE spinlock;
|
||||
|
||||
#define MYSERIAL0 flushableSerial
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#define MYSERIAL1 webSocketSerial
|
||||
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
#define MYSERIAL1 Serial2Socket
|
||||
#else
|
||||
#define MYSERIAL1 webSocketSerial
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
@@ -60,7 +71,6 @@ extern portMUX_TYPE spinlock;
|
||||
#define ENABLE_ISRS() if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock)
|
||||
#define DISABLE_ISRS() portENTER_CRITICAL(&spinlock)
|
||||
|
||||
|
||||
// Fix bug in pgm_read_ptr
|
||||
#undef pgm_read_ptr
|
||||
#define pgm_read_ptr(addr) (*(addr))
|
||||
@@ -115,7 +125,7 @@ void HAL_adc_init();
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_start_conversion(uint8_t adc_pin);
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
|
||||
#define GET_PIN_MAP_PIN(index) index
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
@@ -127,3 +137,44 @@ void HAL_adc_start_conversion(uint8_t adc_pin);
|
||||
void HAL_idletask();
|
||||
void HAL_init();
|
||||
void HAL_init_board();
|
||||
|
||||
//
|
||||
// Delay in cycles (used by DELAY_NS / DELAY_US)
|
||||
//
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
||||
unsigned long start, ccount, stop;
|
||||
|
||||
/**
|
||||
* It's important to care for race conditions (and overflows) here.
|
||||
* Race condition example: If `stop` calculates to being close to the upper boundary of
|
||||
* `uint32_t` and if at the same time a longer loop interruption kicks in (e.g. due to other
|
||||
* FreeRTOS tasks or interrupts), `ccount` might overflow (and therefore be below `stop` again)
|
||||
* without the loop ever being able to notice that `ccount` had already been above `stop` once
|
||||
* (and that therefore the number of cycles to delay has already passed).
|
||||
* As DELAY_CYCLES (through DELAY_NS / DELAY_US) is used by software SPI bit banging to drive
|
||||
* LCDs and therefore might be called very, very often, this seemingly improbable situation did
|
||||
* actually happen in reality. It resulted in apparently random print pauses of ~17.9 seconds
|
||||
* (0x100000000 / 240 MHz) or multiples thereof, essentially ruining the current print by causing
|
||||
* large blobs of filament.
|
||||
*/
|
||||
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (start) );
|
||||
stop = start + x;
|
||||
ccount = start;
|
||||
|
||||
if (stop >= start) {
|
||||
// no overflow, so only loop while in between start and stop:
|
||||
// 0x00000000 -----------------start****stop-- 0xffffffff
|
||||
while (ccount >= start && ccount < stop) {
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stop did overflow, so only loop while outside of stop and start:
|
||||
// 0x00000000 **stop-------------------start** 0xffffffff
|
||||
while (ccount >= start || ccount < stop) {
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ Servo::Servo() {
|
||||
|
||||
int8_t Servo::attach(const int inPin) {
|
||||
if (channel >= CHANNEL_MAX_NUM) return -1;
|
||||
if (pin > 0) pin = inPin;
|
||||
if (inPin > 0) pin = inPin;
|
||||
|
||||
ledcSetup(channel, 50, 16); // channel X, 50 Hz, 16-bit depth
|
||||
ledcAttachPin(pin, channel);
|
||||
|
||||
@@ -177,7 +177,7 @@ int i2s_init() {
|
||||
*
|
||||
* fwclk = fbclk / 32
|
||||
*
|
||||
* for fwclk = 250kHz (4uS pulse time)
|
||||
* for fwclk = 250kHz (4µS pulse time)
|
||||
* N = 10
|
||||
* M = 20
|
||||
*/
|
||||
|
||||
@@ -32,3 +32,7 @@
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
||||
#if BOTH(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||
#error "Only enable one WiFi option, either WIFISUPPORT or ESP3D_WIFISUPPORT."
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(OTASUPPORT)
|
||||
#if BOTH(WIFISUPPORT, OTASUPPORT)
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <ESPmDNS.h>
|
||||
@@ -67,6 +67,5 @@ void OTA_handle() {
|
||||
ArduinoOTA.handle();
|
||||
}
|
||||
|
||||
#endif // OTASUPPORT
|
||||
|
||||
#endif // WIFISUPPORT && OTASUPPORT
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#if BOTH(WIFISUPPORT, WEBSUPPORT)
|
||||
|
||||
#include "../../core/serial.h"
|
||||
|
||||
@@ -40,5 +40,5 @@ void spiffs_init() {
|
||||
SERIAL_ERROR_MSG("SPIFFS mount failed");
|
||||
}
|
||||
|
||||
#endif // WEBSUPPORT
|
||||
#endif // WIFISUPPORT && WEBSUPPORT
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef uint64_t hal_timer_t;
|
||||
|
||||
#if ENABLED(I2S_STEPPER_STREAM)
|
||||
#define STEPPER_TIMER_PRESCALE 1
|
||||
#define STEPPER_TIMER_RATE 250000 // 250khz, 4us pulses of i2s word clock
|
||||
#define STEPPER_TIMER_RATE 250000 // 250khz, 4µs pulses of i2s word clock
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25
|
||||
#else
|
||||
#define STEPPER_TIMER_PRESCALE 40
|
||||
|
||||
@@ -22,13 +22,12 @@
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include <SPIFFS.h>
|
||||
#undef DISABLED // esp32-hal-gpio.h
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#if BOTH(WIFISUPPORT, WEBSUPPORT)
|
||||
|
||||
#undef DISABLED // esp32-hal-gpio.h
|
||||
#include <SPIFFS.h>
|
||||
#include "wifi.h"
|
||||
|
||||
AsyncEventSource events("/events"); // event source (Server-Sent events)
|
||||
@@ -43,5 +42,5 @@ void web_init() {
|
||||
server.onNotFound(onNotFound);
|
||||
}
|
||||
|
||||
#endif // WEBSUPPORT
|
||||
#endif // WIFISUPPORT && WEBSUPPORT
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
||||
@@ -55,7 +55,7 @@ void HAL_adc_init() {
|
||||
|
||||
}
|
||||
|
||||
void HAL_adc_enable_channel(int ch) {
|
||||
void HAL_adc_enable_channel(const uint8_t ch) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -87,15 +87,15 @@ int freeMemory();
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// ADC
|
||||
#define HAL_ANALOG_SELECT(pin) HAL_adc_enable_channel(pin)
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
#define HAL_ANALOG_SELECT(ch) HAL_adc_enable_channel(ch)
|
||||
#define HAL_START_ADC(ch) HAL_adc_start_conversion(ch)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_init();
|
||||
void HAL_adc_enable_channel(int pin);
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
void HAL_adc_enable_channel(const uint8_t ch);
|
||||
void HAL_adc_start_conversion(const uint8_t ch);
|
||||
uint16_t HAL_adc_get_result();
|
||||
|
||||
// Reset source
|
||||
|
||||
@@ -96,6 +96,26 @@ extern "C" volatile uint32_t _millis;
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL UsbSerial
|
||||
#elif DGUS_SERIAL_PORT == 0
|
||||
#define DGUS_SERIAL MSerial
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL MSerial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL MSerial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL MSerial3
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Interrupts
|
||||
//
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
*
|
||||
* These are based on the LPC1768 routines.
|
||||
*
|
||||
* Couldn't just call exact copies because the overhead resulted in the
|
||||
* one microsecond delay being about 4uS.
|
||||
* Couldn't just call exact copies because the overhead
|
||||
* results in a one microsecond delay taking about 4µS.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -9,7 +9,9 @@ target_filename = "FIRMWARE.CUR"
|
||||
target_drive = "REARM"
|
||||
|
||||
import os
|
||||
import getpass
|
||||
import platform
|
||||
|
||||
current_OS = platform.system()
|
||||
Import("env")
|
||||
|
||||
@@ -77,28 +79,26 @@ try:
|
||||
upload_disk = 'Disk not found'
|
||||
target_file_found = False
|
||||
target_drive_found = False
|
||||
medias = os.listdir('/media') #
|
||||
for media in medias:
|
||||
drives = os.listdir('/media/' + media) #
|
||||
if target_drive in drives and target_file_found == False: # set upload if not found target file yet
|
||||
target_drive_found = True
|
||||
upload_disk = '/media/' + media + '/' + target_drive + '/'
|
||||
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
|
||||
if target_drive in drives: # If target drive is found, use it.
|
||||
target_drive_found = True
|
||||
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
|
||||
else:
|
||||
for drive in drives:
|
||||
try:
|
||||
files = os.listdir('/media/' + media + '/' + drive)
|
||||
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
|
||||
except:
|
||||
continue
|
||||
else:
|
||||
if target_filename in files:
|
||||
if target_file_found == False:
|
||||
upload_disk = '/media/' + media + '/' + drive + '/'
|
||||
target_file_found = True
|
||||
|
||||
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
|
||||
target_file_found = True
|
||||
break
|
||||
#
|
||||
# set upload_port to drive if found
|
||||
#
|
||||
|
||||
if target_file_found == True or target_drive_found == True:
|
||||
if target_file_found or target_drive_found:
|
||||
env.Replace(
|
||||
UPLOAD_FLAGS="-P$UPLOAD_PORT",
|
||||
UPLOAD_PORT=upload_disk
|
||||
|
||||
@@ -426,7 +426,7 @@ void HAL_adc_init() {
|
||||
memset(HAL_adc_results, 0xFF, sizeof(HAL_adc_results)); // Fill result with invalid values
|
||||
|
||||
for (uint8_t pi = 0; pi < COUNT(adc_pins); ++pi)
|
||||
pinPeripheral(adc_pins[pi], PIO_ANALOG);
|
||||
pinPeripheral(adc_pins[pi], PIO_ANALOG);
|
||||
|
||||
for (uint8_t ai = FIRST_ADC; ai <= LAST_ADC; ++ai) {
|
||||
Adc* adc = ((Adc*[])ADC_INSTS)[ai];
|
||||
@@ -471,8 +471,4 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
HAL_adc_result = 0xFFFF;
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result() {
|
||||
return HAL_adc_result;
|
||||
}
|
||||
|
||||
#endif // __SAMD51__
|
||||
|
||||
@@ -71,6 +71,26 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL Serial
|
||||
#elif DGUS_SERIAL_PORT == 0
|
||||
#define DGUS_SERIAL Serial1
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL Serial2
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial3
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial4
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // ADAFRUIT_GRAND_CENTRAL_M4
|
||||
|
||||
typedef int8_t pin_t;
|
||||
@@ -115,7 +135,7 @@ void HAL_adc_init();
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
uint16_t HAL_adc_get_result();
|
||||
inline uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
||||
|
||||
//
|
||||
// Pin Map
|
||||
|
||||
@@ -95,11 +95,27 @@ void HAL_init() {
|
||||
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||
|
||||
uint8_t HAL_get_reset_source() {
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) return RST_EXTERNAL;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) return RST_POWER_ON;
|
||||
return 0;
|
||||
return
|
||||
#ifdef RCC_FLAG_IWDGRST // Some sources may not exist...
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) ? RST_WATCHDOG :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_IWDG1RST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST) ? RST_WATCHDOG :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_IWDG2RST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_IWDG2RST) ? RST_WATCHDOG :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_SFTRST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) ? RST_SOFTWARE :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_PINRST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) ? RST_EXTERNAL :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_PORRST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) ? RST_POWER_ON :
|
||||
#endif
|
||||
0
|
||||
;
|
||||
}
|
||||
|
||||
void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
@@ -90,6 +90,34 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
#if DGUS_SERIAL_PORT == 0
|
||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL SerialUSB
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL Serial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL Serial3
|
||||
#elif DGUS_SERIAL_PORT == 4
|
||||
#define DGUS_SERIAL Serial4
|
||||
#elif DGUS_SERIAL_PORT == 5
|
||||
#define DGUS_SERIAL Serial5
|
||||
#elif DGUS_SERIAL_PORT == 6
|
||||
#define DGUS_SERIAL Serial6
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
|
||||
#endif
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,121 +37,193 @@ static SPISettings spiConfig;
|
||||
// ------------------------
|
||||
|
||||
#if ENABLED(SOFTWARE_SPI)
|
||||
|
||||
// ------------------------
|
||||
// Software SPI
|
||||
// ------------------------
|
||||
#error "Software SPI not supported for STM32. Use Hardware SPI."
|
||||
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
void spiBegin(void) {
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SCK_PIN, HIGH);
|
||||
SET_INPUT(MISO_PIN);
|
||||
OUT_WRITE(MOSI_PIN, HIGH);
|
||||
}
|
||||
|
||||
static uint16_t delay_STM32_soft_spi;
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: delay_STM32_soft_spi = 125; break; // desired: 8,000,000 actual: ~1.1M
|
||||
case SPI_HALF_SPEED: delay_STM32_soft_spi = 125; break; // desired: 4,000,000 actual: ~1.1M
|
||||
case SPI_QUARTER_SPEED:delay_STM32_soft_spi = 250; break; // desired: 2,000,000 actual: ~890K
|
||||
case SPI_EIGHTH_SPEED: delay_STM32_soft_spi = 500; break; // desired: 1,000,000 actual: ~590K
|
||||
case SPI_SPEED_5: delay_STM32_soft_spi = 1000; break; // desired: 500,000 actual: ~360K
|
||||
case SPI_SPEED_6: delay_STM32_soft_spi = 2000; break; // desired: 250,000 actual: ~210K
|
||||
default: delay_STM32_soft_spi = 4000; break; // desired: 125,000 actual: ~123K
|
||||
}
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
// Begin SPI transaction, set clock, bit order, data mode
|
||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { /* do nothing */ }
|
||||
|
||||
uint8_t HAL_SPI_STM32_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(MOSI_PIN, b & 0x80);
|
||||
|
||||
DELAY_NS(delay_STM32_soft_spi);
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
DELAY_NS(delay_STM32_soft_spi);
|
||||
|
||||
b <<= 1; // little setup time
|
||||
b |= (READ(MISO_PIN) != 0);
|
||||
}
|
||||
DELAY_NS(125);
|
||||
return b;
|
||||
}
|
||||
|
||||
// Soft SPI receive byte
|
||||
uint8_t spiRec() {
|
||||
DISABLE_ISRS(); // No interrupts during byte receive
|
||||
const uint8_t data = HAL_SPI_STM32_SpiTransfer_Mode_3(0xFF);
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
return data;
|
||||
}
|
||||
|
||||
// Soft SPI read data
|
||||
void spiRead(uint8_t *buf, uint16_t nbyte) {
|
||||
for (uint16_t i = 0; i < nbyte; i++)
|
||||
buf[i] = spiRec();
|
||||
}
|
||||
|
||||
// Soft SPI send byte
|
||||
void spiSend(uint8_t data) {
|
||||
DISABLE_ISRS(); // No interrupts during byte send
|
||||
HAL_SPI_STM32_SpiTransfer_Mode_3(data); // Don't care what is received
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
}
|
||||
|
||||
// Soft SPI send block
|
||||
void spiSendBlock(uint8_t token, const uint8_t *buf) {
|
||||
spiSend(token);
|
||||
for (uint16_t i = 0; i < 512; i++)
|
||||
spiSend(buf[i]);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// ------------------------
|
||||
// Hardware SPI
|
||||
// ------------------------
|
||||
// ------------------------
|
||||
// Hardware SPI
|
||||
// ------------------------
|
||||
|
||||
/**
|
||||
* VGPV SPI speed start and PCLK2/2, by default 108/2 = 54Mhz
|
||||
*/
|
||||
/**
|
||||
* VGPV SPI speed start and PCLK2/2, by default 108/2 = 54Mhz
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Begin SPI port setup
|
||||
*
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
/**
|
||||
* @brief Begin SPI port setup
|
||||
*
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
/** Configure SPI for specified SPI speed */
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 300000; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI library
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
|
||||
#if ENABLED(CUSTOM_SPI_PINS)
|
||||
SPI.setMISO(MISO_PIN);
|
||||
SPI.setMOSI(MOSI_PIN);
|
||||
SPI.setSCLK(SCK_PIN);
|
||||
SPI.setSSEL(SS_PIN);
|
||||
#endif
|
||||
// Configure SPI for specified SPI speed
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 300000; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI library
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
|
||||
SPI.begin();
|
||||
}
|
||||
#if ENABLED(CUSTOM_SPI_PINS)
|
||||
SPI.setMISO(MISO_PIN);
|
||||
SPI.setMOSI(MOSI_PIN);
|
||||
SPI.setSCLK(SCK_PIN);
|
||||
SPI.setSSEL(SS_PIN);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Receives a single byte from the SPI port.
|
||||
*
|
||||
* @return Byte received
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
uint8_t spiRec() {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
SPI.endTransaction();
|
||||
return returnByte;
|
||||
}
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receives a number of bytes from the SPI port to a buffer
|
||||
*
|
||||
* @param buf Pointer to starting address of buffer to write to.
|
||||
* @param nbyte Number of bytes to receive.
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Uses DMA
|
||||
*/
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
if (nbyte == 0) return;
|
||||
memset(buf, 0xFF, nbyte);
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(buf, nbyte);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
/**
|
||||
* @brief Receives a single byte from the SPI port.
|
||||
*
|
||||
* @return Byte received
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
uint8_t spiRec() {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
SPI.endTransaction();
|
||||
return returnByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sends a single byte on SPI port
|
||||
*
|
||||
* @param b Byte to send
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
void spiSend(uint8_t b) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(b);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
/**
|
||||
* @brief Receive a number of bytes from the SPI port to a buffer
|
||||
*
|
||||
* @param buf Pointer to starting address of buffer to write to.
|
||||
* @param nbyte Number of bytes to receive.
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Uses DMA
|
||||
*/
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
if (nbyte == 0) return;
|
||||
memset(buf, 0xFF, nbyte);
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(buf, nbyte);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write token and then write from 512 byte buffer to SPI (for SD card)
|
||||
*
|
||||
* @param buf Pointer with buffer start address
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Use DMA
|
||||
*/
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
uint8_t rxBuf[512];
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(token);
|
||||
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
/**
|
||||
* @brief Send a single byte on SPI port
|
||||
*
|
||||
* @param b Byte to send
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
void spiSend(uint8_t b) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(b);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write token and then write from 512 byte buffer to SPI (for SD card)
|
||||
*
|
||||
* @param buf Pointer with buffer start address
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Use DMA
|
||||
*/
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
uint8_t rxBuf[512];
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(token);
|
||||
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
#endif // SOFTWARE_SPI
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#define hal_timer_t uint32_t
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF // Timers can be 16 or 32 bit
|
||||
|
||||
|
||||
#ifdef STM32F0xx
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU) // frequency of timer peripherals
|
||||
@@ -62,12 +61,14 @@
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
|
||||
|
||||
// STM32F401 only has timers 1-5 & 9-11 with timers 4 & 5 usually assigned to TIMER_SERVO and TIMER_TONE
|
||||
|
||||
#ifndef STEP_TIMER
|
||||
#define STEP_TIMER 5
|
||||
#define STEP_TIMER 9
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER
|
||||
#define TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
|
||||
#define TEMP_TIMER 10
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -121,6 +121,31 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL
|
||||
#if DGUS_SERIAL_PORT == 0
|
||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL UsbSerial
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL MSerial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL MSerial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL MSerial3
|
||||
#elif DGUS_SERIAL_PORT == 4
|
||||
#define DGUS_SERIAL MSerial4
|
||||
#elif DGUS_SERIAL_PORT == 5
|
||||
#define DGUS_SERIAL MSerial5
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 5. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Set interrupt grouping for this MCU
|
||||
void HAL_init();
|
||||
#define HAL_IDLETASK 1
|
||||
|
||||
@@ -94,6 +94,32 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if defined(STM32F4) && DGUS_SERIAL_PORT == 0
|
||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL SerialUSB
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL SerialUART1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL SerialUART2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL SerialUART3
|
||||
#elif DGUS_SERIAL_PORT == 4
|
||||
#define DGUS_SERIAL SerialUART4
|
||||
#elif DGUS_SERIAL_PORT == 5
|
||||
#define DGUS_SERIAL SerialUART5
|
||||
#elif DGUS_SERIAL_PORT == 6
|
||||
#define DGUS_SERIAL SerialUART6
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TODO: review this to return 1 for pins that are not analog input
|
||||
*/
|
||||
|
||||
@@ -94,7 +94,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
uint16_t pin = pin2sc1a[adc_pin];
|
||||
const uint16_t pin = pin2sc1a[adc_pin];
|
||||
if (pin == 0xFF) {
|
||||
// Digital only
|
||||
HAL_adc_select = -1;
|
||||
|
||||
@@ -145,21 +145,7 @@
|
||||
}
|
||||
#undef nop
|
||||
|
||||
#elif defined(ESP32)
|
||||
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
||||
unsigned long ccount, stop;
|
||||
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
|
||||
stop = ccount + x; // This can overflow
|
||||
|
||||
while (ccount < stop) { // This doesn't deal with overflows
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__PLAT_LINUX__)
|
||||
#elif defined(__PLAT_LINUX__) || defined(ESP32)
|
||||
|
||||
// specified inside platform
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
|
||||
#include "Delay.h"
|
||||
|
||||
#include "../../core/serial.h"
|
||||
#include "../../libs/L6470/L6470_Marlin.h"
|
||||
#include "../../libs/L64XX/L64XX_Marlin.h"
|
||||
|
||||
// Make sure GCC optimizes this file.
|
||||
// Note that this line triggers a bug in GCC which is fixed by casting.
|
||||
@@ -40,7 +40,7 @@
|
||||
#pragma GCC optimize (3)
|
||||
|
||||
// run at ~4Mhz
|
||||
uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
|
||||
inline uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80);
|
||||
b <<= 1; // little setup time
|
||||
@@ -56,61 +56,26 @@ uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
|
||||
return b;
|
||||
}
|
||||
|
||||
uint8_t L6470_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
inline uint8_t L6470_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(L6470_CHAIN_SCK_PIN, LOW);
|
||||
WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80);
|
||||
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
|
||||
WRITE(L6470_CHAIN_SCK_PIN, HIGH);
|
||||
DELAY_NS(125); // Need more delay for fast CPUs
|
||||
|
||||
b <<= 1; // little setup time
|
||||
b |= (READ(L6470_CHAIN_MISO_PIN) != 0);
|
||||
}
|
||||
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following are weak-linked and defined as do-nothing
|
||||
* functions by the L6470-Arduino library. They must be
|
||||
* defined by the client (Marlin) to provide an SPI interface.
|
||||
* L64XX methods for SPI init and transfer
|
||||
*/
|
||||
|
||||
uint8_t L6470_transfer(uint8_t data, int16_t ss_pin, const uint8_t chain_position) {
|
||||
uint8_t data_out = 0;
|
||||
|
||||
// first device in chain has data sent last
|
||||
extDigitalWrite(ss_pin, LOW);
|
||||
|
||||
for (uint8_t i = L6470::chain[0]; (i >= 1) && !spi_abort; i--) { // stop sending data if spi_abort is active
|
||||
DISABLE_ISRS(); // disable interrupts during SPI transfer (can't allow partial command to chips)
|
||||
uint8_t temp = L6470_SpiTransfer_Mode_3(uint8_t(i == chain_position ? data : dSPIN_NOP));
|
||||
ENABLE_ISRS(); // enable interrupts
|
||||
if (i == chain_position) data_out = temp;
|
||||
}
|
||||
|
||||
extDigitalWrite(ss_pin, HIGH);
|
||||
return data_out;
|
||||
}
|
||||
|
||||
void L6470_transfer(uint8_t L6470_buf[], const uint8_t length) {
|
||||
// first device in chain has data sent last
|
||||
|
||||
if (spi_active) { // interrupted SPI transfer so need to
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH); // guarantee min high of 650nS
|
||||
DELAY_US(1);
|
||||
}
|
||||
|
||||
WRITE(L6470_CHAIN_SS_PIN, LOW);
|
||||
for (uint8_t i = length; i >= 1; i--)
|
||||
L6470_SpiTransfer_Mode_3(uint8_t(L6470_buf[i]));
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
void L6470_spi_init() {
|
||||
void L64XX_Marlin::spi_init() {
|
||||
OUT_WRITE(L6470_CHAIN_SS_PIN, HIGH);
|
||||
OUT_WRITE(L6470_CHAIN_SCK_PIN, HIGH);
|
||||
OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH);
|
||||
@@ -123,6 +88,52 @@ void L6470_spi_init() {
|
||||
OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH);
|
||||
}
|
||||
|
||||
uint8_t L64XX_Marlin::transfer_single(uint8_t data, int16_t ss_pin) {
|
||||
// First device in chain has data sent last
|
||||
extDigitalWrite(ss_pin, LOW);
|
||||
|
||||
DISABLE_ISRS(); // Disable interrupts during SPI transfer (can't allow partial command to chips)
|
||||
const uint8_t data_out = L6470_SpiTransfer_Mode_3(data);
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
|
||||
extDigitalWrite(ss_pin, HIGH);
|
||||
return data_out;
|
||||
}
|
||||
|
||||
uint8_t L64XX_Marlin::transfer_chain(uint8_t data, int16_t ss_pin, uint8_t chain_position) {
|
||||
uint8_t data_out = 0;
|
||||
|
||||
// first device in chain has data sent last
|
||||
extDigitalWrite(ss_pin, LOW);
|
||||
|
||||
for (uint8_t i = L64XX::chain[0]; !L64xxManager.spi_abort && i >= 1; i--) { // Send data unless aborted
|
||||
DISABLE_ISRS(); // Disable interrupts during SPI transfer (can't allow partial command to chips)
|
||||
const uint8_t temp = L6470_SpiTransfer_Mode_3(uint8_t(i == chain_position ? data : dSPIN_NOP));
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
if (i == chain_position) data_out = temp;
|
||||
}
|
||||
|
||||
extDigitalWrite(ss_pin, HIGH);
|
||||
return data_out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Platform-supplied L6470 buffer transfer method
|
||||
*/
|
||||
void L64XX_Marlin::transfer(uint8_t L6470_buf[], const uint8_t length) {
|
||||
// First device in chain has its data sent last
|
||||
|
||||
if (spi_active) { // Interrupted SPI transfer so need to
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH); // guarantee min high of 650ns
|
||||
DELAY_US(1);
|
||||
}
|
||||
|
||||
WRITE(L6470_CHAIN_SS_PIN, LOW);
|
||||
for (uint8_t i = length; i >= 1; i--)
|
||||
L6470_SpiTransfer_Mode_3(uint8_t(L6470_buf[i]));
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
#pragma GCC reset_options
|
||||
|
||||
#endif // HAS_DRIVER(L6470)
|
||||
#endif // HAS_L64XX
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
constexpr bool
|
||||
#if HAS_DGUS_LCD
|
||||
bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS = (false
|
||||
#if ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
|| true
|
||||
#endif
|
||||
),
|
||||
#endif
|
||||
bSERIAL_XON_XOFF = (false
|
||||
#if ENABLED(SERIAL_XON_XOFF)
|
||||
|| true
|
||||
|
||||
@@ -35,7 +35,7 @@ static bool UnwReportOut(void* ctx, const UnwReport* bte) {
|
||||
|
||||
(*p)++;
|
||||
|
||||
SERIAL_CHAR('#'); SERIAL_PRINT(*p,DEC); SERIAL_ECHOPGM(" : ");
|
||||
SERIAL_CHAR('#'); SERIAL_PRINT(*p, DEC); SERIAL_ECHOPGM(" : ");
|
||||
SERIAL_ECHOPGM(bte->name ? bte->name : "unknown"); SERIAL_ECHOPGM("@0x"); SERIAL_PRINT(bte->function, HEX);
|
||||
SERIAL_CHAR('+'); SERIAL_PRINT(bte->address - bte->function,DEC);
|
||||
SERIAL_ECHOPGM(" PC:"); SERIAL_PRINT(bte->address,HEX); SERIAL_CHAR('\n');
|
||||
|
||||
@@ -177,8 +177,8 @@
|
||||
#include "feature/prusa_MMU2/mmu2.h"
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#include "libs/L6470/L6470_Marlin.h"
|
||||
#if HAS_L64XX
|
||||
#include "libs/L64XX/L64XX_Marlin.h"
|
||||
#endif
|
||||
|
||||
const char NUL_STR[] PROGMEM = "",
|
||||
@@ -406,7 +406,7 @@ void startOrResumeJob() {
|
||||
thermalManager.zero_fan_speeds();
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
recovery.purge();
|
||||
#endif
|
||||
#ifdef EVENT_GCODE_SD_STOP
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
@@ -605,7 +605,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
|
||||
L6470.monitor_driver();
|
||||
L64xxManager.monitor_driver();
|
||||
#endif
|
||||
|
||||
// Limit check_axes_activity frequency to 10Hz
|
||||
@@ -618,7 +618,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#if PIN_EXISTS(FET_SAFETY)
|
||||
static millis_t FET_next;
|
||||
if (ELAPSED(ms, FET_next)) {
|
||||
FET_next = ms + FET_SAFETY_DELAY; // 2uS pulse every FET_SAFETY_DELAY mS
|
||||
FET_next = ms + FET_SAFETY_DELAY; // 2µs pulse every FET_SAFETY_DELAY mS
|
||||
OUT_WRITE(FET_SAFETY_PIN, !FET_SAFETY_INVERTED);
|
||||
DELAY_US(2);
|
||||
WRITE(FET_SAFETY_PIN, FET_SAFETY_INVERTED);
|
||||
@@ -822,8 +822,8 @@ void setup() {
|
||||
|
||||
HAL_init();
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
L6470.init(); // setup SPI and then init chips
|
||||
#if HAS_L64XX
|
||||
L64xxManager.init(); // Set up SPI, init drivers
|
||||
#endif
|
||||
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
|
||||
+2
-259
@@ -31,8 +31,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#include "libs/L6470/L6470_Marlin.h"
|
||||
#if HAS_L64XX
|
||||
#include "libs/L64XX/L64XX_Marlin.h"
|
||||
extern uint8_t axis_known_position;
|
||||
#endif
|
||||
|
||||
@@ -46,263 +46,6 @@ void idle(
|
||||
|
||||
void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
|
||||
//
|
||||
// X, Y, Z Stepper enable / disable
|
||||
//
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
extern L6470 stepperX;
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() stepperX.free()
|
||||
#elif HAS_X_ENABLE
|
||||
#define X_enable() X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X_disable() X_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
extern L6470 stepperX2;
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() stepperX2.free()
|
||||
#elif HAS_X2_ENABLE
|
||||
#define X2_enable() X2_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X2_disable() X2_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_X() do{ X_enable(); X2_enable(); }while(0)
|
||||
#define disable_X() do{ X_disable(); X2_disable(); CBI(axis_known_position, X_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
extern L6470 stepperY;
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() stepperY.free()
|
||||
#elif HAS_Y_ENABLE
|
||||
#define Y_enable() Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y_disable() Y_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
extern L6470 stepperY2;
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() stepperY2.free()
|
||||
#elif HAS_Y2_ENABLE
|
||||
#define Y2_enable() Y2_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y2_disable() Y2_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Y() do{ Y_enable(); Y2_enable(); }while(0)
|
||||
#define disable_Y() do{ Y_disable(); Y2_disable(); CBI(axis_known_position, Y_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
extern L6470 stepperZ;
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() stepperZ.free()
|
||||
#elif HAS_Z_ENABLE
|
||||
#define Z_enable() Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z_disable() Z_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
extern L6470 stepperZ2;
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() stepperZ2.free()
|
||||
#elif HAS_Z2_ENABLE
|
||||
#define Z2_enable() Z2_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z2_disable() Z2_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
extern L6470 stepperZ3;
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() stepperZ3.free()
|
||||
#elif HAS_Z3_ENABLE
|
||||
#define Z3_enable() Z3_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z3_disable() Z3_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)
|
||||
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
|
||||
|
||||
//
|
||||
// Extruder Stepper enable / disable
|
||||
//
|
||||
|
||||
// define the individual enables/disables
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
extern L6470 stepperE0;
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif HAS_E0_ENABLE
|
||||
#define E0_enable() E0_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E0_disable() E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
extern L6470 stepperE1;
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define E1_enable() E1_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E1_disable() E1_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
extern L6470 stepperE2;
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define E2_enable() E2_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E2_disable() E2_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
extern L6470 stepperE3;
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define E3_enable() E3_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E3_disable() E3_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
extern L6470 stepperE4;
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define E4_enable() E4_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E4_disable() E4_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
extern L6470 stepperE5;
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define E5_enable() E5_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E5_disable() E5_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
||||
/**
|
||||
* Mixing steppers synchronize their enable (and direction) together
|
||||
*/
|
||||
#if MIXING_STEPPERS > 5
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); E5_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); E5_disable(); }
|
||||
#elif MIXING_STEPPERS > 4
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); }
|
||||
#elif MIXING_STEPPERS > 3
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); }
|
||||
#elif MIXING_STEPPERS > 2
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); }
|
||||
#else
|
||||
#define enable_E0() { E0_enable(); E1_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); }
|
||||
#endif
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
|
||||
#else // !MIXING_EXTRUDER
|
||||
|
||||
#if HAS_E0_ENABLE
|
||||
#define enable_E0() E0_enable()
|
||||
#define disable_E0() E0_disable()
|
||||
#else
|
||||
#define enable_E0() NOOP
|
||||
#define disable_E0() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define enable_E1() E1_enable()
|
||||
#define disable_E1() E1_disable()
|
||||
#else
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define enable_E2() E2_enable()
|
||||
#define disable_E2() E2_disable()
|
||||
#else
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define enable_E3() E3_enable()
|
||||
#define disable_E3() E3_disable()
|
||||
#else
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define enable_E4() E4_enable()
|
||||
#define disable_E4() E4_disable()
|
||||
#else
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define enable_E5() E5_enable()
|
||||
#define disable_E5() E5_disable()
|
||||
#else
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
#endif
|
||||
|
||||
#endif // !MIXING_EXTRUDER
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
#include "feature/twibus.h"
|
||||
extern TWIBus i2c;
|
||||
|
||||
+13
-11
@@ -90,17 +90,18 @@
|
||||
#define BOARD_RAMPS_ENDER_4 1134 // Creality: Ender-4, CR-8
|
||||
#define BOARD_RAMPS_CREALITY 1135 // Creality: CR10S, CR20, CR-X
|
||||
#define BOARD_RAMPS_DAGOMA 1136 // Dagoma F5
|
||||
#define BOARD_FYSETC_F6_13 1137 // FYSETC F6
|
||||
#define BOARD_DUPLICATOR_I3_PLUS 1138 // Wanhao Duplicator i3 Plus
|
||||
#define BOARD_VORON 1139 // VORON Design
|
||||
#define BOARD_TRONXY_V3_1_0 1140 // Tronxy TRONXY-V3-1.0
|
||||
#define BOARD_Z_BOLT_X_SERIES 1141 // Z-Bolt X Series
|
||||
#define BOARD_TT_OSCAR 1142 // TT OSCAR
|
||||
#define BOARD_OVERLORD 1143 // Overlord/Overlord Pro
|
||||
#define BOARD_HJC2560C_REV1 1144 // ADIMLab Gantry v1
|
||||
#define BOARD_HJC2560C_REV2 1145 // ADIMLab Gantry v2
|
||||
#define BOARD_TANGO 1146 // BIQU Tango V1
|
||||
#define BOARD_MKS_GEN_L_V2 1147 // MKS GEN L V2
|
||||
#define BOARD_FYSETC_F6_13 1137 // FYSETC F6 1.3
|
||||
#define BOARD_FYSETC_F6_14 1138 // FYSETC F6 1.4
|
||||
#define BOARD_DUPLICATOR_I3_PLUS 1139 // Wanhao Duplicator i3 Plus
|
||||
#define BOARD_VORON 1140 // VORON Design
|
||||
#define BOARD_TRONXY_V3_1_0 1141 // Tronxy TRONXY-V3-1.0
|
||||
#define BOARD_Z_BOLT_X_SERIES 1142 // Z-Bolt X Series
|
||||
#define BOARD_TT_OSCAR 1143 // TT OSCAR
|
||||
#define BOARD_OVERLORD 1144 // Overlord/Overlord Pro
|
||||
#define BOARD_HJC2560C_REV1 1145 // ADIMLab Gantry v1
|
||||
#define BOARD_HJC2560C_REV2 1146 // ADIMLab Gantry v2
|
||||
#define BOARD_TANGO 1147 // BIQU Tango V1
|
||||
#define BOARD_MKS_GEN_L_V2 1148 // MKS GEN L V2
|
||||
|
||||
//
|
||||
// RAMBo and derivatives
|
||||
@@ -138,6 +139,7 @@
|
||||
#define BOARD_GT2560_V3_A20 1318 // Geeetech GT2560 Rev B for A20(M/D)
|
||||
#define BOARD_EINSTART_S 1319 // Einstart retrofit
|
||||
#define BOARD_WANHAO_ONEPLUS 1320 // Wanhao 0ne+ i3 Mini
|
||||
#define BOARD_LEAPFROG_XEED2015 1321 // Leapfrog Xeed 2015
|
||||
|
||||
//
|
||||
// ATmega1281, ATmega2561
|
||||
|
||||
+32
-24
@@ -23,30 +23,33 @@
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#define _A4988 0x001
|
||||
#define _A5984 0x002
|
||||
#define _DRV8825 0x003
|
||||
#define _LV8729 0x004
|
||||
#define _L6470 0x105
|
||||
#define _TB6560 0x006
|
||||
#define _TB6600 0x007
|
||||
#define _TMC2100 0x008
|
||||
#define _TMC2130 2130
|
||||
#define _TMC2130_STANDALONE 0x009
|
||||
#define _TMC2160 2160
|
||||
#define _TMC2160_STANDALONE 2161
|
||||
#define _TMC2208 2208
|
||||
#define _TMC2208_STANDALONE 0x00A
|
||||
#define _TMC2209 2209
|
||||
#define _TMC2209_STANDALONE 0x00D
|
||||
#define _TMC26X 0x10B
|
||||
#define _TMC26X_STANDALONE 0x00B
|
||||
#define _TMC2660 2660
|
||||
#define _TMC2660_STANDALONE 0x00C
|
||||
#define _TMC5130 5130
|
||||
#define _TMC5130_STANDALONE 5131
|
||||
#define _TMC5160 5160
|
||||
#define _TMC5160_STANDALONE 5161
|
||||
#define _A4988 0x4988
|
||||
#define _A5984 0x5984
|
||||
#define _DRV8825 0x8825
|
||||
#define _LV8729 0x8729
|
||||
#define _L6470 0x6470
|
||||
#define _L6474 0x6474
|
||||
#define _L6480 0x6480
|
||||
#define _POWERSTEP01 0xF00D
|
||||
#define _TB6560 0x6560
|
||||
#define _TB6600 0x6600
|
||||
#define _TMC2100 0x2100
|
||||
#define _TMC2130 0x2130A
|
||||
#define _TMC2130_STANDALONE 0x2130B
|
||||
#define _TMC2160 0x2160A
|
||||
#define _TMC2160_STANDALONE 0x2160B
|
||||
#define _TMC2208 0x2208A
|
||||
#define _TMC2208_STANDALONE 0x2208B
|
||||
#define _TMC2209 0x2209A
|
||||
#define _TMC2209_STANDALONE 0x2209B
|
||||
#define _TMC26X 0x2600A
|
||||
#define _TMC26X_STANDALONE 0x2600B
|
||||
#define _TMC2660 0x2660A
|
||||
#define _TMC2660_STANDALONE 0x2660B
|
||||
#define _TMC5130 0x5130A
|
||||
#define _TMC5130_STANDALONE 0x5130B
|
||||
#define _TMC5160 0x5160A
|
||||
#define _TMC5160_STANDALONE 0x5160B
|
||||
|
||||
#define _DRIVER_ID(V) _CAT(_, V)
|
||||
#define _AXIS_DRIVER_TYPE(A,T) (_DRIVER_ID(A##_DRIVER_TYPE) == _CAT(_, T))
|
||||
@@ -156,3 +159,8 @@
|
||||
#define _SDCARD_CUSTOM_CABLE 3
|
||||
#define _SDCARD_ID(V) _CAT(_SDCARD_, V)
|
||||
#define SD_CONNECTION_IS(V) (_SDCARD_ID(SDCARD_CONNECTION) == _SDCARD_ID(V))
|
||||
|
||||
#define HAS_L64XX (HAS_DRIVER(L6470) || HAS_DRIVER(L6474) || HAS_DRIVER(L6480) || HAS_DRIVER(POWERSTEP01))
|
||||
#define HAS_L64XX_NOT_L6474 (HAS_L64XX && !HAS_DRIVER(L6474))
|
||||
|
||||
#define AXIS_IS_L64XX(A) (AXIS_DRIVER_TYPE_##A(L6470) || AXIS_DRIVER_TYPE_##A(L6474) || AXIS_DRIVER_TYPE_##A(L6480) || AXIS_DRIVER_TYPE_##A(POWERSTEP01))
|
||||
|
||||
@@ -58,12 +58,10 @@ void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) :
|
||||
void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
|
||||
void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
|
||||
|
||||
void print_bin(const uint16_t val) {
|
||||
uint16_t mask = 0x8000;
|
||||
void print_bin(uint16_t val) {
|
||||
for (uint8_t i = 16; i--;) {
|
||||
if (i && !(i % 4)) SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR((val & mask) ? '1' : '0');
|
||||
mask >>= 1;
|
||||
SERIAL_CHAR('0' + TEST(val, i));
|
||||
if (!(i & 0x3) && i) SERIAL_CHAR(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ extern uint8_t marlin_debug_flags;
|
||||
#define PORT_REDIRECT(p) _PORT_REDIRECT(1,p)
|
||||
#define PORT_RESTORE() _PORT_RESTORE(1)
|
||||
|
||||
#define SERIAL_CHAR(x) SERIAL_OUT(write, x)
|
||||
#define SERIAL_ECHO(x) SERIAL_OUT(print, x)
|
||||
#define SERIAL_ECHO_F(V...) SERIAL_OUT(print, V)
|
||||
#define SERIAL_ECHOLN(x) SERIAL_OUT(println, x)
|
||||
@@ -83,6 +82,22 @@ extern uint8_t marlin_debug_flags;
|
||||
#define SERIAL_FLUSHTX()
|
||||
#endif
|
||||
|
||||
// Print up to 10 chars from a list
|
||||
#define __CHAR_N(N,V...) _CHAR_##N(V)
|
||||
#define _CHAR_N(N,V...) __CHAR_N(N,V)
|
||||
#define _CHAR_1(c) SERIAL_OUT(write, c)
|
||||
#define _CHAR_2(a,b) do{ _CHAR_1(a); _CHAR_1(b); }while(0)
|
||||
#define _CHAR_3(a,V...) do{ _CHAR_1(a); _CHAR_2(V); }while(0)
|
||||
#define _CHAR_4(a,V...) do{ _CHAR_1(a); _CHAR_3(V); }while(0)
|
||||
#define _CHAR_5(a,V...) do{ _CHAR_1(a); _CHAR_4(V); }while(0)
|
||||
#define _CHAR_6(a,V...) do{ _CHAR_1(a); _CHAR_5(V); }while(0)
|
||||
#define _CHAR_7(a,V...) do{ _CHAR_1(a); _CHAR_6(V); }while(0)
|
||||
#define _CHAR_8(a,V...) do{ _CHAR_1(a); _CHAR_7(V); }while(0)
|
||||
#define _CHAR_9(a,V...) do{ _CHAR_1(a); _CHAR_8(V); }while(0)
|
||||
#define _CHAR_10(a,V...) do{ _CHAR_1(a); _CHAR_9(V); }while(0)
|
||||
|
||||
#define SERIAL_CHAR(V...) _CHAR_N(NUM_ARGS(V),V)
|
||||
|
||||
// Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR().
|
||||
#define __SEP_N(N,V...) _SEP_##N(V)
|
||||
#define _SEP_N(N,V...) __SEP_N(N,V)
|
||||
|
||||
+38
-30
@@ -81,40 +81,49 @@ void safe_delay(millis_t ms) {
|
||||
);
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
|
||||
if (probe_offset.x > 0)
|
||||
SERIAL_ECHOPGM(" (Right");
|
||||
else if (probe_offset.x < 0)
|
||||
SERIAL_ECHOPGM(" (Left");
|
||||
else if (probe_offset.y != 0)
|
||||
SERIAL_ECHOPGM(" (Middle");
|
||||
else
|
||||
SERIAL_ECHOPGM(" (Aligned With");
|
||||
|
||||
if (probe_offset.y > 0) {
|
||||
#if IS_SCARA
|
||||
SERIAL_ECHOPGM("-Distal");
|
||||
#else
|
||||
SERIAL_ECHOPGM("-Back");
|
||||
#endif
|
||||
}
|
||||
else if (probe_offset.y < 0) {
|
||||
#if IS_SCARA
|
||||
SERIAL_ECHOPGM("-Proximal");
|
||||
#else
|
||||
SERIAL_ECHOPGM("-Front");
|
||||
#endif
|
||||
}
|
||||
else if (probe_offset.x != 0)
|
||||
SERIAL_ECHOPGM("-Center");
|
||||
#if !HAS_PROBE_XY_OFFSET
|
||||
SERIAL_ECHOPAIR("Probe Offset X0 Y0 Z", probe_offset.z, " (");
|
||||
#else
|
||||
SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
|
||||
if (probe_offset.x > 0)
|
||||
SERIAL_ECHOPGM(" (Right");
|
||||
else if (probe_offset.x < 0)
|
||||
SERIAL_ECHOPGM(" (Left");
|
||||
else if (probe_offset.y != 0)
|
||||
SERIAL_ECHOPGM(" (Middle");
|
||||
else
|
||||
SERIAL_ECHOPGM(" (Aligned With");
|
||||
|
||||
if (probe_offset.y > 0) {
|
||||
#if IS_SCARA
|
||||
SERIAL_ECHOPGM("-Distal");
|
||||
#else
|
||||
SERIAL_ECHOPGM("-Back");
|
||||
#endif
|
||||
}
|
||||
else if (probe_offset.y < 0) {
|
||||
#if IS_SCARA
|
||||
SERIAL_ECHOPGM("-Proximal");
|
||||
#else
|
||||
SERIAL_ECHOPGM("-Front");
|
||||
#endif
|
||||
}
|
||||
else if (probe_offset.x != 0)
|
||||
SERIAL_ECHOPGM("-Center");
|
||||
|
||||
SERIAL_ECHOPGM(" & ");
|
||||
|
||||
#endif
|
||||
|
||||
if (probe_offset.z < 0)
|
||||
SERIAL_ECHOPGM(" & Below");
|
||||
SERIAL_ECHOPGM("Below");
|
||||
else if (probe_offset.z > 0)
|
||||
SERIAL_ECHOPGM(" & Above");
|
||||
SERIAL_ECHOPGM("Above");
|
||||
else
|
||||
SERIAL_ECHOPGM(" & Same Z as");
|
||||
SERIAL_ECHOPGM("Same Z as");
|
||||
SERIAL_ECHOLNPGM(" Nozzle)");
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_ABL_OR_UBL
|
||||
@@ -139,8 +148,7 @@ void safe_delay(millis_t ms) {
|
||||
SERIAL_ECHOPGM("ABL Adjustment X");
|
||||
LOOP_XYZ(a) {
|
||||
float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR('X' + char(a));
|
||||
SERIAL_CHAR(' ', 'X' + char(a));
|
||||
if (v > 0) SERIAL_CHAR('+');
|
||||
SERIAL_ECHO(v);
|
||||
}
|
||||
|
||||
@@ -207,8 +207,7 @@ void reset_bed_level() {
|
||||
#endif
|
||||
}
|
||||
#ifdef SCAD_MESH_OUTPUT
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(']'); // close sub-array
|
||||
SERIAL_CHAR(' ', ']'); // close sub-array
|
||||
if (y < sy - 1) SERIAL_CHAR(',');
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
// Add XY probe offset from extruder because probe_at_point() subtracts them when
|
||||
// moving to the XY position to be measured. This ensures better agreement between
|
||||
// the current Z position after G28 and the mesh values.
|
||||
const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + xy_pos_t(probe_offset));
|
||||
const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + probe_offset_xy);
|
||||
|
||||
if (!lcd) SERIAL_EOL();
|
||||
for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {
|
||||
|
||||
@@ -450,7 +450,7 @@
|
||||
SERIAL_ECHO(g29_pos.y);
|
||||
SERIAL_ECHOLNPGM(").\n");
|
||||
}
|
||||
const xy_pos_t near = g29_pos + probe_offset;
|
||||
const xy_pos_t near = g29_pos + probe_offset_xy;
|
||||
probe_entire_mesh(near, parser.seen('T'), parser.seen('E'), parser.seen('U'));
|
||||
|
||||
report_current_position();
|
||||
@@ -468,6 +468,7 @@
|
||||
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
|
||||
if (parser.seen('C') && !xy_seen) {
|
||||
|
||||
/**
|
||||
* Use a good default location for the path.
|
||||
* The flipped > and < operators in these comparisons is intentional.
|
||||
@@ -479,8 +480,8 @@
|
||||
#if IS_KINEMATIC
|
||||
X_HOME_POS, Y_HOME_POS
|
||||
#else
|
||||
probe_offset.x > 0 ? X_BED_SIZE : 0,
|
||||
probe_offset.y < 0 ? Y_BED_SIZE : 0
|
||||
probe_offset_xy.x > 0 ? X_BED_SIZE : 0,
|
||||
probe_offset_xy.y < 0 ? Y_BED_SIZE : 0
|
||||
#endif
|
||||
);
|
||||
}
|
||||
@@ -805,8 +806,8 @@
|
||||
restore_ubl_active_state_and_leave();
|
||||
|
||||
do_blocking_move_to_xy(
|
||||
constrain(near.x - probe_offset.x, MESH_MIN_X, MESH_MAX_X),
|
||||
constrain(near.y - probe_offset.y, MESH_MIN_Y, MESH_MAX_Y)
|
||||
constrain(near.x - probe_offset_xy.x, MESH_MIN_X, MESH_MAX_X),
|
||||
constrain(near.y - probe_offset_xy.y, MESH_MIN_Y, MESH_MAX_Y)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1293,7 +1294,7 @@
|
||||
closest.distance = -99999.9f;
|
||||
|
||||
// Get the reference position, either nozzle or probe
|
||||
const xy_pos_t ref = probe_relative ? pos + probe_offset : pos;
|
||||
const xy_pos_t ref = probe_relative ? pos + probe_offset_xy : pos;
|
||||
|
||||
float best_so_far = 99999.99f;
|
||||
|
||||
|
||||
@@ -58,7 +58,9 @@ void update_case_light() {
|
||||
if (case_light_arg_flag && case_light_on)
|
||||
case_light_brightness = case_light_brightness_sav; // restore last brightens if this is an S1 argument
|
||||
|
||||
const uint8_t i = case_light_on ? case_light_brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL) || NONE(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_NO_BRIGHTNESS)
|
||||
const uint8_t i = case_light_on ? case_light_brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
|
||||
@@ -71,13 +73,13 @@ void update_case_light() {
|
||||
|
||||
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
|
||||
if (PWM_PIN(CASE_LIGHT_PIN))
|
||||
analogWrite(pin_t(CASE_LIGHT_PIN),
|
||||
analogWrite(pin_t(CASE_LIGHT_PIN), (
|
||||
#if CASE_LIGHT_MAX_PWM == 255
|
||||
n10ct
|
||||
#else
|
||||
map(n10ct, 0, 255, 0, CASE_LIGHT_MAX_PWM)
|
||||
#endif
|
||||
);
|
||||
));
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ xyze_uint_t mcp4728_values;
|
||||
*/
|
||||
void mcp4728_init() {
|
||||
Wire.begin();
|
||||
Wire.requestFrom(int(DAC_DEV_ADDRESS), 24);
|
||||
Wire.requestFrom(I2C_ADDRESS(DAC_DEV_ADDRESS), 24);
|
||||
while (Wire.available()) {
|
||||
char deviceID = Wire.read(),
|
||||
hiByte = Wire.read(),
|
||||
|
||||
@@ -29,6 +29,24 @@
|
||||
|
||||
#include <Wire.h>
|
||||
|
||||
/**
|
||||
* The following three macros are only used in this piece of code related to mcp4728.
|
||||
* They are defined in the standard Arduino framework but could be undefined in 32 bits Arduino frameworks.
|
||||
* (For instance not defined in Arduino lpc176x framework)
|
||||
* So we have to define them if needed.
|
||||
*/
|
||||
#ifndef word
|
||||
#define word(h, l) ((uint8_t) ((h << 8) | l))
|
||||
#endif
|
||||
|
||||
#ifndef lowByte
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
#endif
|
||||
|
||||
#ifndef highByte
|
||||
#define highByte(w) ((uint8_t) ((w) >> 8))
|
||||
#endif
|
||||
|
||||
#define defaultVDD DAC_STEPPER_MAX //was 5000 but differs with internal Vref
|
||||
#define BASE_ADDR 0x60
|
||||
#define RESET 0b00000110
|
||||
|
||||
@@ -68,7 +68,7 @@ void dac_current_percent(uint8_t channel, float val) {
|
||||
void dac_current_raw(uint8_t channel, uint16_t val) {
|
||||
if (!dac_present) return;
|
||||
|
||||
NOMORE(val, DAC_STEPPER_MAX);
|
||||
NOMORE(val, uint16_t(DAC_STEPPER_MAX));
|
||||
|
||||
mcp4728_analogWrite(dac_order[channel], val);
|
||||
mcp4728_simpleCommand(UPDATE);
|
||||
|
||||
@@ -42,25 +42,40 @@ Joystick joystick;
|
||||
|
||||
#if HAS_JOY_ADC_X
|
||||
temp_info_t Joystick::x; // = { 0 }
|
||||
#if ENABLED(INVERT_JOY_X)
|
||||
#define JOY_X(N) (16383 - (N))
|
||||
#else
|
||||
#define JOY_X(N) (N)
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
temp_info_t Joystick::y; // = { 0 }
|
||||
#if ENABLED(INVERT_JOY_Y)
|
||||
#define JOY_Y(N) (16383 - (N))
|
||||
#else
|
||||
#define JOY_Y(N) (N)
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
temp_info_t Joystick::z; // = { 0 }
|
||||
#if ENABLED(INVERT_JOY_Z)
|
||||
#define JOY_Z(N) (16383 - (N))
|
||||
#else
|
||||
#define JOY_Z(N) (N)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(JOYSTICK_DEBUG)
|
||||
void Joystick::report() {
|
||||
SERIAL_ECHOPGM("Joystick");
|
||||
#if HAS_JOY_ADC_X
|
||||
SERIAL_ECHOPAIR_P(SP_X_STR, x.raw);
|
||||
SERIAL_ECHOPAIR_P(SP_X_STR, JOY_X(x.raw));
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
SERIAL_ECHOPAIR_P(SP_Y_STR, y.raw);
|
||||
SERIAL_ECHOPAIR_P(SP_Y_STR, JOY_Y(y.raw));
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
SERIAL_ECHOPAIR_P(SP_Z_STR, z.raw);
|
||||
SERIAL_ECHOPAIR_P(SP_Z_STR, JOY_Z(z.raw));
|
||||
#endif
|
||||
#if HAS_JOY_ADC_EN
|
||||
SERIAL_ECHO_TERNARY(READ(JOY_EN_PIN), " EN=", "HIGH (dis", "LOW (en", "abled)");
|
||||
@@ -91,15 +106,15 @@ Joystick joystick;
|
||||
|
||||
#if HAS_JOY_ADC_X
|
||||
static constexpr int16_t joy_x_limits[4] = JOY_X_LIMITS;
|
||||
_normalize_joy(norm_jog.x, x.raw, joy_x_limits);
|
||||
_normalize_joy(norm_jog.x, JOY_X(x.raw), joy_x_limits);
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
static constexpr int16_t joy_y_limits[4] = JOY_Y_LIMITS;
|
||||
_normalize_joy(norm_jog.y, y.raw, joy_y_limits);
|
||||
_normalize_joy(norm_jog.y, JOY_Y(y.raw), joy_y_limits);
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
static constexpr int16_t joy_z_limits[4] = JOY_Z_LIMITS;
|
||||
_normalize_joy(norm_jog.z, z.raw, joy_z_limits);
|
||||
_normalize_joy(norm_jog.z, JOY_Z(z.raw), joy_z_limits);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -148,14 +148,16 @@ class PrintJobRecovery {
|
||||
static void enable(const bool onoff);
|
||||
static void changed();
|
||||
|
||||
static void check();
|
||||
static void resume();
|
||||
|
||||
static inline bool exists() { return card.jobRecoverFileExists(); }
|
||||
static inline void open(const bool read) { card.openJobRecoveryFile(read); }
|
||||
static inline void close() { file.close(); }
|
||||
|
||||
static void check();
|
||||
static void resume();
|
||||
static void purge();
|
||||
|
||||
static inline void cancel() { purge(); card.autostart_index = 0; }
|
||||
|
||||
static void load();
|
||||
static void save(const bool force=
|
||||
#if ENABLED(SAVE_EACH_CMD_MODE)
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
|
||||
#include "probe_temp_compensation.h"
|
||||
#include <math.h>
|
||||
|
||||
ProbeTempComp temp_comp;
|
||||
|
||||
int16_t ProbeTempComp::z_offsets_probe[ProbeTempComp::cali_info_init[TSI_PROBE].measurements], // = {0}
|
||||
ProbeTempComp::z_offsets_bed[ProbeTempComp::cali_info_init[TSI_BED].measurements]; // = {0}
|
||||
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
int16_t ProbeTempComp::z_offsets_ext[ProbeTempComp::cali_info_init[TSI_EXT].measurements]; // = {0}
|
||||
#endif
|
||||
|
||||
int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = {
|
||||
ProbeTempComp::z_offsets_probe, ProbeTempComp::z_offsets_bed
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
, ProbeTempComp::z_offsets_ext
|
||||
#endif
|
||||
};
|
||||
|
||||
const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = {
|
||||
ProbeTempComp::cali_info_init[TSI_PROBE], ProbeTempComp::cali_info_init[TSI_BED]
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
, ProbeTempComp::cali_info_init[TSI_EXT]
|
||||
#endif
|
||||
};
|
||||
|
||||
uint8_t ProbeTempComp::calib_idx; // = 0
|
||||
float ProbeTempComp::init_measurement; // = 0.0
|
||||
|
||||
void ProbeTempComp::clear_offsets(const TempSensorID tsi) {
|
||||
for (uint8_t i = 0; i < cali_info[tsi].measurements; ++i)
|
||||
sensor_z_offsets[tsi][i] = 0;
|
||||
calib_idx = 0;
|
||||
}
|
||||
|
||||
bool ProbeTempComp::set_offset(const TempSensorID tsi, const uint8_t idx, const int16_t offset) {
|
||||
if (idx >= cali_info[tsi].measurements) return false;
|
||||
sensor_z_offsets[tsi][idx] = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProbeTempComp::print_offsets() {
|
||||
for (uint8_t s = 0; s < TSI_COUNT; s++) {
|
||||
float temp = cali_info[s].start_temp;
|
||||
for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
|
||||
serialprintPGM(s == TSI_BED ? PSTR("Bed") :
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
s == TSI_EXT ? PSTR("Extruder") :
|
||||
#endif
|
||||
PSTR("Probe")
|
||||
);
|
||||
SERIAL_ECHOLNPAIR(
|
||||
" temp: ", temp,
|
||||
"C; Offset: ", i < 0 ? 0.0f : sensor_z_offsets[s][i], " um"
|
||||
);
|
||||
temp += cali_info[s].temp_res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProbeTempComp::prepare_new_calibration(const float &init_meas_z) {
|
||||
calib_idx = 0;
|
||||
init_measurement = init_meas_z;
|
||||
}
|
||||
|
||||
void ProbeTempComp::push_back_new_measurement(const TempSensorID tsi, const float &meas_z) {
|
||||
switch (tsi) {
|
||||
case TSI_PROBE:
|
||||
case TSI_BED:
|
||||
//case TSI_EXT:
|
||||
if (calib_idx >= cali_info[tsi].measurements) return;
|
||||
sensor_z_offsets[tsi][calib_idx++] = static_cast<int16_t>(meas_z * 1000.0f - init_measurement * 1000.0f);
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
|
||||
if (tsi != TSI_PROBE && tsi != TSI_BED) return false;
|
||||
|
||||
if (calib_idx < 3) {
|
||||
SERIAL_ECHOLNPGM("!Insufficient measurements (min. 3).");
|
||||
clear_offsets(tsi);
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint8_t measurements = cali_info[tsi].measurements;
|
||||
const float start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
int16_t * const data = sensor_z_offsets[tsi];
|
||||
|
||||
// Extrapolate
|
||||
float k, d;
|
||||
if (calib_idx < measurements) {
|
||||
SERIAL_ECHOLNPAIR("Got ", calib_idx, " measurements. ");
|
||||
if (linear_regression(tsi, k, d)) {
|
||||
SERIAL_ECHOPGM("Applying linear extrapolation");
|
||||
calib_idx--;
|
||||
for (; calib_idx < measurements; ++calib_idx) {
|
||||
const float temp = start_temp + float(calib_idx) * res_temp;
|
||||
data[calib_idx] = static_cast<int16_t>(k * temp + d);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Simply use the last measured value for higher temperatures
|
||||
SERIAL_ECHOPGM("Failed to extrapolate");
|
||||
const int16_t last_val = data[calib_idx];
|
||||
for (; calib_idx < measurements; ++calib_idx)
|
||||
data[calib_idx] = last_val;
|
||||
}
|
||||
SERIAL_ECHOLNPGM(" for higher temperatures.");
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
for (calib_idx = 0; calib_idx < measurements; ++calib_idx) {
|
||||
// Restrict the max. offset
|
||||
if (abs(data[calib_idx]) > 2000) {
|
||||
SERIAL_ECHOLNPGM("!Invalid Z-offset detected (0-2).");
|
||||
clear_offsets(tsi);
|
||||
return false;
|
||||
}
|
||||
// Restrict the max. offset difference between two probings
|
||||
if (calib_idx > 0 && abs(data[calib_idx - 1] - data[calib_idx]) > 800) {
|
||||
SERIAL_ECHOLNPGM("!Invalid Z-offset between two probings detected (0-0.8).");
|
||||
clear_offsets(TSI_PROBE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const float &temp, float &meas_z) {
|
||||
if (WITHIN(temp, cali_info[tsi].start_temp, cali_info[tsi].end_temp))
|
||||
meas_z -= get_offset_for_temperature(tsi, temp);
|
||||
}
|
||||
|
||||
float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const float &temp) {
|
||||
|
||||
const uint8_t measurements = cali_info[tsi].measurements;
|
||||
const float start_temp = cali_info[tsi].start_temp,
|
||||
end_temp = cali_info[tsi].end_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const int16_t * const data = sensor_z_offsets[tsi];
|
||||
|
||||
if (temp <= start_temp) return 0.0f;
|
||||
if (temp >= end_temp) return static_cast<float>(data[measurements - 1]) / 1000.0f;
|
||||
|
||||
// Linear interpolation
|
||||
int16_t val1 = 0, val2 = data[0];
|
||||
uint8_t idx = 0;
|
||||
float meas_temp = start_temp + res_temp;
|
||||
while (meas_temp < temp) {
|
||||
if (++idx >= measurements) return static_cast<float>(val2) / 1000.0f;
|
||||
meas_temp += res_temp;
|
||||
val1 = val2;
|
||||
val2 = data[idx];
|
||||
}
|
||||
const float factor = (meas_temp - temp) / static_cast<float>(res_temp);
|
||||
return (static_cast<float>(val2) - static_cast<float>(val2 - val1) * factor) / 1000.0f;
|
||||
}
|
||||
|
||||
bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d) {
|
||||
if (tsi != TSI_PROBE && tsi != TSI_BED) return false;
|
||||
|
||||
if (!WITHIN(calib_idx, 2, cali_info[tsi].measurements)) return false;
|
||||
|
||||
const float start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const int16_t * const data = sensor_z_offsets[tsi];
|
||||
|
||||
float sum_x = start_temp,
|
||||
sum_x2 = sq(start_temp),
|
||||
sum_xy = 0, sum_y = 0;
|
||||
|
||||
for (uint8_t i = 0; i < calib_idx; ++i) {
|
||||
const float xi = start_temp + (i + 1) * res_temp,
|
||||
yi = static_cast<float>(data[i]);
|
||||
sum_x += xi;
|
||||
sum_x2 += sq(xi);
|
||||
sum_xy += xi * yi;
|
||||
sum_y += yi;
|
||||
}
|
||||
|
||||
const float denom = static_cast<float>(calib_idx + 1) * sum_x2 - sq(sum_x);
|
||||
if (fabs(denom) <= 10e-5) {
|
||||
// Singularity - unable to solve
|
||||
k = d = 0.0;
|
||||
return false;
|
||||
}
|
||||
|
||||
k = (static_cast<float>(calib_idx + 1) * sum_xy - sum_x * sum_y) / denom;
|
||||
d = (sum_y - k * sum_x) / static_cast<float>(calib_idx + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // PROBE_TEMP_COMPENSATION
|
||||
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
enum TempSensorID : uint8_t {
|
||||
TSI_PROBE,
|
||||
TSI_BED,
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
TSI_EXT,
|
||||
#endif
|
||||
TSI_COUNT
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t measurements; // Max. number of measurements to be stored (35 - 80°C)
|
||||
float temp_res, // Resolution in °C between measurements
|
||||
start_temp, // Base measurement; z-offset == 0
|
||||
end_temp;
|
||||
} temp_calib_t;
|
||||
|
||||
/**
|
||||
* Probe temperature compensation implementation.
|
||||
* Z-probes like the P.I.N.D.A V2 allow for compensation of
|
||||
* measurement errors/shifts due to changed temperature.
|
||||
*/
|
||||
class ProbeTempComp {
|
||||
public:
|
||||
|
||||
static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
|
||||
{ 30, 10, 5, 30 + 10 * 5 }, // Probe
|
||||
{ 60, 10, 5, 60 + 10 * 5 }, // Bed
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
{ 180, 5, 20, 180 + 5 * 20 } // Extruder
|
||||
#endif
|
||||
};
|
||||
static const temp_calib_t cali_info[TSI_COUNT];
|
||||
|
||||
// Where to park nozzle to wait for probe cooldown
|
||||
static constexpr xyz_pos_t park_point = { PTC_PARK_POS_X, PTC_PARK_POS_Y, PTC_PARK_POS_Z };
|
||||
|
||||
static constexpr int max_bed_temp = PTC_MAX_BED_TEMP, // Max temperature to avoid heating errors
|
||||
|
||||
// XY coordinates of nozzle for probing the bed
|
||||
measure_point_x = PTC_PROBE_POS_X, // X-coordinate to probe
|
||||
measure_point_y = PTC_PROBE_POS_Y, // Y-coordinate to probe
|
||||
//measure_point_x = 12.0f, // X-coordinate to probe on MK52 magnetic heatbed
|
||||
//measure_point_y = 7.3f, // Y-coordinate to probe on MK52 magnetic heatbed
|
||||
|
||||
probe_calib_bed_temp = max_bed_temp, // Bed temperature while calibrating probe
|
||||
bed_calib_probe_temp = 30; // Probe temperature while calibrating bed
|
||||
|
||||
static int16_t *sensor_z_offsets[TSI_COUNT],
|
||||
z_offsets_probe[cali_info_init[TSI_PROBE].measurements], // (µm)
|
||||
z_offsets_bed[cali_info_init[TSI_BED].measurements]; // (µm)
|
||||
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
static int16_t z_offsets_ext[cali_info_init[TSI_EXT].measurements]; // (µm)
|
||||
#endif
|
||||
|
||||
static inline void reset_index() { calib_idx = 0; };
|
||||
static inline uint8_t get_index() { return calib_idx; }
|
||||
static void clear_offsets(const TempSensorID tsi);
|
||||
static inline void clear_all_offsets() {
|
||||
clear_offsets(TSI_BED);
|
||||
clear_offsets(TSI_PROBE);
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
clear_offsets(TSI_EXT);
|
||||
#endif
|
||||
}
|
||||
static bool set_offset(const TempSensorID tsi, const uint8_t idx, const int16_t offset);
|
||||
static void print_offsets();
|
||||
static void prepare_new_calibration(const float &init_meas_z);
|
||||
static void push_back_new_measurement(const TempSensorID tsi, const float &meas_z);
|
||||
static bool finish_calibration(const TempSensorID tsi);
|
||||
static void compensate_measurement(const TempSensorID tsi, const float &temp, float &meas_z);
|
||||
|
||||
private:
|
||||
static uint8_t calib_idx;
|
||||
|
||||
/**
|
||||
* Base value. Temperature compensation values will be deltas
|
||||
* to this value, set at first probe.
|
||||
*/
|
||||
static float init_measurement;
|
||||
|
||||
static float get_offset_for_temperature(const TempSensorID tsi, const float &temp);
|
||||
|
||||
/**
|
||||
* Fit a linear function in measured temperature offsets
|
||||
* to allow generating values of higher temperatures.
|
||||
*/
|
||||
static bool linear_regression(const TempSensorID tsi, float &k, float &d);
|
||||
};
|
||||
|
||||
extern ProbeTempComp temp_comp;
|
||||
@@ -213,7 +213,7 @@ class FilamentSensorBase {
|
||||
if (change) {
|
||||
SERIAL_ECHOPGM("Motion detected:");
|
||||
for (uint8_t e = 0; e < NUM_RUNOUT_SENSORS; e++)
|
||||
if (TEST(change, e)) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + e); }
|
||||
if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,22 +29,6 @@
|
||||
#include <TMCStepper.h>
|
||||
#include "../module/planner.h"
|
||||
|
||||
#define TMC_X_LABEL 'X', '0'
|
||||
#define TMC_Y_LABEL 'Y', '0'
|
||||
#define TMC_Z_LABEL 'Z', '0'
|
||||
|
||||
#define TMC_X2_LABEL 'X', '2'
|
||||
#define TMC_Y2_LABEL 'Y', '2'
|
||||
#define TMC_Z2_LABEL 'Z', '2'
|
||||
#define TMC_Z3_LABEL 'Z', '3'
|
||||
|
||||
#define TMC_E0_LABEL 'E', '0'
|
||||
#define TMC_E1_LABEL 'E', '1'
|
||||
#define TMC_E2_LABEL 'E', '2'
|
||||
#define TMC_E3_LABEL 'E', '3'
|
||||
#define TMC_E4_LABEL 'E', '4'
|
||||
#define TMC_E5_LABEL 'E', '5'
|
||||
|
||||
#define CHOPPER_DEFAULT_12V { 3, -1, 1 }
|
||||
#define CHOPPER_DEFAULT_19V { 4, 1, 1 }
|
||||
#define CHOPPER_DEFAULT_24V { 4, 2, 1 }
|
||||
|
||||
@@ -45,20 +45,21 @@ void GcodeSuite::G42() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Move to current_position, as modified by I, J, P parameters
|
||||
destination = current_position;
|
||||
|
||||
if (hasI) destination.x = _GET_MESH_X(ix);
|
||||
if (hasJ) destination.y = _GET_MESH_Y(iy);
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
if (parser.boolval('P')) {
|
||||
if (hasI) destination.x -= probe_offset.x;
|
||||
if (hasJ) destination.y -= probe_offset.y;
|
||||
if (hasI) destination.x -= probe_offset_xy.x;
|
||||
if (hasJ) destination.y -= probe_offset_xy.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
const feedRate_t fval = parser.linearval('F'),
|
||||
fr_mm_s = fval > 0 ? MMM_TO_MMS(fval) : 0.0f;
|
||||
fr_mm_s = MMM_TO_MMS(fval > 0 ? fval : 0.0f);
|
||||
|
||||
// SCARA kinematic has "safe" XY raw moves
|
||||
#if IS_SCARA
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
#include "../../../module/probe.h"
|
||||
#include "../../queue.h"
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
#include "../../../feature/probe_temp_compensation.h"
|
||||
#include "../../../module/temperature.h"
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#endif
|
||||
@@ -228,7 +233,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
ABL_VAR xy_int8_t meshCount;
|
||||
#endif
|
||||
|
||||
ABL_VAR xy_float_t probe_position_lf, probe_position_rb;
|
||||
ABL_VAR xy_pos_t probe_position_lf, probe_position_rb;
|
||||
ABL_VAR xy_float_t gridSpacing = { 0, 0 };
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
@@ -403,14 +408,13 @@ G29_TYPE GcodeSuite::G29() {
|
||||
}
|
||||
else {
|
||||
probe_position_lf.set(
|
||||
parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : (_MAX(x_min, X_CENTER - (X_BED_SIZE) / 2) + MIN_PROBE_EDGE_LEFT),
|
||||
parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : (_MAX(y_min, Y_CENTER - (Y_BED_SIZE) / 2) + MIN_PROBE_EDGE_FRONT)
|
||||
parser.seenval('L') ? RAW_X_POSITION(parser.value_linear_units()) : x_min,
|
||||
parser.seenval('F') ? RAW_Y_POSITION(parser.value_linear_units()) : y_min
|
||||
);
|
||||
probe_position_rb.set(
|
||||
parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : (_MIN(x_max, probe_position_lf.x + X_BED_SIZE) - MIN_PROBE_EDGE_RIGHT),
|
||||
parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : (_MIN(y_max, probe_position_lf.y + Y_BED_SIZE) - MIN_PROBE_EDGE_BACK)
|
||||
parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
|
||||
parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
|
||||
);
|
||||
SERIAL_ECHOLN("Set Trail 1");
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -715,6 +719,14 @@ G29_TYPE GcodeSuite::G29() {
|
||||
break; // Breaks out of both loops
|
||||
}
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), measured_z);
|
||||
temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), measured_z);
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), measured_z);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
|
||||
mean += measured_z;
|
||||
@@ -911,8 +923,8 @@ G29_TYPE GcodeSuite::G29() {
|
||||
planner.force_unapply_leveling(converted); // use conversion machinery
|
||||
|
||||
// Use the last measured distance to the bed, if possible
|
||||
if ( NEAR(current_position.x, probePos.x - probe_offset.x)
|
||||
&& NEAR(current_position.y, probePos.y - probe_offset.y)
|
||||
if ( NEAR(current_position.x, probePos.x - probe_offset_xy.x)
|
||||
&& NEAR(current_position.y, probePos.y - probe_offset_xy.y)
|
||||
) {
|
||||
const float simple_z = current_position.z - measured_z;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probed Z", simple_z, " Matrix Z", converted.z, " Discrepancy ", simple_z - converted.z);
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
#include "../../lcd/ultralcd.h"
|
||||
|
||||
#if HAS_DRIVER(L6470) // set L6470 absolute position registers to counts
|
||||
#include "../../libs/L6470/L6470_Marlin.h"
|
||||
#if HAS_L64XX // set L6470 absolute position registers to counts
|
||||
#include "../../libs/L64XX/L64XX_Marlin.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
@@ -133,7 +133,7 @@
|
||||
destination.set(safe_homing_xy, current_position.z);
|
||||
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
destination -= probe_offset;
|
||||
destination -= probe_offset_xy;
|
||||
#endif
|
||||
|
||||
if (position_is_reachable(destination)) {
|
||||
@@ -526,11 +526,18 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28");
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
// Set L6470 absolute position registers to counts
|
||||
for (uint8_t j = 1; j <= L6470::chain[0]; j++) {
|
||||
const uint8_t cv = L6470::chain[j];
|
||||
L6470.set_param(cv, L6470_ABS_POS, stepper.position((AxisEnum)L6470.axis_xref[cv]));
|
||||
// constexpr *might* move this to PROGMEM.
|
||||
// If not, this will need a PROGMEM directive and an accessor.
|
||||
static constexpr AxisEnum L6470_axis_xref[MAX_L6470] = {
|
||||
X_AXIS, Y_AXIS, Z_AXIS,
|
||||
X_AXIS, Y_AXIS, Z_AXIS, Z_AXIS,
|
||||
E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS
|
||||
};
|
||||
for (uint8_t j = 1; j <= L64XX::chain[0]; j++) {
|
||||
const uint8_t cv = L64XX::chain[j];
|
||||
L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L6470_axis_xref[cv]));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,407 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* G76_M871.cpp - Temperature calibration/compensation for z-probing
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../module/probe.h"
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#include "../../module/temperature.h"
|
||||
#include "../../module/probe.h"
|
||||
#include "../../feature/probe_temp_compensation.h"
|
||||
|
||||
/**
|
||||
* G76: calibrate probe and/or bed temperature offsets
|
||||
* Notes:
|
||||
* - When calibrating probe, bed temperature is held constant.
|
||||
* Compensation values are deltas to first probe measurement at probe temp. = 30°C.
|
||||
* - When calibrating bed, probe temperature is held constant.
|
||||
* Compensation values are deltas to first probe measurement at bed temp. = 60°C.
|
||||
* - The hotend will not be heated at any time.
|
||||
* - On my Prusa MK3S clone I put a piece of paper between the probe and the hotend
|
||||
* so the hotend fan would not cool my probe constantly. Alternativly you could just
|
||||
* make sure the fan is not running while running the calibration process.
|
||||
*
|
||||
* Probe calibration:
|
||||
* - Moves probe to cooldown point.
|
||||
* - Heats up bed to 100°C.
|
||||
* - Moves probe to probing point (1mm above heatbed).
|
||||
* - Waits until probe reaches target temperature (30°C).
|
||||
* - Does a z-probing (=base value) and increases target temperature by 5°C.
|
||||
* - Waits until probe reaches increased target temperature.
|
||||
* - Does a z-probing (delta to base value will be a compensation value) and increases target temperature by 5°C.
|
||||
* - Repeats last two steps until max. temperature reached or timeout (i.e. probe does not heat up any further).
|
||||
* - Compensation values of higher temperatures will be extrapolated (using linear regression first).
|
||||
* While this is not exact by any means it is still better than simply using the last compensation value.
|
||||
*
|
||||
* Bed calibration:
|
||||
* - Moves probe to cooldown point.
|
||||
* - Heats up bed to 60°C.
|
||||
* - Moves probe to probing point (1mm above heatbed).
|
||||
* - Waits until probe reaches target temperature (30°C).
|
||||
* - Does a z-probing (=base value) and increases bed temperature by 5°C.
|
||||
* - Moves probe to cooldown point.
|
||||
* - Waits until probe is below 30°C and bed has reached target temperature.
|
||||
* - Moves probe to probing point and waits until it reaches target temperature (30°C).
|
||||
* - Does a z-probing (delta to base value will be a compensation value) and increases bed temperature by 5°C.
|
||||
* - Repeats last four points until max. bed temperature reached (110°C) or timeout.
|
||||
* - Compensation values of higher temperatures will be extrapolated (using linear regression first).
|
||||
* While this is not exact by any means it is still better than simply using the last compensation value.
|
||||
*
|
||||
* G76 [B | P]
|
||||
* - no flag - Both calibration procedures will be run.
|
||||
* - `B` - Run bed temperature calibration.
|
||||
* - `P` - Run probe temperature calibration.
|
||||
*/
|
||||
void GcodeSuite::G76() {
|
||||
// Check if heated bed is available and z-homing is done with probe
|
||||
#if TEMP_SENSOR_BED == 0 || !(HOMING_Z_WITH_PROBE)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
// Make sure any BLTouch error condition is cleared
|
||||
bltouch_command(BLTOUCH_RESET, BLTOUCH_RESET_DELAY);
|
||||
set_bltouch_deployed(false);
|
||||
#endif
|
||||
|
||||
bool do_bed_cal = parser.boolval('B'),
|
||||
do_probe_cal = parser.boolval('P');
|
||||
if (!do_bed_cal && !do_probe_cal)
|
||||
do_bed_cal = do_probe_cal = true;
|
||||
|
||||
// Synchronize with planner
|
||||
planner.synchronize();
|
||||
|
||||
// Report temperatures every second and handle heating timeouts
|
||||
millis_t next_temp_report = millis() + 1000;
|
||||
|
||||
if (do_bed_cal || do_probe_cal) {
|
||||
// Ensure park position is reachable
|
||||
if (!position_is_reachable(ProbeTempComp::park_point.x, ProbeTempComp::park_point.y)
|
||||
|| !(WITHIN(ProbeTempComp::park_point.z, Z_MIN_POS - 0.001f, Z_MAX_POS + 0.001f))
|
||||
) {
|
||||
SERIAL_ECHOLNPGM("!Park position unreachable - aborting.");
|
||||
return;
|
||||
}
|
||||
// Ensure probe position is reachable
|
||||
destination.set(
|
||||
temp_comp.measure_point_x - probe_offset.x,
|
||||
temp_comp.measure_point_y - probe_offset.y
|
||||
);
|
||||
if (!position_is_reachable_by_probe(destination)) {
|
||||
SERIAL_ECHOLNPGM("!Probe position unreachable - aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
G28(true);
|
||||
}
|
||||
|
||||
/******************************************
|
||||
* Calibrate bed temperature offsets
|
||||
******************************************/
|
||||
|
||||
if (do_bed_cal) {
|
||||
|
||||
uint16_t target_bed = temp_comp.cali_info_init[TSI_BED].start_temp,
|
||||
target_probe = temp_comp.bed_calib_probe_temp;
|
||||
|
||||
SERIAL_ECHOLNPGM("Waiting for printer to cool down.");
|
||||
while (thermalManager.degBed() > target_bed
|
||||
|| thermalManager.degProbe() > target_probe
|
||||
) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
true
|
||||
#endif
|
||||
);
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_temp_report)) {
|
||||
thermalManager.print_heater_states(active_extruder);
|
||||
next_temp_report = ms + 1000;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable leveling so it won't mess with us
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
bool timeout = false;
|
||||
while (true) {
|
||||
thermalManager.setTargetBed(target_bed);
|
||||
|
||||
SERIAL_ECHOLNPAIR("Target Bed: ", target_bed, "; Probe: ", target_probe);
|
||||
|
||||
// Park nozzle
|
||||
do_blocking_move_to(ProbeTempComp::park_point.x, ProbeTempComp::park_point.y, ProbeTempComp::park_point.z);
|
||||
|
||||
// Wait for heatbed to reach target temp and probe to cool below target temp
|
||||
SERIAL_ECHOLNPGM("Waiting for bed and probe to reach target temp.");
|
||||
const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
|
||||
while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1 || thermalManager.degProbe() > target_probe) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
true
|
||||
#endif
|
||||
);
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_temp_report)) {
|
||||
thermalManager.print_heater_states(active_extruder);
|
||||
next_temp_report = ms + 1000;
|
||||
}
|
||||
if (ELAPSED(ms, probe_timeout_ms)) {
|
||||
SERIAL_ECHOLNPGM("!Bed heating timeout.");
|
||||
timeout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (timeout) break;
|
||||
|
||||
// Move probe to probing point and wait for probe to reach target temp
|
||||
destination.set(temp_comp.measure_point_x, temp_comp.measure_point_y, 0.5);
|
||||
do_blocking_move_to(destination.x, destination.y, destination.z);
|
||||
SERIAL_ECHOLNPGM("Waiting for probe heating.");
|
||||
while (thermalManager.degProbe() < target_probe) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
true
|
||||
#endif
|
||||
);
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_temp_report)) {
|
||||
thermalManager.print_heater_states(active_extruder);
|
||||
next_temp_report = ms + 1000;
|
||||
}
|
||||
}
|
||||
|
||||
// Raise nozzle before probing
|
||||
destination.z = 5.0;
|
||||
do_blocking_move_to_z(destination.z);
|
||||
|
||||
// Do a single probe
|
||||
remember_feedrate_scaling_off();
|
||||
const float measured_z = probe_at_point(
|
||||
destination.x + probe_offset.x,
|
||||
destination.y + probe_offset.y,
|
||||
PROBE_PT_NONE
|
||||
);
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
if (isnan(measured_z)) {
|
||||
SERIAL_ECHOLNPGM("!Received NAN measurement - aborting.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPAIR_F("Measured: ", measured_z);
|
||||
|
||||
if (target_bed == temp_comp.cali_info_init[TSI_BED].start_temp)
|
||||
temp_comp.prepare_new_calibration(measured_z);
|
||||
else
|
||||
temp_comp.push_back_new_measurement(TSI_BED, measured_z);
|
||||
|
||||
target_bed += temp_comp.cali_info_init[TSI_BED].temp_res;
|
||||
if (target_bed > temp_comp.max_bed_temp) break;
|
||||
}
|
||||
|
||||
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
|
||||
if (temp_comp.finish_calibration(TSI_BED))
|
||||
SERIAL_ECHOLNPGM("Successfully calibrated bed.");
|
||||
else
|
||||
SERIAL_ECHOLNPGM("!Failed to calibrated bed - reset calibration values.");
|
||||
|
||||
// Cleanup
|
||||
thermalManager.setTargetBed(0);
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(true);
|
||||
#endif
|
||||
} // do_bed_cal
|
||||
|
||||
/********************************************
|
||||
* Calibrate probe temperature offsets
|
||||
********************************************/
|
||||
|
||||
if (do_probe_cal) {
|
||||
|
||||
// Park nozzle
|
||||
do_blocking_move_to(ProbeTempComp::park_point.x, ProbeTempComp::park_point.y, ProbeTempComp::park_point.z);
|
||||
|
||||
// Initialize temperatures
|
||||
uint16_t target_bed = temp_comp.probe_calib_bed_temp,
|
||||
target_probe = temp_comp.cali_info_init[TSI_BED].start_temp;
|
||||
thermalManager.setTargetBed(target_bed);
|
||||
SERIAL_ECHOLNPGM("Waiting for bed and probe temperature.");
|
||||
while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f
|
||||
|| thermalManager.degProbe() > target_probe
|
||||
) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
true
|
||||
#endif
|
||||
);
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_temp_report)) {
|
||||
thermalManager.print_heater_states(active_extruder);
|
||||
next_temp_report = ms + 1000;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable leveling so it won't mess with us
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
bool timeout = false;
|
||||
while (true) {
|
||||
// Move probe to probing point and wait for it to reach target temperature
|
||||
destination.set(temp_comp.measure_point_x, temp_comp.measure_point_y, 0.5);
|
||||
do_blocking_move_to(destination);
|
||||
|
||||
SERIAL_ECHOLNPAIR(
|
||||
"Bed temp: ", target_bed,
|
||||
"; Probe temp: ", target_probe,
|
||||
" Waiting for probe heating."
|
||||
);
|
||||
|
||||
const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
|
||||
while (thermalManager.degProbe() < target_probe) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
true
|
||||
#endif
|
||||
);
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_temp_report)) {
|
||||
thermalManager.print_heater_states(active_extruder);
|
||||
next_temp_report = ms + 1000;
|
||||
}
|
||||
if (ELAPSED(ms, probe_timeout_ms)) {
|
||||
SERIAL_ECHOLNPGM("!Probe heating aborted due to timeout.");
|
||||
timeout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (timeout) break;
|
||||
|
||||
// Raise nozzle before probing
|
||||
destination.z = 5.0;
|
||||
do_blocking_move_to_z(destination.z);
|
||||
|
||||
// Do a single probe
|
||||
remember_feedrate_scaling_off();
|
||||
const float measured_z = probe_at_point(
|
||||
destination.x + probe_offset.x,
|
||||
destination.y + probe_offset.y,
|
||||
PROBE_PT_NONE
|
||||
);
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
if (isnan(measured_z)) {
|
||||
SERIAL_ECHOLNPGM("!Received NAN measurement - aborting.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPAIR_F("Measured: ", measured_z);
|
||||
|
||||
if (target_probe == temp_comp.cali_info_init[TSI_BED].start_temp)
|
||||
temp_comp.prepare_new_calibration(measured_z);
|
||||
else
|
||||
temp_comp.push_back_new_measurement(TSI_PROBE, measured_z);
|
||||
|
||||
target_probe += temp_comp.cali_info_init[TSI_BED].temp_res;
|
||||
if (target_probe > temp_comp.cali_info_init[TSI_BED].end_temp) break;
|
||||
}
|
||||
|
||||
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
|
||||
if (temp_comp.finish_calibration(TSI_PROBE))
|
||||
SERIAL_ECHOLNPGM("Successfully calibrated probe.");
|
||||
else
|
||||
SERIAL_ECHOLNPGM("!Failed to calibrated probe.");
|
||||
|
||||
// Cleanup
|
||||
thermalManager.setTargetBed(0);
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(true);
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOLNPGM("Final compensation values:");
|
||||
temp_comp.print_offsets();
|
||||
} // do_probe_cal
|
||||
}
|
||||
|
||||
/**
|
||||
* M871: Report / reset temperature compensation offsets.
|
||||
* Note: This does not affect values in EEPROM until M500.
|
||||
*
|
||||
* M871 [ R | B | P | E ]
|
||||
*
|
||||
* No Parameters - Print current offset values.
|
||||
*
|
||||
* Select only one of these flags:
|
||||
* R - Reset all offsets to zero (i.e., disable compensation).
|
||||
* B - Manually set offset for bed
|
||||
* P - Manually set offset for probe
|
||||
* E - Manually set offset for extruder
|
||||
*
|
||||
* With B, P, or E:
|
||||
* I[index] - Index in the array
|
||||
* V[value] - Adjustment in µm
|
||||
*/
|
||||
void GcodeSuite::M871() {
|
||||
|
||||
if (parser.seen('R')) {
|
||||
// Reset z-probe offsets to factory defaults
|
||||
temp_comp.clear_all_offsets();
|
||||
SERIAL_ECHOLNPGM("Offsets reset to default.");
|
||||
}
|
||||
else if (parser.seen("BPE")) {
|
||||
if (!parser.seenval('V')) return;
|
||||
const int16_t val = parser.value_int();
|
||||
if (!parser.seenval('I')) return;
|
||||
const int16_t idx = parser.value_int();
|
||||
const TempSensorID mod = (parser.seen('B') ? TSI_BED :
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
parser.seen('E') ? TSI_EXT :
|
||||
#endif
|
||||
TSI_PROBE
|
||||
);
|
||||
if (idx > 0 && temp_comp.set_offset(mod, idx - 1, val))
|
||||
SERIAL_ECHOLNPAIR("Set value: ", val);
|
||||
else
|
||||
SERIAL_ECHOLNPGM("!Invalid index. Failed to set value (note: value at index 0 is constant).");
|
||||
|
||||
}
|
||||
else // Print current Z-probe adjustments. Note: Values in EEPROM might differ.
|
||||
temp_comp.print_offsets();
|
||||
}
|
||||
|
||||
#endif // PROBE_TEMP_COMPENSATION
|
||||
@@ -238,12 +238,12 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
|
||||
SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
|
||||
|
||||
if (block_cnt == 0) // Make sure the special case of no free blocks shows up as an
|
||||
block_cnt = -1; // error to the calling code!
|
||||
block_cnt = -1; // error to the calling code!
|
||||
|
||||
SERIAL_ECHOPGM(" return=");
|
||||
if (block_cnt == 1) {
|
||||
SERIAL_CHAR('0'); // if the block_cnt is 1, nothing has broken up the free memory
|
||||
SERIAL_EOL(); // area and it is appropriate to say 'no corruption'.
|
||||
SERIAL_CHAR('0'); // If the block_cnt is 1, nothing has broken up the free memory
|
||||
SERIAL_EOL(); // area and it is appropriate to say 'no corruption'.
|
||||
return 0;
|
||||
}
|
||||
SERIAL_ECHOLNPGM("true");
|
||||
|
||||
@@ -75,8 +75,7 @@ void GcodeSuite::M425() {
|
||||
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
|
||||
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
|
||||
LOOP_XYZ(a) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_CHAR(' ', axis_codes[a]);
|
||||
SERIAL_ECHO(backlash.distance_mm[a]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@@ -89,8 +88,7 @@ void GcodeSuite::M425() {
|
||||
SERIAL_ECHOPGM(" Average measured backlash (mm):");
|
||||
if (backlash.has_any_measurement()) {
|
||||
LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_CHAR(' ', axis_codes[a]);
|
||||
SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ void GcodeSuite::M48() {
|
||||
xy_float_t next_pos = current_position;
|
||||
|
||||
const xy_pos_t probe_pos = {
|
||||
parser.linearval('X', next_pos.x + probe_offset.x),
|
||||
parser.linearval('Y', next_pos.y + probe_offset.y)
|
||||
parser.linearval('X', next_pos.x + probe_offset_xy.x),
|
||||
parser.linearval('Y', next_pos.y + probe_offset_xy.y)
|
||||
};
|
||||
|
||||
if (!position_is_reachable_by_probe(probe_pos)) {
|
||||
@@ -166,8 +166,9 @@ void GcodeSuite::M48() {
|
||||
while (angle < 0.0) angle += 360.0; // outside of this range. It looks like they behave correctly with
|
||||
// numbers outside of the range, but just to be safe we clamp them.
|
||||
|
||||
next_pos.set(probe_pos.x - probe_offset.x + cos(RADIANS(angle)) * radius,
|
||||
probe_pos.y - probe_offset.y + sin(RADIANS(angle)) * radius);
|
||||
const xy_pos_t noz_pos = probe_pos - probe_offset_xy;
|
||||
next_pos.set(noz_pos.x + cos(RADIANS(angle)) * radius,
|
||||
noz_pos.y + sin(RADIANS(angle)) * radius);
|
||||
|
||||
#if DISABLED(DELTA)
|
||||
LIMIT(next_pos.x, X_MIN_POS, X_MAX_POS);
|
||||
|
||||
@@ -39,8 +39,7 @@ void GcodeSuite::M221() {
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_CHAR('E');
|
||||
SERIAL_CHAR('0' + target_extruder);
|
||||
SERIAL_CHAR('E', '0' + target_extruder);
|
||||
SERIAL_ECHOPAIR(" Flow: ", planner.flow_percentage[target_extruder]);
|
||||
SERIAL_CHAR('%');
|
||||
SERIAL_EOL();
|
||||
|
||||
@@ -22,36 +22,64 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../libs/L6470/L6470_Marlin.h"
|
||||
#include "../../../libs/L64XX/L64XX_Marlin.h"
|
||||
#include "../../../module/stepper/indirection.h"
|
||||
|
||||
inline void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); }
|
||||
void echo_yes_no(const bool yes);
|
||||
|
||||
void L6470_status_decode(const uint16_t status, const uint8_t axis) {
|
||||
if (L6470.spi_abort) return; // don't do anything if set_directions() has occurred
|
||||
L6470.say_axis(axis);
|
||||
inline void L6470_say_status(const L64XX_axis_t axis) {
|
||||
if (L64xxManager.spi_abort) return;
|
||||
const L64XX_Marlin::L64XX_shadow_t &sh = L64xxManager.shadow;
|
||||
L64xxManager.get_status(axis);
|
||||
L64xxManager.say_axis(axis);
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
char temp_buf[20];
|
||||
sprintf_P(temp_buf, PSTR(" status: %4x "), status);
|
||||
sprintf_P(temp_buf, PSTR(" status: %4x "), sh.STATUS_AXIS_RAW);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
print_bin(status);
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
SERIAL_ECHOPGM("\n...OUTPUT: ");
|
||||
serialprintPGM(status & STATUS_HIZ ? PSTR("OFF") : PSTR("ON "));
|
||||
SERIAL_ECHOPGM(" BUSY: "); echo_yes_no(!(status & STATUS_BUSY));
|
||||
serialprintPGM(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((((status & STATUS_DIR) >> 4) ^ L6470.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE"));
|
||||
SERIAL_ECHOPGM(" Last Command: ");
|
||||
if (status & STATUS_WRONG_CMD) SERIAL_ECHOPGM("IN");
|
||||
SERIAL_ECHOPGM("VALID ");
|
||||
serialprintPGM(status & STATUS_NOTPERF_CMD ? PSTR("Not PERFORMED") : PSTR("COMPLETED "));
|
||||
SERIAL_ECHOPAIR("\n...THERMAL: ", !(status & STATUS_TH_SD) ? "SHUTDOWN" : !(status & STATUS_TH_WRN) ? "WARNING " : "OK ");
|
||||
SERIAL_ECHOPGM(" OVERCURRENT:"); echo_yes_no(!(status & STATUS_OCD));
|
||||
SERIAL_ECHOPGM(" STALL:"); echo_yes_no(!(status & STATUS_STEP_LOSS_A) || !(status & STATUS_STEP_LOSS_B));
|
||||
SERIAL_ECHOPGM(" STEP-CLOCK MODE:"); echo_yes_no(status & STATUS_SCK_MOD);
|
||||
serialprintPGM((((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");
|
||||
else SERIAL_ECHOPGM("ERROR");
|
||||
SERIAL_ECHOPGM("\n...THERMAL: ");
|
||||
switch ((sh.STATUS_AXIS & (sh.STATUS_AXIS_TH_SD | sh.STATUS_AXIS_TH_WRN)) >> 11) {
|
||||
case 0: SERIAL_ECHOPGM("DEVICE SHUTDOWN"); break;
|
||||
case 1: SERIAL_ECHOPGM("BRIDGE SHUTDOWN"); break;
|
||||
case 2: SERIAL_ECHOPGM("WARNING "); break;
|
||||
case 3: SERIAL_ECHOPGM("OK "); break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
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_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);
|
||||
if (sh.STATUS_AXIS_LAYOUT != L6474_STATUS_LAYOUT) {
|
||||
SERIAL_ECHOPGM(" STALL:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_STEP_LOSS_A) == 0 || (sh.STATUS_AXIS & sh.STATUS_AXIS_STEP_LOSS_B) == 0);
|
||||
SERIAL_ECHOPGM(" STEP-CLOCK MODE:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_SCK_MOD) != 0);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOPGM(" STALL: NA "
|
||||
" STEP-CLOCK MODE: NA"
|
||||
" UNDER VOLTAGE LOCKOUT: "); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_UVLO) == 0);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -59,57 +87,56 @@ void L6470_status_decode(const uint16_t status, const uint8_t axis) {
|
||||
* M122: Debug L6470 drivers
|
||||
*/
|
||||
void GcodeSuite::M122() {
|
||||
|
||||
L6470.spi_active = true; // let set_directions() know we're in the middle of a series of SPI transfers
|
||||
|
||||
#define L6470_SAY_STATUS(Q) L6470_status_decode(stepper##Q.getStatus(), Q)
|
||||
L64xxManager.pause_monitor(true); // Keep monitor_driver() from stealing status
|
||||
L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway
|
||||
|
||||
//if (parser.seen('S'))
|
||||
// tmc_set_report_interval(parser.value_bool());
|
||||
// tmc_set_report_interval(parser.value_bool());
|
||||
//else
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
L6470_SAY_STATUS(X);
|
||||
#if AXIS_IS_L64XX(X)
|
||||
L6470_say_status(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
L6470_SAY_STATUS(X2);
|
||||
#if AXIS_IS_L64XX(X2)
|
||||
L6470_say_status(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
L6470_SAY_STATUS(Y);
|
||||
#if AXIS_IS_L64XX(Y)
|
||||
L6470_say_status(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
L6470_SAY_STATUS(Y2);
|
||||
#if AXIS_IS_L64XX(Y2)
|
||||
L6470_say_status(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
L6470_SAY_STATUS(Z);
|
||||
#if AXIS_IS_L64XX(Z)
|
||||
L6470_say_status(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
L6470_SAY_STATUS(Z2);
|
||||
#if AXIS_IS_L64XX(Z2)
|
||||
L6470_say_status(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
L6470_SAY_STATUS(Z3);
|
||||
#if AXIS_IS_L64XX(Z3)
|
||||
L6470_say_status(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
L6470_SAY_STATUS(E0);
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
L6470_say_status(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
L6470_SAY_STATUS(E1);
|
||||
#if AXIS_IS_L64XX(E1)
|
||||
L6470_say_status(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
L6470_SAY_STATUS(E2);
|
||||
#if AXIS_IS_L64XX(E2)
|
||||
L6470_say_status(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
L6470_SAY_STATUS(E3);
|
||||
#if AXIS_IS_L64XX(E3)
|
||||
L6470_say_status(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
L6470_SAY_STATUS(E4);
|
||||
#if AXIS_IS_L64XX(E4)
|
||||
L6470_say_status(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
L6470_SAY_STATUS(E5);
|
||||
#if AXIS_IS_L64XX(E5)
|
||||
L6470_say_status(E5);
|
||||
#endif
|
||||
|
||||
L6470.spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
L6470.spi_abort = false;
|
||||
L64xxManager.spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
L64xxManager.spi_abort = false;
|
||||
L64xxManager.pause_monitor(false);
|
||||
}
|
||||
|
||||
#endif // HAS_DRIVER(L6470)
|
||||
#endif // HAS_L64XX
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../libs/L6470/L6470_Marlin.h"
|
||||
#include "../../../libs/L64XX/L64XX_Marlin.h"
|
||||
#include "../../../module/stepper/indirection.h"
|
||||
#include "../../../module/planner.h"
|
||||
|
||||
@@ -37,22 +37,18 @@
|
||||
* M906: report or set KVAL_HOLD which sets the maximum effective voltage provided by the
|
||||
* PWMs to the steppers
|
||||
*
|
||||
* J - select which driver(s) to monitor on multi-driver axis
|
||||
* 0 - (default) monitor all drivers on the axis or E0
|
||||
* On L6474 this sets the TVAL register (same address).
|
||||
*
|
||||
* I - select which driver(s) to change on multi-driver axis
|
||||
* 0 - (default) all drivers on the axis or E0
|
||||
* 1 - monitor only X, Y, Z or E1
|
||||
* 2 - monitor only X2, Y2, Z2 or E2
|
||||
* 3 - monitor only Z3 or E3
|
||||
* 4 - monitor only E4
|
||||
* 5 - monitor only E5
|
||||
* Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement
|
||||
* xxx (1-255) is distance moved on either side of current position
|
||||
*
|
||||
* I - over current threshold
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* K - value for KVAL_HOLD (0 - 255) (optional)
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* Xxxx, Yxxx, Zxxx, Exxx - axis to change (optional)
|
||||
* L6474 - current in mA (4A max)
|
||||
* All others - 0-255
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -81,126 +77,201 @@
|
||||
* KVAL_DEC
|
||||
* Vs compensation (if enabled)
|
||||
*/
|
||||
void L6470_report_current(L64XX &motor, const L64XX_axis_t axis) {
|
||||
|
||||
void L6470_report_current(L6470 &motor, const uint8_t axis) {
|
||||
if (L6470.spi_abort) return; // don't do anything if set_directions() has occurred
|
||||
const uint16_t status = motor.getStatus() ;
|
||||
const uint8_t overcurrent_threshold = (uint8_t)motor.GetParam(L6470_OCD_TH),
|
||||
stall_threshold = (uint8_t)motor.GetParam(L6470_STALL_TH),
|
||||
motor_status = (status & (STATUS_MOT_STATUS)) >> 13,
|
||||
adc_out = motor.GetParam(L6470_ADC_OUT),
|
||||
adc_out_limited = constrain(adc_out, 8, 24);
|
||||
const float comp_coef = 1600.0f / adc_out_limited;
|
||||
const int microsteps = _BV(motor.GetParam(L6470_STEP_MODE) & 0x07);
|
||||
char temp_buf[80];
|
||||
L6470.say_axis(axis);
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
sprintf_P(temp_buf, PSTR(" status: %4x "), status);
|
||||
DEBUG_ECHO(temp_buf);
|
||||
print_bin(status);
|
||||
#endif
|
||||
sprintf_P(temp_buf, PSTR("\n...OverCurrent Threshold: %2d (%4d mA)"), overcurrent_threshold, (overcurrent_threshold + 1) * 375);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
if (L64xxManager.spi_abort) return; // don't do anything if set_directions() has occurred
|
||||
|
||||
char numstr[11];
|
||||
dtostrf((stall_threshold + 1) * 31.25, 1, 2, numstr);
|
||||
sprintf_P(temp_buf, PSTR(" Stall Threshold: %2d (%s mA)"), stall_threshold, numstr);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
const L64XX_Marlin::L64XX_shadow_t &sh = L64xxManager.shadow;
|
||||
const uint16_t status = L64xxManager.get_status(axis); //also populates shadow structure
|
||||
const uint8_t OverCurrent_Threshold = uint8_t(motor.GetParam(L6470_OCD_TH));
|
||||
|
||||
SERIAL_ECHOPGM(" Motor Status: ");
|
||||
const char *stat_str;
|
||||
switch (motor_status) {
|
||||
default:
|
||||
case 0: stat_str = PSTR("stopped"); break;
|
||||
case 1: stat_str = PSTR("accelerating"); break;
|
||||
case 2: stat_str = PSTR("decelerating"); break;
|
||||
case 3: stat_str = PSTR("at constant speed"); break;
|
||||
auto say_axis_status = [](const L64XX_axis_t axis, const uint16_t status) {
|
||||
L64xxManager.say_axis(axis);
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
char tmp[10];
|
||||
sprintf_P(tmp, PSTR("%4x "), status);
|
||||
DEBUG_ECHOPAIR(" status: ", tmp);
|
||||
print_bin(status);
|
||||
#else
|
||||
UNUSED(status);
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
};
|
||||
|
||||
char temp_buf[10];
|
||||
|
||||
switch (sh.STATUS_AXIS_LAYOUT) {
|
||||
case L6470_STATUS_LAYOUT: // L6470
|
||||
case L6480_STATUS_LAYOUT: { // L6480 & powerstep01
|
||||
const uint16_t Stall_Threshold = (uint8_t)motor.GetParam(L6470_STALL_TH),
|
||||
motor_status = (status & (STATUS_MOT_STATUS)) >> 5,
|
||||
L6470_ADC_out = motor.GetParam(L6470_ADC_OUT),
|
||||
L6470_ADC_out_limited = constrain(L6470_ADC_out, 8, 24);
|
||||
const float comp_coef = 1600.0f / L6470_ADC_out_limited;
|
||||
const uint16_t MicroSteps = _BV(motor.GetParam(L6470_STEP_MODE) & 0x07);
|
||||
|
||||
say_axis_status(axis, status);
|
||||
|
||||
SERIAL_ECHOPGM("...OverCurrent Threshold: ");
|
||||
sprintf_P(temp_buf, PSTR("%2d ("), OverCurrent_Threshold);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
SERIAL_ECHO((OverCurrent_Threshold + 1) * motor.OCD_CURRENT_CONSTANT_INV);
|
||||
SERIAL_ECHOPGM(" mA)");
|
||||
SERIAL_ECHOPGM(" Stall Threshold: ");
|
||||
sprintf_P(temp_buf, PSTR("%2d ("), Stall_Threshold);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
SERIAL_ECHO((Stall_Threshold + 1) * motor.STALL_CURRENT_CONSTANT_INV);
|
||||
SERIAL_ECHOPGM(" mA)");
|
||||
SERIAL_ECHOPGM(" Motor Status: ");
|
||||
switch (motor_status) {
|
||||
case 0: SERIAL_ECHOPGM("stopped"); break;
|
||||
case 1: SERIAL_ECHOPGM("accelerating"); break;
|
||||
case 2: SERIAL_ECHOPGM("decelerating"); break;
|
||||
case 3: SERIAL_ECHOPGM("at constant speed"); break;
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
||||
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_ECHOLNPAIR(" Compensation coefficient: ~", comp_coef * 0.01f);
|
||||
|
||||
SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD),
|
||||
" KVAL_RUN : ", motor.GetParam(L6470_KVAL_RUN),
|
||||
" KVAL_ACC: ", motor.GetParam(L6470_KVAL_ACC),
|
||||
" KVAL_DEC: ", motor.GetParam(L6470_KVAL_DEC),
|
||||
" V motor max = ");
|
||||
switch (motor_status) {
|
||||
case 0: SERIAL_ECHO(motor.GetParam(L6470_KVAL_HOLD) * 100 / 256); SERIAL_ECHOPGM("% (KVAL_HOLD)"); break;
|
||||
case 1: SERIAL_ECHO(motor.GetParam(L6470_KVAL_RUN) * 100 / 256); SERIAL_ECHOPGM("% (KVAL_RUN)"); break;
|
||||
case 2: SERIAL_ECHO(motor.GetParam(L6470_KVAL_ACC) * 100 / 256); SERIAL_ECHOPGM("% (KVAL_ACC)"); break;
|
||||
case 3: SERIAL_ECHO(motor.GetParam(L6470_KVAL_DEC) * 100 / 256); SERIAL_ECHOPGM("% (KVAL_HOLD)"); break;
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
DEBUG_ECHOPGM("...SLEW RATE: ");
|
||||
switch (sh.STATUS_AXIS_LAYOUT) {
|
||||
case L6470_STATUS_LAYOUT: {
|
||||
switch ((motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_POW_SR) >> CONFIG_POW_SR_BIT) {
|
||||
case 0: { DEBUG_ECHOLNPGM("320V/uS") ; break; }
|
||||
case 1: { DEBUG_ECHOLNPGM("75V/uS") ; break; }
|
||||
case 2: { DEBUG_ECHOLNPGM("110V/uS") ; break; }
|
||||
case 3: { DEBUG_ECHOLNPGM("260V/uS") ; break; }
|
||||
}
|
||||
break;
|
||||
}
|
||||
case L6480_STATUS_LAYOUT: {
|
||||
switch (motor.GetParam(L6470_GATECFG1) & CONFIG1_SR ) {
|
||||
case CONFIG1_SR_220V_us: { DEBUG_ECHOLNPGM("220V/uS") ; break; }
|
||||
case CONFIG1_SR_400V_us: { DEBUG_ECHOLNPGM("400V/uS") ; break; }
|
||||
case CONFIG1_SR_520V_us: { DEBUG_ECHOLNPGM("520V/uS") ; break; }
|
||||
case CONFIG1_SR_980V_us: { DEBUG_ECHOLNPGM("980V/uS") ; break; }
|
||||
default: { DEBUG_ECHOLNPGM("unknown") ; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
break;
|
||||
}
|
||||
|
||||
case L6474_STATUS_LAYOUT: { // L6474
|
||||
const uint16_t L6470_ADC_out = motor.GetParam(L6470_ADC_OUT) & 0x1F,
|
||||
L6474_TVAL_val = motor.GetParam(L6474_TVAL) & 0x7F;
|
||||
|
||||
say_axis_status(axis, status);
|
||||
|
||||
SERIAL_ECHOPGM("...OverCurrent Threshold: ");
|
||||
sprintf_P(temp_buf, PSTR("%2d ("), OverCurrent_Threshold);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
SERIAL_ECHO((OverCurrent_Threshold + 1) * motor.OCD_CURRENT_CONSTANT_INV);
|
||||
SERIAL_ECHOPGM(" mA)");
|
||||
SERIAL_ECHOPGM(" TVAL: ");
|
||||
sprintf_P(temp_buf, PSTR("%2d ("), L6474_TVAL_val);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
SERIAL_ECHO((L6474_TVAL_val + 1) * motor.STALL_CURRENT_CONSTANT_INV);
|
||||
SERIAL_ECHOLNPGM(" mA Motor Status: NA)");
|
||||
|
||||
const uint16_t MicroSteps = _BV(motor.GetParam(L6470_STEP_MODE) & 0x07); //NOMORE(MicroSteps, 16);
|
||||
SERIAL_ECHOLNPAIR("...MicroSteps: ", MicroSteps,
|
||||
" ADC_OUT: ", L6470_ADC_out,
|
||||
" Vs_compensation: NA");
|
||||
|
||||
SERIAL_EOL();
|
||||
|
||||
SERIAL_ECHOLNPGM("...KVAL_HOLD: NA"
|
||||
" KVAL_RUN : NA"
|
||||
" KVAL_ACC: NA"
|
||||
" KVAL_DEC: NA"
|
||||
" V motor max = NA");
|
||||
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
DEBUG_ECHOPGM("...SLEW RATE: ");
|
||||
switch ((motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_POW_SR) >> CONFIG_POW_SR_BIT) {
|
||||
case 0: DEBUG_ECHOLNPGM("320V/uS") ; break;
|
||||
case 1: DEBUG_ECHOLNPGM("75V/uS") ; break;
|
||||
case 2: DEBUG_ECHOLNPGM("110V/uS") ; break;
|
||||
case 3: DEBUG_ECHOLNPGM("260V/uS") ; break;
|
||||
default: DEBUG_ECHOLNPAIR("slew rate: ", (motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_POW_SR) >> CONFIG_POW_SR_BIT); break;
|
||||
}
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
SERIAL_EOL();
|
||||
break;
|
||||
}
|
||||
}
|
||||
serialprintPGM(stat_str);
|
||||
SERIAL_EOL();
|
||||
|
||||
SERIAL_ECHOPAIR("...microsteps: ", microsteps);
|
||||
SERIAL_ECHOPAIR(" ADC_OUT: ", adc_out);
|
||||
SERIAL_ECHOPGM(" Vs_compensation: ");
|
||||
serialprintPGM((motor.GetParam(L6470_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED"));
|
||||
|
||||
SERIAL_ECHOLNPAIR(" Compensation coefficient: ", dtostrf(comp_coef * 0.01f, 7, 2, numstr));
|
||||
SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD));
|
||||
SERIAL_ECHOPAIR(" KVAL_RUN : ", motor.GetParam(L6470_KVAL_RUN));
|
||||
SERIAL_ECHOPAIR(" KVAL_ACC: ", motor.GetParam(L6470_KVAL_ACC));
|
||||
SERIAL_ECHOPAIR(" KVAL_DEC: ", motor.GetParam(L6470_KVAL_DEC));
|
||||
SERIAL_ECHOPGM(" V motor max = ");
|
||||
float val;
|
||||
PGM_P suf;
|
||||
switch (motor_status) {
|
||||
case 0:
|
||||
val = motor.GetParam(L6470_KVAL_HOLD);
|
||||
suf = PSTR("(KVAL_HOLD)");
|
||||
break;
|
||||
case 1:
|
||||
val = motor.GetParam(L6470_KVAL_RUN);
|
||||
suf = PSTR("(KVAL_RUN)");
|
||||
break;
|
||||
case 2:
|
||||
val = motor.GetParam(L6470_KVAL_ACC);
|
||||
suf = PSTR("(KVAL_ACC)");
|
||||
break;
|
||||
case 3:
|
||||
val = motor.GetParam(L6470_KVAL_DEC);
|
||||
suf = PSTR("(KVAL_DEC)");
|
||||
break;
|
||||
}
|
||||
SERIAL_ECHO(dtostrf(val * 100 / 256, 10, 2, numstr));
|
||||
SERIAL_ECHOPGM("%% ");
|
||||
serialprintPGM(suf);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
void GcodeSuite::M906() {
|
||||
#define L6470_SET_KVAL_HOLD(Q) stepper##Q.SetParam(L6470_KVAL_HOLD, value)
|
||||
|
||||
L64xxManager.pause_monitor(true); // Keep monitor_driver() from stealing status
|
||||
|
||||
#define L6470_SET_KVAL_HOLD(Q) (AXIS_IS_L64XX(Q) ? stepper##Q.setTVALCurrent(value) : stepper##Q.SetParam(L6470_KVAL_HOLD, uint8_t(value)))
|
||||
|
||||
DEBUG_ECHOLNPGM("M906");
|
||||
|
||||
bool report_current = true;
|
||||
uint8_t report_current = true;
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
const uint8_t index = parser.byteval('I');
|
||||
#endif
|
||||
|
||||
LOOP_XYZE(i) if (uint8_t value = parser.byteval(axis_codes[i])) {
|
||||
LOOP_XYZE(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
|
||||
report_current = false;
|
||||
|
||||
if (planner.has_blocks_queued() || planner.cleaning_buffer_counter) {
|
||||
SERIAL_ECHOLNPGM("!Can't set KVAL_HOLD with steppers moving");
|
||||
SERIAL_ECHOLNPGM("Test aborted. Can't set KVAL_HOLD while steppers are moving.");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case X_AXIS:
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
#if AXIS_IS_L64XX(X)
|
||||
if (index == 0) L6470_SET_KVAL_HOLD(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
#if AXIS_IS_L64XX(X2)
|
||||
if (index == 1) L6470_SET_KVAL_HOLD(X2);
|
||||
#endif
|
||||
break;
|
||||
case Y_AXIS:
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
#if AXIS_IS_L64XX(Y)
|
||||
if (index == 0) L6470_SET_KVAL_HOLD(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
#if AXIS_IS_L64XX(Y2)
|
||||
if (index == 1) L6470_SET_KVAL_HOLD(Y2);
|
||||
#endif
|
||||
break;
|
||||
case Z_AXIS:
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
#if AXIS_IS_L64XX(Z)
|
||||
if (index == 0) L6470_SET_KVAL_HOLD(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
#if AXIS_IS_L64XX(Z2)
|
||||
if (index == 1) L6470_SET_KVAL_HOLD(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
#if AXIS_IS_L64XX(Z3)
|
||||
if (index == 2) L6470_SET_KVAL_HOLD(Z3);
|
||||
#endif
|
||||
break;
|
||||
@@ -208,22 +279,22 @@ void GcodeSuite::M906() {
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
switch (target_extruder) {
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
case 0: L6470_SET_KVAL_HOLD(E0); break;
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
#if AXIS_IS_L64XX(E1)
|
||||
case 1: L6470_SET_KVAL_HOLD(E1); break;
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
#if AXIS_IS_L64XX(E2)
|
||||
case 2: L6470_SET_KVAL_HOLD(E2); break;
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
#if AXIS_IS_L64XX(E3)
|
||||
case 3: L6470_SET_KVAL_HOLD(E3); break;
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
#if AXIS_IS_L64XX(E4)
|
||||
case 4: L6470_SET_KVAL_HOLD(E4); break;
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
#if AXIS_IS_L64XX(E5)
|
||||
case 5: L6470_SET_KVAL_HOLD(E5); break;
|
||||
#endif
|
||||
}
|
||||
@@ -234,51 +305,52 @@ void GcodeSuite::M906() {
|
||||
if (report_current) {
|
||||
#define L6470_REPORT_CURRENT(Q) L6470_report_current(stepper##Q, Q)
|
||||
|
||||
L6470.spi_active = true; // let set_directions() know we're in the middle of a series of SPI transfers
|
||||
L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
#if AXIS_IS_L64XX(X)
|
||||
L6470_REPORT_CURRENT(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
#if AXIS_IS_L64XX(X2)
|
||||
L6470_REPORT_CURRENT(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
#if AXIS_IS_L64XX(Y)
|
||||
L6470_REPORT_CURRENT(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
#if AXIS_IS_L64XX(Y2)
|
||||
L6470_REPORT_CURRENT(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
#if AXIS_IS_L64XX(Z)
|
||||
L6470_REPORT_CURRENT(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
#if AXIS_IS_L64XX(Z2)
|
||||
L6470_REPORT_CURRENT(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
#if AXIS_IS_L64XX(Z3)
|
||||
L6470_REPORT_CURRENT(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
L6470_REPORT_CURRENT(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
#if AXIS_IS_L64XX(E1)
|
||||
L6470_REPORT_CURRENT(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
#if AXIS_IS_L64XX(E2)
|
||||
L6470_REPORT_CURRENT(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
#if AXIS_IS_L64XX(E3)
|
||||
L6470_REPORT_CURRENT(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
#if AXIS_IS_L64XX(E4)
|
||||
L6470_REPORT_CURRENT(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
#if AXIS_IS_L64XX(E5)
|
||||
L6470_REPORT_CURRENT(E5);
|
||||
#endif
|
||||
|
||||
L6470.spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
L6470.spi_abort = false;
|
||||
L64xxManager.spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
L64xxManager.spi_abort = false;
|
||||
L64xxManager.pause_monitor(false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAS_DRIVER(L6470)
|
||||
#endif // HAS_L64XX
|
||||
|
||||
@@ -20,35 +20,26 @@
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// NOTE: All tests assume each axis uses matching driver chips.
|
||||
//
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../module/stepper/indirection.h"
|
||||
#include "../../../module/planner.h"
|
||||
#include "../../../libs/L6470/L6470_Marlin.h"
|
||||
#include "../../../libs/L64XX/L64XX_Marlin.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
static void jiggle_axis(const char axis_char, const float &min, const float &max, const feedRate_t &fr_mm_m) {
|
||||
char gcode_string[30], str1[11], str2[11];
|
||||
|
||||
// Turn the motor(s) both directions
|
||||
sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(min, 1, 3, str1), dtostrf(fr_mm_m, 1, 3, str2));
|
||||
gcode.process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(max, 1, 3, str1), str2);
|
||||
gcode.process_subcommands_now(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* M916: Increase KVAL_HOLD until thermal warning
|
||||
*
|
||||
* M916: increase KVAL_HOLD until get thermal warning
|
||||
* NOTE - on L6474 it is TVAL that is used
|
||||
*
|
||||
* J - select which driver(s) to monitor on multi-driver axis
|
||||
* 0 - (default) monitor all drivers on the axis or E0
|
||||
@@ -62,8 +53,14 @@ static void jiggle_axis(const char axis_char, const float &min, const float &max
|
||||
* F - feedrate
|
||||
* optional - will use default max feedrate from configuration.h if not specified
|
||||
*
|
||||
* K - starting value for KVAL_HOLD (0 - 255)
|
||||
* optional - will use & report current value from driver if not specified
|
||||
* T - current (mA) setting for TVAL (0 - 4A in 31.25mA increments, rounds down) - L6474 only
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* K - value for KVAL_HOLD (0 - 255) (ignored for L6474)
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* D - time (in seconds) to run each setting of KVAL_HOLD/TVAL
|
||||
* optional - defaults to zero (runs each setting once)
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -77,80 +74,115 @@ void GcodeSuite::M916() {
|
||||
|
||||
DEBUG_ECHOLNPGM("M916");
|
||||
|
||||
// Variables used by L6470_get_user_input function - some may not be used
|
||||
char axis_mon[3][3] = { " ", " ", " " }; // list of Axes to be monitored
|
||||
uint8_t axis_index[3];
|
||||
L64xxManager.pause_monitor(true); // Keep monitor_driver() from stealing status
|
||||
|
||||
// Variables used by L64xxManager.get_user_input function - some may not be used
|
||||
char axis_mon[3][3] = { {" "}, {" "}, {" "} }; // list of Axes to be monitored
|
||||
L64XX_axis_t axis_index[3];
|
||||
uint16_t axis_status[3];
|
||||
uint8_t driver_count = 1;
|
||||
float position_max;
|
||||
float position_min;
|
||||
feedRate_t final_fr_mm_m;
|
||||
float final_feedrate;
|
||||
uint8_t kval_hold;
|
||||
uint8_t ocd_th_val = 0;
|
||||
uint8_t stall_th_val = 0;
|
||||
uint8_t OCD_TH_val = 0;
|
||||
uint8_t STALL_TH_val = 0;
|
||||
uint16_t over_current_threshold;
|
||||
constexpr bool over_current_flag = false; // M916 doesn't play with the overcurrent thresholds
|
||||
constexpr uint8_t over_current_flag = false; // M916 doesn't play with the overcurrent thresholds
|
||||
|
||||
#define DRIVER_TYPE_L6474(Q) AXIS_DRIVER_TYPE_##Q(L6474)
|
||||
|
||||
uint8_t j; // general purpose counter
|
||||
|
||||
if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_fr_mm_m, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
|
||||
if (L64xxManager.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, OCD_TH_val, STALL_TH_val, over_current_threshold))
|
||||
return; // quit if invalid user input
|
||||
|
||||
DEBUG_ECHOLNPAIR("feedrate = ", final_fr_mm_m);
|
||||
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
|
||||
|
||||
planner.synchronize(); // Wait for moves to finish
|
||||
planner.synchronize(); // wait for all current movement commands to complete
|
||||
|
||||
const L64XX_Marlin::L64XX_shadow_t &sh = L64xxManager.shadow;
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.get_status(axis_index[j]); // Clear out error flags
|
||||
L64xxManager.get_status(axis_index[j]); // clear out any pre-existing error flags
|
||||
|
||||
char temp_axis_string[] = " ";
|
||||
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
||||
char gcode_string[80];
|
||||
uint16_t status_composite = 0;
|
||||
|
||||
uint16_t M91x_counter = kval_hold;
|
||||
uint16_t M91x_counter_max;
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT) {
|
||||
M91x_counter_max = 128; // TVAL is 7 bits
|
||||
LIMIT(M91x_counter, 0U, 127U);
|
||||
}
|
||||
else
|
||||
M91x_counter_max = 256; // KVAL_HOLD is 8 bits
|
||||
|
||||
uint8_t M91x_delay_s = parser.byteval('D'); // get delay in seconds
|
||||
millis_t M91x_delay_ms = M91x_delay_s * 60 * 1000;
|
||||
millis_t M91x_delay_end;
|
||||
|
||||
DEBUG_ECHOLNPGM(".\n.");
|
||||
|
||||
do {
|
||||
|
||||
DEBUG_ECHOLNPAIR("kval_hold = ", kval_hold); // set & report KVAL_HOLD for this run
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT)
|
||||
DEBUG_ECHOLNPAIR("TVAL current (mA) = ", (M91x_counter + 1) * sh.AXIS_STALL_CURRENT_CONSTANT_INV); // report TVAL current for this run
|
||||
else
|
||||
DEBUG_ECHOLNPAIR("kval_hold = ", M91x_counter); // report KVAL_HOLD for this run
|
||||
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
L64xxManager.set_param(axis_index[j], L6470_KVAL_HOLD, M91x_counter); //set KVAL_HOLD or TVAL (same register address)
|
||||
|
||||
// Turn the motor(s) both directions
|
||||
jiggle_axis(axis_mon[0][0], position_min, position_max, final_fr_mm_m);
|
||||
M91x_delay_end = millis() + M91x_delay_ms;
|
||||
do {
|
||||
// turn the motor(s) both directions
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_min), uint16_t(final_feedrate));
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
|
||||
status_composite = 0; // clear out the old bits
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_max), uint16_t(final_feedrate));
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK; // bits of interest are all active low
|
||||
status_composite |= axis_status[j] ;
|
||||
}
|
||||
// get the status after the motors have stopped
|
||||
planner.synchronize();
|
||||
|
||||
status_composite = 0; // clear out the old bits
|
||||
|
||||
if (status_composite && (status_composite & STATUS_UVLO)) {
|
||||
DEBUG_ECHOLNPGM("Test aborted (Undervoltage lockout active)");
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
DEBUG_ECHOPGM("...");
|
||||
L6470.error_status_decode(axis_status[j], axis_index[j]);
|
||||
axis_status[j] = (~L64xxManager.get_status(axis_index[j])) & sh.L6470_ERROR_MASK; // bits of interest are all active low
|
||||
status_composite |= axis_status[j] ;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// increment KVAL_HOLD if not yet at thermal warning/shutdown
|
||||
if (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD)))
|
||||
kval_hold++;
|
||||
if (status_composite) break;
|
||||
} while (millis() < M91x_delay_end);
|
||||
|
||||
} while (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) && kval_hold); // exit when kval_hold == 0 (rolls over)
|
||||
if (status_composite) break;
|
||||
|
||||
DEBUG_ECHOPGM(".\n.\nThermal warning/shutdown ");
|
||||
if ((status_composite & (STATUS_TH_WRN | STATUS_TH_SD))) {
|
||||
DEBUG_ECHOLNPGM("has occurred");
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
DEBUG_ECHOPGM("...");
|
||||
L6470.error_status_decode(axis_status[j], axis_index[j]);
|
||||
}
|
||||
}
|
||||
else
|
||||
DEBUG_ECHOLNPGM("(Unable to get)");
|
||||
M91x_counter++;
|
||||
|
||||
} while (!(status_composite & (sh.STATUS_AXIS_TH_WRN | sh.STATUS_AXIS_TH_SD)) && (M91x_counter < M91x_counter_max));
|
||||
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
if (status_composite) {
|
||||
L64xxManager.error_status_decode(status_composite, axis_index[0],
|
||||
sh.STATUS_AXIS_TH_SD, sh.STATUS_AXIS_TH_WRN,
|
||||
sh.STATUS_AXIS_STEP_LOSS_A, sh.STATUS_AXIS_STEP_LOSS_B,
|
||||
sh.STATUS_AXIS_OCD, sh.STATUS_AXIS_LAYOUT);
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((status_composite & (sh.STATUS_AXIS_TH_WRN | sh.STATUS_AXIS_TH_SD)))
|
||||
DEBUG_ECHOLNPGM(".\n.\nTest completed normally - Thermal warning/shutdown has occurred");
|
||||
else if (status_composite)
|
||||
DEBUG_ECHOLNPGM(".\n.\nTest completed abnormally - non-thermal error has occured");
|
||||
else
|
||||
DEBUG_ECHOLNPGM(".\n.\nTest completed normally - Unable to get to thermal warning/shutdown");
|
||||
|
||||
L64xxManager.pause_monitor(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,8 +191,8 @@ void GcodeSuite::M916() {
|
||||
*
|
||||
* Decrease OCD current until overcurrent error
|
||||
* Increase OCD until overcurrent error goes away
|
||||
* Decrease stall threshold until stall
|
||||
* Increase stall until stall error goes away
|
||||
* Decrease stall threshold until stall (not done on L6474)
|
||||
* Increase stall until stall error goes away (not done on L6474)
|
||||
*
|
||||
* J - select which driver(s) to monitor on multi-driver axis
|
||||
* 0 - (default) monitor all drivers on the axis or E0
|
||||
@@ -176,7 +208,10 @@ void GcodeSuite::M916() {
|
||||
* optional - will report current value from driver if not specified
|
||||
* if there are multiple drivers on the axis then all will be set the same
|
||||
*
|
||||
* K - value for KVAL_HOLD (0 - 255)
|
||||
* T - current (mA) setting for TVAL (0 - 4A in 31.25mA increments, rounds down) - L6474 only
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* K - value for KVAL_HOLD (0 - 255) (ignored for L6474)
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
*/
|
||||
@@ -184,66 +219,85 @@ void GcodeSuite::M917() {
|
||||
|
||||
DEBUG_ECHOLNPGM("M917");
|
||||
|
||||
char axis_mon[3][3] = { " ", " ", " " }; // list of axes to be monitored
|
||||
uint8_t axis_index[3];
|
||||
L64xxManager.pause_monitor(true); // Keep monitor_driver() from stealing status
|
||||
|
||||
char axis_mon[3][3] = { {" "}, {" "}, {" "} }; // list of Axes to be monitored
|
||||
L64XX_axis_t axis_index[3];
|
||||
uint16_t axis_status[3];
|
||||
uint8_t driver_count = 1;
|
||||
float position_max;
|
||||
float position_min;
|
||||
feedRate_t final_fr_mm_m;
|
||||
float final_feedrate;
|
||||
uint8_t kval_hold;
|
||||
uint8_t ocd_th_val = 0;
|
||||
uint8_t stall_th_val = 0;
|
||||
uint8_t OCD_TH_val = 0;
|
||||
uint8_t STALL_TH_val = 0;
|
||||
uint16_t over_current_threshold;
|
||||
constexpr bool over_current_flag = true;
|
||||
constexpr uint8_t over_current_flag = true;
|
||||
|
||||
uint8_t j; // general purpose counter
|
||||
|
||||
if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_fr_mm_m, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
|
||||
if (L64xxManager.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, OCD_TH_val, STALL_TH_val, over_current_threshold))
|
||||
return; // quit if invalid user input
|
||||
|
||||
DEBUG_ECHOLNPAIR("feedrate = ", final_fr_mm_m);
|
||||
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
|
||||
|
||||
planner.synchronize(); // Wait for moves to finish
|
||||
planner.synchronize(); // wait for all current movement commands to complete
|
||||
|
||||
const L64XX_Marlin::L64XX_shadow_t &sh = L64xxManager.shadow;
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.get_status(axis_index[j]); // Clear out error flags
|
||||
L64xxManager.get_status(axis_index[j]); // clear error flags
|
||||
char temp_axis_string[] = " ";
|
||||
temp_axis_string[0] = axis_mon[0][0]; // need a sprintf format string
|
||||
char gcode_string[80];
|
||||
uint16_t status_composite = 0;
|
||||
uint8_t test_phase = 0;
|
||||
// 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL)
|
||||
// 1 - increasing OCD - exit when OCD warning stops (ignore STALL) -
|
||||
// 2 - OCD finalized - decreasing STALL - exit when STALL warning happens
|
||||
// 3 - OCD finalized - increasing STALL - exit when STALL warning stop
|
||||
// 4 - all testing completed
|
||||
DEBUG_ECHOPAIR(".\n.\n.\nover_current threshold : ", (ocd_th_val + 1) * 375); // first status display
|
||||
DEBUG_ECHOPAIR(" (OCD_TH: : ", ocd_th_val);
|
||||
DEBUG_ECHOPAIR(") Stall threshold: ", (stall_th_val + 1) * 31.25);
|
||||
DEBUG_ECHOPAIR(" (STALL_TH: ", stall_th_val);
|
||||
uint8_t test_phase = 0; // 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL)
|
||||
// 1 - increasing OCD - exit when OCD warning stops (ignore STALL)
|
||||
// 2 - OCD finalized - decreasing STALL - exit when STALL warning happens
|
||||
// 3 - OCD finalized - increasing STALL - exit when STALL warning stop
|
||||
// 4 - all testing completed
|
||||
DEBUG_ECHOPAIR(".\n.\n.\nover_current threshold : ", (OCD_TH_val + 1) * 375); // first status display
|
||||
DEBUG_ECHOPAIR(" (OCD_TH: : ", OCD_TH_val);
|
||||
if (sh.STATUS_AXIS_LAYOUT != L6474_STATUS_LAYOUT) {
|
||||
DEBUG_ECHOPAIR(") Stall threshold: ", (STALL_TH_val + 1) * 31.25);
|
||||
DEBUG_ECHOPAIR(" (STALL_TH: ", STALL_TH_val);
|
||||
}
|
||||
DEBUG_ECHOLNPGM(")");
|
||||
|
||||
do {
|
||||
|
||||
DEBUG_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25);
|
||||
DEBUG_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375);
|
||||
if (sh.STATUS_AXIS_LAYOUT != L6474_STATUS_LAYOUT) DEBUG_ECHOPAIR("STALL threshold : ", (STALL_TH_val + 1) * 31.25);
|
||||
DEBUG_ECHOLNPAIR(" OCD threshold : ", (OCD_TH_val + 1) * 375);
|
||||
|
||||
jiggle_axis(axis_mon[0][0], position_min, position_max, final_fr_mm_m);
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_min), uint16_t(final_feedrate));
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_max), uint16_t(final_feedrate));
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
|
||||
status_composite = 0; // clear out the old bits
|
||||
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK; // bits of interest are all active low
|
||||
axis_status[j] = (~L64xxManager.get_status(axis_index[j])) & sh.L6470_ERROR_MASK; // bits of interest are all active low
|
||||
status_composite |= axis_status[j];
|
||||
}
|
||||
|
||||
if (status_composite && (status_composite & STATUS_UVLO)) {
|
||||
if (status_composite && (status_composite & sh.STATUS_AXIS_UVLO)) {
|
||||
DEBUG_ECHOLNPGM("Test aborted (Undervoltage lockout active)");
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
DEBUG_ECHOPGM("...");
|
||||
L6470.error_status_decode(axis_status[j], axis_index[j]);
|
||||
}
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
if (j) DEBUG_ECHOPGM("...");
|
||||
L64xxManager.error_status_decode(axis_status[j], axis_index[j],
|
||||
sh.STATUS_AXIS_TH_SD, sh.STATUS_AXIS_TH_WRN,
|
||||
sh.STATUS_AXIS_STEP_LOSS_A, sh.STATUS_AXIS_STEP_LOSS_B,
|
||||
sh.STATUS_AXIS_OCD, sh.STATUS_AXIS_LAYOUT);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) {
|
||||
if (status_composite & (sh.STATUS_AXIS_TH_WRN | sh.STATUS_AXIS_TH_SD)) {
|
||||
DEBUG_ECHOLNPGM("thermal problem - waiting for chip(s) to cool down ");
|
||||
uint16_t status_composite_temp = 0;
|
||||
uint8_t k = 0;
|
||||
@@ -251,118 +305,136 @@ void GcodeSuite::M917() {
|
||||
k++;
|
||||
if (!(k % 4)) {
|
||||
kval_hold *= 0.95;
|
||||
L6470_EOL();
|
||||
DEBUG_EOL();
|
||||
DEBUG_ECHOLNPAIR("Lowering KVAL_HOLD by about 5% to ", kval_hold);
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
L64xxManager.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
}
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
|
||||
watchdog_refresh();
|
||||
gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
|
||||
watchdog_refresh();; // beat the dog
|
||||
safe_delay(5000);
|
||||
status_composite_temp = 0;
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK; // bits of interest are all active low
|
||||
axis_status[j] = (~L64xxManager.get_status(axis_index[j])) & sh.L6470_ERROR_MASK; // bits of interest are all active low
|
||||
status_composite_temp |= axis_status[j];
|
||||
}
|
||||
}
|
||||
while (status_composite_temp & (STATUS_TH_WRN | STATUS_TH_SD));
|
||||
L6470_EOL();
|
||||
while (status_composite_temp & (sh.STATUS_AXIS_TH_WRN | sh.STATUS_AXIS_TH_SD));
|
||||
DEBUG_EOL();
|
||||
}
|
||||
if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B | STATUS_OCD)) {
|
||||
if (status_composite & (sh.STATUS_AXIS_STEP_LOSS_A | sh.STATUS_AXIS_STEP_LOSS_B | sh.STATUS_AXIS_OCD)) {
|
||||
switch (test_phase) {
|
||||
|
||||
case 0: {
|
||||
if (status_composite & STATUS_OCD) {
|
||||
if (status_composite & sh.STATUS_AXIS_OCD) {
|
||||
// phase 0 with OCD warning - time to go to next phase
|
||||
if (ocd_th_val >=15) {
|
||||
ocd_th_val = 15; // limit to max
|
||||
if (OCD_TH_val >= sh.AXIS_OCD_TH_MAX) {
|
||||
OCD_TH_val = sh.AXIS_OCD_TH_MAX; // limit to max
|
||||
test_phase = 2; // at highest value so skip phase 1
|
||||
DEBUG_ECHOLNPGM("LOGIC E0A OCD at highest - skip to 2");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E0A OCD at highest - skip to 2");
|
||||
DEBUG_ECHOLNPGM("OCD at highest - OCD finalized");
|
||||
}
|
||||
else {
|
||||
ocd_th_val++; // normal exit to next phase
|
||||
OCD_TH_val++; // normal exit to next phase
|
||||
test_phase = 1; // setup for first pass of phase 1
|
||||
DEBUG_ECHOLNPGM("LOGIC E0B - inc OCD & go to 1");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E0B - inc OCD & go to 1");
|
||||
DEBUG_ECHOLNPGM("inc OCD");
|
||||
}
|
||||
}
|
||||
else { // phase 0 without OCD warning - keep on decrementing if can
|
||||
if (ocd_th_val) {
|
||||
ocd_th_val--; // try lower value
|
||||
DEBUG_ECHOLNPGM("LOGIC E0C - dec OCD");
|
||||
if (OCD_TH_val) {
|
||||
OCD_TH_val--; // try lower value
|
||||
//DEBUG_ECHOLNPGM("LOGIC E0C - dec OCD");
|
||||
DEBUG_ECHOLNPGM("dec OCD");
|
||||
}
|
||||
else {
|
||||
test_phase = 2; // at lowest value without warning so skip phase 1
|
||||
DEBUG_ECHOLNPGM("LOGIC E0D - OCD at latest - go to 2");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E0D - OCD at latest - go to 2");
|
||||
DEBUG_ECHOLNPGM("OCD finalized");
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: {
|
||||
if (status_composite & STATUS_OCD) {
|
||||
if (status_composite & sh.STATUS_AXIS_OCD) {
|
||||
// phase 1 with OCD warning - increment if can
|
||||
if (ocd_th_val >= 15) {
|
||||
ocd_th_val = 15; // limit to max
|
||||
if (OCD_TH_val >= sh.AXIS_OCD_TH_MAX) {
|
||||
OCD_TH_val = sh.AXIS_OCD_TH_MAX; // limit to max
|
||||
test_phase = 2; // at highest value so go to next phase
|
||||
DEBUG_ECHOLNPGM("LOGIC E1A - OCD at max - go to 2");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E1A - OCD at max - go to 2");
|
||||
DEBUG_ECHOLNPGM("OCD finalized");
|
||||
}
|
||||
else {
|
||||
ocd_th_val++; // try a higher value
|
||||
DEBUG_ECHOLNPGM("LOGIC E1B - inc OCD");
|
||||
OCD_TH_val++; // try a higher value
|
||||
//DEBUG_ECHOLNPGM("LOGIC E1B - inc OCD");
|
||||
DEBUG_ECHOLNPGM("inc OCD");
|
||||
}
|
||||
}
|
||||
else { // phase 1 without OCD warning - normal exit to phase 2
|
||||
test_phase = 2;
|
||||
DEBUG_ECHOLNPGM("LOGIC E1C - no OCD warning - go to 1");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E1C - no OCD warning - go to 1");
|
||||
DEBUG_ECHOLNPGM("OCD finalized");
|
||||
}
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) {
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT) { // skip all STALL_TH steps if L6474
|
||||
test_phase = 4;
|
||||
break;
|
||||
}
|
||||
if (status_composite & (sh.STATUS_AXIS_STEP_LOSS_A | sh.STATUS_AXIS_STEP_LOSS_B)) {
|
||||
// phase 2 with stall warning - time to go to next phase
|
||||
if (stall_th_val >= 127) {
|
||||
stall_th_val = 127; // limit to max
|
||||
DEBUG_ECHOLNPGM("LOGIC E2A - STALL warning, STALL at max, quit");
|
||||
if (STALL_TH_val >= 127) {
|
||||
STALL_TH_val = 127; // limit to max
|
||||
//DEBUG_ECHOLNPGM("LOGIC E2A - STALL warning, STALL at max, quit");
|
||||
DEBUG_ECHOLNPGM("finished - STALL at maximum value but still have stall warning");
|
||||
test_phase = 4;
|
||||
}
|
||||
else {
|
||||
test_phase = 3; // normal exit to next phase (found failing value of STALL)
|
||||
stall_th_val++; // setup for first pass of phase 3
|
||||
DEBUG_ECHOLNPGM("LOGIC E2B - INC - STALL warning, inc Stall, go to 3");
|
||||
STALL_TH_val++; // setup for first pass of phase 3
|
||||
//DEBUG_ECHOLNPGM("LOGIC E2B - INC - STALL warning, inc Stall, go to 3");
|
||||
DEBUG_ECHOLNPGM("inc Stall");
|
||||
}
|
||||
}
|
||||
else { // phase 2 without stall warning - decrement if can
|
||||
if (stall_th_val) {
|
||||
stall_th_val--; // try a lower value
|
||||
DEBUG_ECHOLNPGM("LOGIC E2C - no STALL, dec STALL");
|
||||
if (STALL_TH_val) {
|
||||
STALL_TH_val--; // try a lower value
|
||||
//DEBUG_ECHOLNPGM("LOGIC E2C - no STALL, dec STALL");
|
||||
DEBUG_ECHOLNPGM("dec STALL");
|
||||
}
|
||||
else {
|
||||
DEBUG_ECHOLNPGM("finished - STALL at lowest value but still do NOT have stall warning");
|
||||
test_phase = 4;
|
||||
DEBUG_ECHOLNPGM("LOGIC E2D - no STALL, at lowest so quit");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E2D - no STALL, at lowest so quit");
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) {
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT) { // skip all STALL_TH steps if L6474
|
||||
test_phase = 4;
|
||||
break;
|
||||
}
|
||||
if (status_composite & (sh.STATUS_AXIS_STEP_LOSS_A | sh.STATUS_AXIS_STEP_LOSS_B)) {
|
||||
// phase 3 with stall warning - increment if can
|
||||
if (stall_th_val >= 127) {
|
||||
stall_th_val = 127; // limit to max
|
||||
if (STALL_TH_val >= 127) {
|
||||
STALL_TH_val = 127; // limit to max
|
||||
DEBUG_ECHOLNPGM("finished - STALL at maximum value but still have stall warning");
|
||||
test_phase = 4;
|
||||
DEBUG_ECHOLNPGM("LOGIC E3A - STALL, at max so quit");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E3A - STALL, at max so quit");
|
||||
}
|
||||
else {
|
||||
stall_th_val++; // still looking for passing value
|
||||
DEBUG_ECHOLNPGM("LOGIC E3B - STALL, inc stall");
|
||||
STALL_TH_val++; // still looking for passing value
|
||||
//DEBUG_ECHOLNPGM("LOGIC E3B - STALL, inc stall");
|
||||
DEBUG_ECHOLNPGM("inc stall");
|
||||
}
|
||||
}
|
||||
else { //phase 3 without stall warning but have OCD warning
|
||||
DEBUG_ECHOLNPGM("Hardware problem - OCD warning without STALL warning");
|
||||
test_phase = 4;
|
||||
DEBUG_ECHOLNPGM("LOGIC E3C - not STALLED, hardware problem (quit)");
|
||||
//DEBUG_ECHOLNPGM("LOGIC E3C - not STALLED, hardware problem (quit)");
|
||||
}
|
||||
} break;
|
||||
|
||||
@@ -372,58 +444,81 @@ void GcodeSuite::M917() {
|
||||
else {
|
||||
switch (test_phase) {
|
||||
case 0: { // phase 0 without OCD warning - keep on decrementing if can
|
||||
if (ocd_th_val) {
|
||||
ocd_th_val--; // try lower value
|
||||
DEBUG_ECHOLNPGM("LOGIC N0A - DEC OCD");
|
||||
if (OCD_TH_val) {
|
||||
OCD_TH_val--; // try lower value
|
||||
//DEBUG_ECHOLNPGM("LOGIC N0A - DEC OCD");
|
||||
DEBUG_ECHOLNPGM("DEC OCD");
|
||||
}
|
||||
else {
|
||||
test_phase = 2; // at lowest value without warning so skip phase 1
|
||||
DEBUG_ECHOLNPGM("LOGIC N0B - OCD at lowest (go to phase 2)");
|
||||
//DEBUG_ECHOLNPGM("LOGIC N0B - OCD at lowest (go to phase 2)");
|
||||
DEBUG_ECHOLNPGM("OCD finalized");
|
||||
}
|
||||
} break;
|
||||
|
||||
case 1: DEBUG_ECHOLNPGM("LOGIC N1 (go directly to 2)"); // phase 1 without OCD warning - drop directly to phase 2
|
||||
case 1: //DEBUG_ECHOLNPGM("LOGIC N1 (go directly to 2)"); // phase 1 without OCD warning - drop directly to phase 2
|
||||
DEBUG_ECHOLNPGM("OCD finalized");
|
||||
|
||||
case 2: { // phase 2 without stall warning - keep on decrementing if can
|
||||
if (stall_th_val) {
|
||||
stall_th_val--; // try a lower value (stay in phase 2)
|
||||
DEBUG_ECHOLNPGM("LOGIC N2B - dec STALL");
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT) { // skip all STALL_TH steps if L6474
|
||||
test_phase = 4;
|
||||
break;
|
||||
}
|
||||
if (STALL_TH_val) {
|
||||
STALL_TH_val--; // try a lower value (stay in phase 2)
|
||||
//DEBUG_ECHOLNPGM("LOGIC N2B - dec STALL");
|
||||
DEBUG_ECHOLNPGM("dec STALL");
|
||||
}
|
||||
else {
|
||||
DEBUG_ECHOLNPGM("finished - STALL at lowest value but still no stall warning");
|
||||
test_phase = 4;
|
||||
DEBUG_ECHOLNPGM("LOGIC N2C - STALL at lowest (quit)");
|
||||
//DEBUG_ECHOLNPGM("LOGIC N2C - STALL at lowest (quit)");
|
||||
}
|
||||
} break;
|
||||
|
||||
case 3: { test_phase = 4;
|
||||
DEBUG_ECHOLNPGM("LOGIC N3 - finished!");
|
||||
case 3: {
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT) { // skip all STALL_TH steps if L6474
|
||||
test_phase = 4;
|
||||
break;
|
||||
}
|
||||
test_phase = 4;
|
||||
//DEBUG_ECHOLNPGM("LOGIC N3 - finished!");
|
||||
DEBUG_ECHOLNPGM("finished!");
|
||||
} break; // phase 3 without any warnings - desired exit
|
||||
} //
|
||||
} // end of status checks
|
||||
|
||||
if (test_phase != 4) {
|
||||
for (j = 0; j < driver_count; j++) { // update threshold(s)
|
||||
L6470.set_param(axis_index[j], L6470_OCD_TH, ocd_th_val);
|
||||
L6470.set_param(axis_index[j], L6470_STALL_TH, stall_th_val);
|
||||
if (L6470.get_param(axis_index[j], L6470_OCD_TH) != ocd_th_val) DEBUG_ECHOLNPGM("OCD mismatch");
|
||||
if (L6470.get_param(axis_index[j], L6470_STALL_TH) != stall_th_val) DEBUG_ECHOLNPGM("STALL mismatch");
|
||||
L64xxManager.set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val);
|
||||
if (sh.STATUS_AXIS_LAYOUT != L6474_STATUS_LAYOUT) L64xxManager.set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val);
|
||||
if (L64xxManager.get_param(axis_index[j], L6470_OCD_TH) != OCD_TH_val) DEBUG_ECHOLNPGM("OCD mismatch");
|
||||
if ((L64xxManager.get_param(axis_index[j], L6470_STALL_TH) != STALL_TH_val) && (sh.STATUS_AXIS_LAYOUT != L6474_STATUS_LAYOUT)) DEBUG_ECHOLNPGM("STALL mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
} while (test_phase != 4);
|
||||
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
if (status_composite) {
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
if (j) DEBUG_ECHOPGM("...");
|
||||
L64xxManager.error_status_decode(axis_status[j], axis_index[j],
|
||||
sh.STATUS_AXIS_TH_SD, sh.STATUS_AXIS_TH_WRN,
|
||||
sh.STATUS_AXIS_STEP_LOSS_A, sh.STATUS_AXIS_STEP_LOSS_B,
|
||||
sh.STATUS_AXIS_OCD, sh.STATUS_AXIS_LAYOUT);
|
||||
}
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
#endif
|
||||
DEBUG_ECHOLNPGM("Completed with errors");
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
DEBUG_ECHOPGM("...");
|
||||
L6470.error_status_decode(axis_status[j], axis_index[j]);
|
||||
}
|
||||
}
|
||||
else
|
||||
DEBUG_ECHOLNPGM("Completed with no errors");
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
|
||||
} // M917
|
||||
L64xxManager.pause_monitor(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -439,7 +534,13 @@ void GcodeSuite::M917() {
|
||||
* I - over current threshold
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* K - value for KVAL_HOLD (0 - 255) (optional)
|
||||
* T - current (mA) setting for TVAL (0 - 4A in 31.25mA increments, rounds down) - L6474 only
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* K - value for KVAL_HOLD (0 - 255) (ignored for L6474)
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
* M - value for microsteps (1 - 128) (optional)
|
||||
* optional - will report current value from driver if not specified
|
||||
*
|
||||
*/
|
||||
@@ -447,83 +548,109 @@ void GcodeSuite::M918() {
|
||||
|
||||
DEBUG_ECHOLNPGM("M918");
|
||||
|
||||
char axis_mon[3][3] = { " ", " ", " " }; // List of axes to monitor
|
||||
uint8_t axis_index[3];
|
||||
L64xxManager.pause_monitor(true); // Keep monitor_driver() from stealing status
|
||||
|
||||
char axis_mon[3][3] = { {" "}, {" "}, {" "} }; // list of Axes to be monitored
|
||||
L64XX_axis_t axis_index[3];
|
||||
uint16_t axis_status[3];
|
||||
uint8_t driver_count = 1;
|
||||
float position_max, position_min;
|
||||
feedRate_t final_fr_mm_m;
|
||||
float final_feedrate;
|
||||
uint8_t kval_hold;
|
||||
uint8_t ocd_th_val = 0;
|
||||
uint8_t stall_th_val = 0;
|
||||
uint8_t OCD_TH_val = 0;
|
||||
uint8_t STALL_TH_val = 0;
|
||||
uint16_t over_current_threshold;
|
||||
constexpr bool over_current_flag = true;
|
||||
constexpr uint8_t over_current_flag = true;
|
||||
|
||||
const L64XX_Marlin::L64XX_shadow_t &sh = L64xxManager.shadow;
|
||||
|
||||
uint8_t j; // general purpose counter
|
||||
|
||||
if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_fr_mm_m, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
|
||||
if (L64xxManager.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, OCD_TH_val, STALL_TH_val, over_current_threshold))
|
||||
return; // quit if invalid user input
|
||||
|
||||
L64xxManager.get_status(axis_index[0]); // populate shadow array
|
||||
|
||||
uint8_t m_steps = parser.byteval('M');
|
||||
LIMIT(m_steps, 0, 128);
|
||||
DEBUG_ECHOLNPAIR("M = ", m_steps);
|
||||
|
||||
int8_t m_bits = -1;
|
||||
if (m_steps > 85) m_bits = 7; // 128 (no synch output)
|
||||
else if (m_steps > 42) m_bits = 6; // 64 (no synch output)
|
||||
else if (m_steps > 22) m_bits = 5; // 32 (no synch output)
|
||||
else if (m_steps > 12) m_bits = 4; // 16 (no synch output)
|
||||
else if (m_steps > 5) m_bits = 3; // 8 (no synch output)
|
||||
else if (m_steps > 2) m_bits = 2; // 4 (no synch output)
|
||||
else if (m_steps == 2) m_bits = 1; // 2 (no synch output)
|
||||
else if (m_steps == 1) m_bits = 0; // 1 (no synch output)
|
||||
else if (m_steps == 0) m_bits = 7; // 128 (no synch output)
|
||||
if (m_steps != 0) {
|
||||
LIMIT(m_steps, 1, sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT ? 16 : 128); // L6474
|
||||
|
||||
if (m_bits >= 0) {
|
||||
const int micros = _BV(m_bits);
|
||||
if (micros < 100) { DEBUG_CHAR(' '); if (micros < 10) DEBUG_CHAR(' '); }
|
||||
DEBUG_ECHO(micros);
|
||||
DEBUG_ECHOPGM(" uSTEPS");
|
||||
}
|
||||
uint8_t stepVal;
|
||||
for (stepVal = 0; stepVal < 8; stepVal++) { // convert to L64xx register value
|
||||
if (m_steps == 1) break;
|
||||
m_steps >>= 1;
|
||||
}
|
||||
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.set_param(axis_index[j], L6470_STEP_MODE, m_bits); // set microsteps
|
||||
|
||||
DEBUG_ECHOLNPAIR("target (maximum) feedrate = ", final_fr_mm_m);
|
||||
|
||||
planner.synchronize(); // Wait for moves to finish
|
||||
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.get_status(axis_index[j]); // Clear all error flags
|
||||
|
||||
uint16_t status_composite = 0;
|
||||
DEBUG_ECHOLNPGM(".\n.\n."); // Make the feedrate prints easier to see
|
||||
|
||||
constexpr uint8_t iterations = 10;
|
||||
for (uint8_t i = 1; i <= iterations; i++) {
|
||||
const feedRate_t fr_mm_m = i * final_fr_mm_m / iterations;
|
||||
DEBUG_ECHOLNPAIR("...feedrate = ", fr_mm_m);
|
||||
|
||||
jiggle_axis(axis_mon[0][0], position_min, position_max, fr_mm_m);
|
||||
if (sh.STATUS_AXIS_LAYOUT == L6474_STATUS_LAYOUT)
|
||||
stepVal |= 0x98; // NO SYNC
|
||||
else
|
||||
stepVal |= (!SYNC_EN) | SYNC_SEL_1 | stepVal;
|
||||
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800; // bits of interest are all active low
|
||||
L64xxManager.set_param(axis_index[j], dSPIN_HARD_HIZ, 0); // can't write STEP register if stepper being powered
|
||||
// results in an extra NOOP being sent (data 00)
|
||||
L64xxManager.set_param(axis_index[j], L6470_STEP_MODE, stepVal); // set microsteps
|
||||
}
|
||||
}
|
||||
m_steps = L64xxManager.get_param(axis_index[0], L6470_STEP_MODE) & 0x07; // get microsteps
|
||||
|
||||
DEBUG_ECHOLNPAIR("Microsteps = ", _BV(m_steps));
|
||||
DEBUG_ECHOLNPAIR("target (maximum) feedrate = ", final_feedrate);
|
||||
|
||||
const float feedrate_inc = final_feedrate / 10, // Start at 1/10 of max & go up by 1/10 per step
|
||||
fr_limit = final_feedrate * 0.99f; // Rounding-safe comparison value
|
||||
float current_feedrate = 0;
|
||||
|
||||
planner.synchronize(); // Wait for moves to complete
|
||||
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L64xxManager.get_status(axis_index[j]); // Clear error flags
|
||||
|
||||
char temp_axis_string[2] = " ";
|
||||
temp_axis_string[0] = axis_mon[0][0]; // Need a sprintf format string
|
||||
//temp_axis_string[1] = '\n';
|
||||
|
||||
char gcode_string[80];
|
||||
uint16_t status_composite = 0;
|
||||
DEBUG_ECHOLNPGM(".\n.\n."); // Make feedrate outputs easier to read
|
||||
|
||||
do {
|
||||
current_feedrate += feedrate_inc;
|
||||
DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_min), uint16_t(current_feedrate));
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%03d F%03d"), temp_axis_string, uint16_t(position_max), uint16_t(current_feedrate));
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
axis_status[j] = (~L64xxManager.get_status(axis_index[j])) & 0x0800; // Bits of interest are all active LOW
|
||||
status_composite |= axis_status[j];
|
||||
}
|
||||
if (status_composite) break; // quit if any errors flags are raised
|
||||
}
|
||||
if (status_composite) break; // Break on any error
|
||||
} while (current_feedrate < fr_limit);
|
||||
|
||||
DEBUG_ECHOPGM("Completed with errors");
|
||||
DEBUG_ECHOPGM("Completed with ");
|
||||
if (status_composite) {
|
||||
DEBUG_ECHOLNPGM("errors");
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
DEBUG_ECHOPGM("...");
|
||||
L6470.error_status_decode(axis_status[j], axis_index[j]);
|
||||
}
|
||||
#if ENABLED(L6470_CHITCHAT)
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
if (j) DEBUG_ECHOPGM("...");
|
||||
L64xxManager.error_status_decode(axis_status[j], axis_index[j],
|
||||
sh.STATUS_AXIS_TH_SD, sh.STATUS_AXIS_TH_WRN,
|
||||
sh.STATUS_AXIS_STEP_LOSS_A, sh.STATUS_AXIS_STEP_LOSS_B,
|
||||
sh.STATUS_AXIS_OCD, sh.STATUS_AXIS_LAYOUT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
DEBUG_ECHOLNPGM("no errors");
|
||||
|
||||
} // M918
|
||||
L64xxManager.pause_monitor(false);
|
||||
}
|
||||
|
||||
#endif // HAS_DRIVER(L6470)
|
||||
#endif // HAS_L64XX
|
||||
|
||||
@@ -62,11 +62,44 @@
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(PHOTOGRAPH)
|
||||
constexpr uint8_t NUM_PULSES = 16;
|
||||
constexpr float PULSE_LENGTH = 0.01524;
|
||||
inline void set_photo_pin(const uint8_t state) { WRITE(PHOTOGRAPH_PIN, state); _delay_ms(PULSE_LENGTH); }
|
||||
inline void tweak_photo_pin() { set_photo_pin(HIGH); set_photo_pin(LOW); }
|
||||
inline void spin_photo_pin() { for (uint8_t i = NUM_PULSES; i--;) tweak_photo_pin(); }
|
||||
|
||||
FORCE_INLINE void set_photo_pin(const uint8_t state) {
|
||||
constexpr uint32_t pulse_length = (
|
||||
#ifdef PHOTO_PULSES_US
|
||||
PHOTO_PULSE_DELAY_US
|
||||
#else
|
||||
15 // 15.24 from _delay_ms(0.01524)
|
||||
#endif
|
||||
);
|
||||
WRITE(PHOTOGRAPH_PIN, state);
|
||||
delayMicroseconds(pulse_length);
|
||||
}
|
||||
|
||||
FORCE_INLINE void tweak_photo_pin() { set_photo_pin(HIGH); set_photo_pin(LOW); }
|
||||
|
||||
#ifdef PHOTO_PULSES_US
|
||||
|
||||
inline void pulse_photo_pin(const uint32_t duration, const uint8_t state) {
|
||||
if (state) {
|
||||
for (const uint32_t stop = micros() + duration; micros() < stop;)
|
||||
tweak_photo_pin();
|
||||
}
|
||||
else
|
||||
delayMicroseconds(duration);
|
||||
}
|
||||
|
||||
inline void spin_photo_pin() {
|
||||
static constexpr uint32_t sequence[] = PHOTO_PULSES_US;
|
||||
for (uint8_t i = 0; i < COUNT(sequence); i++)
|
||||
pulse_photo_pin(sequence[i], !(i & 1));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
constexpr uint8_t NUM_PULSES = 16;
|
||||
inline void spin_photo_pin() { for (uint8_t i = NUM_PULSES; i--;) tweak_photo_pin(); }
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#include "../../../feature/power_loss_recovery.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../../../lcd/extensible_ui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
#include "../../../core/debug_out.h"
|
||||
@@ -44,6 +47,10 @@ inline void plr_error(PGM_P const prefix) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
void lcd_power_loss_recovery_cancel();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M1000: Resume from power-loss (undocumented)
|
||||
* - With 'S' go to the Resume/Cancel menu
|
||||
@@ -55,10 +62,22 @@ void GcodeSuite::M1000() {
|
||||
if (parser.seen('S')) {
|
||||
#if HAS_LCD_MENU
|
||||
ui.goto_screen(menu_job_recovery);
|
||||
#elif ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::OnPowerLossResume();
|
||||
#else
|
||||
SERIAL_ECHO_MSG("Resume requires LCD.");
|
||||
#endif
|
||||
}
|
||||
else if (parser.seen('C')) {
|
||||
#if HAS_LCD_MENU
|
||||
lcd_power_loss_recovery_cancel();
|
||||
#else
|
||||
recovery.cancel();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStopped();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
recovery.resume();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#include "gcode.h"
|
||||
GcodeSuite gcode;
|
||||
|
||||
#if ENABLED(WIFI_CUSTOM_COMMAND)
|
||||
extern bool wifi_custom_command(char * const command_ptr);
|
||||
#endif
|
||||
|
||||
#include "parser.h"
|
||||
#include "queue.h"
|
||||
#include "../module/motion.h"
|
||||
@@ -319,6 +323,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 59: G59(); break;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
case 76: G76(); break; // G76: Calibrate first layer compensation values
|
||||
#endif
|
||||
|
||||
#if ENABLED(GCODE_MOTION_MODES)
|
||||
case 80: G80(); break; // G80: Reset the current motion mode
|
||||
#endif
|
||||
@@ -749,6 +757,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
M810_819(); break; // M810-M819: Define/execute G-code macro
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
case 871: M871(); break; // M871: Print/reset/clear first layer temperature offset values
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
case 900: M900(); break; // M900: Set advance K factor.
|
||||
#endif
|
||||
@@ -782,7 +794,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
case 122: M122(); break; // M122: Report status
|
||||
case 906: M906(); break; // M906: Set or get motor drive level
|
||||
case 916: M916(); break; // M916: L6470 tuning: Increase drive level until thermal warning
|
||||
@@ -841,7 +853,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
|
||||
case 'T': T(parser.codenum); break; // Tn: Tool Change
|
||||
|
||||
default: parser.unknown_command_error();
|
||||
default:
|
||||
#if ENABLED(WIFI_CUSTOM_COMMAND)
|
||||
if (wifi_custom_command(parser.command_ptr)) break;
|
||||
#endif
|
||||
parser.unknown_command_error();
|
||||
}
|
||||
|
||||
if (!no_ok) queue.ok_to_send();
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
* G34 - Z Stepper automatic alignment using probe: I<iterations> T<accuracy> A<amplification> (Requires Z_STEPPER_AUTO_ALIGN)
|
||||
* G38 - Probe in any direction using the Z_MIN_PROBE (Requires G38_PROBE_TARGET)
|
||||
* G42 - Coordinated move to a mesh point (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BLINEAR, or AUTO_BED_LEVELING_UBL)
|
||||
* G76 - Calibrate first layer temperature offsets. (Requires PROBE_TEMP_COMPENSATION)
|
||||
* G80 - Cancel current motion mode (Requires GCODE_MOTION_MODES)
|
||||
* G90 - Use Absolute Coordinates
|
||||
* G91 - Use Relative Coordinates
|
||||
@@ -243,6 +244,7 @@
|
||||
* M867 - Enable/disable or toggle error correction for position encoder modules.
|
||||
* M868 - Report or set position encoder module error correction threshold.
|
||||
* M869 - Report position encoder module error.
|
||||
* M871 - Print/reset/clear first layer temperature offset values. (Requires PROBE_TEMP_COMPENSATION)
|
||||
* M876 - Handle Prompt Response. (Requires HOST_PROMPT_SUPPORT and not EMERGENCY_PARSER)
|
||||
* M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE)
|
||||
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470)
|
||||
@@ -464,6 +466,10 @@ private:
|
||||
static void G59();
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
static void G76();
|
||||
#endif
|
||||
|
||||
#if ENABLED(GCODE_MOTION_MODES)
|
||||
static void G80();
|
||||
#endif
|
||||
@@ -874,6 +880,10 @@ private:
|
||||
FORCE_INLINE static void M869() { I2CPEM.M869(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
static void M871();
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
static void M900();
|
||||
#endif
|
||||
@@ -896,7 +906,7 @@ private:
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
static void M122();
|
||||
static void M906();
|
||||
static void M916();
|
||||
|
||||
@@ -28,10 +28,8 @@
|
||||
|
||||
#if ENABLED(M114_DETAIL)
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\gcode\host\M114.cpp
|
||||
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\bob_L6470.cpp
|
||||
#include "../../libs/L6470/L6470_Marlin.h"
|
||||
#if HAS_L64XX
|
||||
#include "../../libs/L64XX/L64XX_Marlin.h"
|
||||
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
|
||||
#include "../../core/debug_out.h"
|
||||
#endif
|
||||
@@ -39,9 +37,7 @@
|
||||
void report_xyze(const xyze_pos_t &pos, const uint8_t n=4, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
for (uint8_t a = 0; a < n; a++) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_CHAR(':');
|
||||
SERIAL_CHAR(' ', axis_codes[a], ':');
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
@@ -50,9 +46,7 @@
|
||||
void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_CHAR(':');
|
||||
SERIAL_CHAR(' ', axis_codes[a], ':');
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
@@ -92,13 +86,13 @@
|
||||
|
||||
planner.synchronize();
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
char temp_buf[80];
|
||||
int32_t temp;
|
||||
//#define ABS_POS_SIGN_MASK 0b1111 1111 1110 0000 0000 0000 0000 0000
|
||||
#define ABS_POS_SIGN_MASK 0b11111111111000000000000000000000
|
||||
#define REPORT_ABSOLUTE_POS(Q) do{ \
|
||||
L6470.say_axis(Q, false); \
|
||||
L64xxManager.say_axis(Q, false); \
|
||||
temp = L6470_GETPARAM(L6470_ABS_POS,Q); \
|
||||
if (temp & ABS_POS_SIGN_MASK) temp |= ABS_POS_SIGN_MASK; \
|
||||
sprintf_P(temp_buf, PSTR(":%8ld "), temp); \
|
||||
@@ -106,53 +100,51 @@
|
||||
}while(0)
|
||||
|
||||
DEBUG_ECHOPGM("\nL6470:");
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
#if AXIS_IS_L64XX(X)
|
||||
REPORT_ABSOLUTE_POS(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
#if AXIS_IS_L64XX(X2)
|
||||
REPORT_ABSOLUTE_POS(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
#if AXIS_IS_L64XX(Y)
|
||||
REPORT_ABSOLUTE_POS(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
#if AXIS_IS_L64XX(Y2)
|
||||
REPORT_ABSOLUTE_POS(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
#if AXIS_IS_L64XX(Z)
|
||||
REPORT_ABSOLUTE_POS(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
#if AXIS_IS_L64XX(Z2)
|
||||
REPORT_ABSOLUTE_POS(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
#if AXIS_IS_L64XX(Z3)
|
||||
REPORT_ABSOLUTE_POS(Z3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
REPORT_ABSOLUTE_POS(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
#if AXIS_IS_L64XX(E1)
|
||||
REPORT_ABSOLUTE_POS(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
#if AXIS_IS_L64XX(E2)
|
||||
REPORT_ABSOLUTE_POS(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
#if AXIS_IS_L64XX(E3)
|
||||
REPORT_ABSOLUTE_POS(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
#if AXIS_IS_L64XX(E4)
|
||||
REPORT_ABSOLUTE_POS(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
#if AXIS_IS_L64XX(E5)
|
||||
REPORT_ABSOLUTE_POS(E5);
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
#endif // HAS_DRIVER(L6470)
|
||||
#endif // HAS_L64XX
|
||||
|
||||
SERIAL_ECHOPGM("Stepper:");
|
||||
LOOP_XYZE(i) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[i]);
|
||||
SERIAL_CHAR(':');
|
||||
SERIAL_CHAR(' ', axis_codes[i], ':');
|
||||
SERIAL_ECHO(stepper.position((AxisEnum)i));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
||||
@@ -152,7 +152,7 @@ void GcodeSuite::M115() {
|
||||
|
||||
// THERMAL_PROTECTION
|
||||
cap_line(PSTR("THERMAL_PROTECTION")
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && (ENABLED(THERMAL_PROTECTION_BED) || !HAS_HEATED_BED) && (ENABLED(THERMAL_PROTECTION_CHAMBER) || !HAS_HEATED_CHAMBER)
|
||||
#if (ENABLED(THERMAL_PROTECTION_HOTENDS) || !EXTRUDERS) && (ENABLED(THERMAL_PROTECTION_BED) || !HAS_HEATED_BED) && (ENABLED(THERMAL_PROTECTION_CHAMBER) || !HAS_HEATED_CHAMBER)
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -103,7 +103,15 @@ void plan_arc(
|
||||
mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : ABS(flat_mm);
|
||||
if (mm_of_travel < 0.001f) return;
|
||||
|
||||
uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT));
|
||||
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
|
||||
|
||||
#ifdef ARC_SEGMENTS_PER_SEC
|
||||
float seg_length = scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC);
|
||||
NOLESS(seg_length, MM_PER_ARC_SEGMENT);
|
||||
#else
|
||||
constexpr float seg_length = MM_PER_ARC_SEGMENT;
|
||||
#endif
|
||||
uint16_t segments = FLOOR(mm_of_travel / seg_length);
|
||||
NOLESS(segments, min_segments);
|
||||
|
||||
/**
|
||||
@@ -146,10 +154,9 @@ void plan_arc(
|
||||
// Initialize the extruder axis
|
||||
raw.e = current_position.e;
|
||||
|
||||
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
|
||||
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
const float inv_duration = scaled_fr_mm_s / MM_PER_ARC_SEGMENT;
|
||||
const float inv_duration = scaled_fr_mm_s / seg_length;
|
||||
#endif
|
||||
|
||||
millis_t next_idle_ms = millis() + 200UL;
|
||||
@@ -206,7 +213,7 @@ void plan_arc(
|
||||
planner.apply_leveling(raw);
|
||||
#endif
|
||||
|
||||
if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, MM_PER_ARC_SEGMENT
|
||||
if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, seg_length
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
@@ -226,7 +233,7 @@ void plan_arc(
|
||||
planner.apply_leveling(raw);
|
||||
#endif
|
||||
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, MM_PER_ARC_SEGMENT
|
||||
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, seg_length
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
|
||||
@@ -346,7 +346,7 @@ void GCodeParser::unknown_command_error() {
|
||||
SERIAL_ECHOLNPGM(")");
|
||||
#if ENABLED(FASTER_GCODE_PARSER)
|
||||
SERIAL_ECHOPGM(" args: { ");
|
||||
for (char c = 'A'; c <= 'Z'; ++c) if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); }
|
||||
for (char c = 'A'; c <= 'Z'; ++c) if (seen(c)) SERIAL_CHAR(c, ' ');
|
||||
SERIAL_CHAR('}');
|
||||
#else
|
||||
SERIAL_ECHOPAIR(" args: { ", command_args, " }");
|
||||
|
||||
@@ -39,8 +39,9 @@
|
||||
* E Engage the probe for each probe (default 1)
|
||||
*/
|
||||
void GcodeSuite::G30() {
|
||||
const xy_pos_t pos = { parser.linearval('X', current_position.x + probe_offset.x),
|
||||
parser.linearval('Y', current_position.y + probe_offset.y) };
|
||||
|
||||
const xy_pos_t pos = { parser.linearval('X', current_position.x + probe_offset_xy.x),
|
||||
parser.linearval('Y', current_position.y + probe_offset_xy.y) };
|
||||
|
||||
if (!position_is_reachable_by_probe(pos)) return;
|
||||
|
||||
|
||||
@@ -37,32 +37,49 @@ void GcodeSuite::M851() {
|
||||
|
||||
// Show usage with no parameters
|
||||
if (!parser.seen("XYZ")) {
|
||||
SERIAL_ECHOLNPAIR_P(PSTR(MSG_PROBE_OFFSET " X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
|
||||
SERIAL_ECHOLNPAIR_P(
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
PSTR(MSG_PROBE_OFFSET " X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR
|
||||
#else
|
||||
PSTR(MSG_PROBE_OFFSET " X0 Y0 Z")
|
||||
#endif
|
||||
, probe_offset.z
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Start with current offsets and modify
|
||||
xyz_pos_t offs = probe_offset;
|
||||
|
||||
// Assume no errors
|
||||
bool ok = true;
|
||||
|
||||
if (parser.seenval('X')) {
|
||||
const float x = parser.value_float();
|
||||
if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
|
||||
offs.x = x;
|
||||
else {
|
||||
SERIAL_ECHOLNPAIR("?X out of range (-", int(X_BED_SIZE), " to ", int(X_BED_SIZE), ")");
|
||||
ok = false;
|
||||
}
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
|
||||
offs.x = x;
|
||||
else {
|
||||
SERIAL_ECHOLNPAIR("?X out of range (-", int(X_BED_SIZE), " to ", int(X_BED_SIZE), ")");
|
||||
ok = false;
|
||||
}
|
||||
#else
|
||||
if (x) SERIAL_ECHOLNPAIR("?X must be 0 (NOZZLE_AS_PROBE)."); // ...but let 'ok' stay true
|
||||
#endif
|
||||
}
|
||||
|
||||
if (parser.seenval('Y')) {
|
||||
const float y = parser.value_float();
|
||||
if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
|
||||
offs.y = y;
|
||||
else {
|
||||
SERIAL_ECHOLNPAIR("?Y out of range (-", int(Y_BED_SIZE), " to ", int(Y_BED_SIZE), ")");
|
||||
ok = false;
|
||||
}
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
|
||||
offs.y = y;
|
||||
else {
|
||||
SERIAL_ECHOLNPAIR("?Y out of range (-", int(Y_BED_SIZE), " to ", int(Y_BED_SIZE), ")");
|
||||
ok = false;
|
||||
}
|
||||
#else
|
||||
if (y) SERIAL_ECHOLNPAIR("?Y must be 0 (NOZZLE_AS_PROBE)."); // ...but let 'ok' stay true
|
||||
#endif
|
||||
}
|
||||
|
||||
if (parser.seenval('Z')) {
|
||||
|
||||
@@ -86,6 +86,10 @@ void GcodeSuite::M24() {
|
||||
*/
|
||||
void GcodeSuite::M25() {
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
if (recovery.enabled) recovery.save(true, false);
|
||||
#endif
|
||||
|
||||
// Set initial pause flag to prevent more commands from landing in the queue while we try to pause
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (IS_SD_PRINTING()) card.pauseSDPrint();
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
#include "../gcode.h"
|
||||
#include "../../module/temperature.h"
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../../lcd/extensible_ui/ui_api.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M303: PID relay autotune
|
||||
*
|
||||
@@ -49,6 +53,9 @@ void GcodeSuite::M303() {
|
||||
const heater_ind_t e = (heater_ind_t)parser.intval('E');
|
||||
if (!WITHIN(e, SI, EI)) {
|
||||
SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::OnPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,11 +110,11 @@
|
||||
#define IS_RRD_SC
|
||||
#define IS_U8GLIB_SSD1306
|
||||
|
||||
#elif ENABLED(MKS_MINI_12864)
|
||||
#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
|
||||
|
||||
#define MINIPANEL
|
||||
|
||||
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
|
||||
#elif ANY(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)
|
||||
|
||||
#define FYSETC_MINI_12864
|
||||
#define DOGLCD
|
||||
@@ -359,6 +359,7 @@
|
||||
#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
|
||||
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
|
||||
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
|
||||
#define HAS_DGUS_LCD ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
|
||||
|
||||
/**
|
||||
* Extruders have some combination of stepper motors and hotends
|
||||
@@ -500,6 +501,7 @@
|
||||
#define PROBE_SELECTED (HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#define HAS_PROBE_XY_OFFSET DISABLED(NOZZLE_AS_PROBE)
|
||||
#define HAS_CUSTOM_PROBE_PIN DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
#define HOMING_Z_WITH_PROBE (Z_HOME_DIR < 0 && !HAS_CUSTOM_PROBE_PIN)
|
||||
#ifndef Z_PROBE_LOW_POINT
|
||||
|
||||
@@ -259,10 +259,10 @@
|
||||
#elif ENABLED(MKS_LCD12864B)
|
||||
#define _LCD_CONTRAST_MIN 120
|
||||
#define _LCD_CONTRAST_INIT 205
|
||||
#elif ENABLED(MKS_MINI_12864)
|
||||
#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
|
||||
#define _LCD_CONTRAST_MIN 120
|
||||
#define _LCD_CONTRAST_INIT 195
|
||||
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
|
||||
#elif ENABLED(FYSETC_MINI_12864)
|
||||
#define _LCD_CONTRAST_INIT 220
|
||||
#elif ENABLED(ULTI_CONTROLLER)
|
||||
#define _LCD_CONTRAST_INIT 127
|
||||
@@ -341,7 +341,7 @@
|
||||
* Temp Sensor defines
|
||||
*/
|
||||
|
||||
#define ANY_TEMP_SENSOR_IS(n) (TEMP_SENSOR_0 == (n) || TEMP_SENSOR_1 == (n) || TEMP_SENSOR_2 == (n) || TEMP_SENSOR_3 == (n) || TEMP_SENSOR_4 == (n) || TEMP_SENSOR_5 == (n) || TEMP_SENSOR_BED == (n) || TEMP_SENSOR_CHAMBER == (n))
|
||||
#define ANY_TEMP_SENSOR_IS(n) (TEMP_SENSOR_0 == (n) || TEMP_SENSOR_1 == (n) || TEMP_SENSOR_2 == (n) || TEMP_SENSOR_3 == (n) || TEMP_SENSOR_4 == (n) || TEMP_SENSOR_5 == (n) || TEMP_SENSOR_BED == (n) || TEMP_SENSOR_PROBE == (n) || TEMP_SENSOR_CHAMBER == (n))
|
||||
|
||||
#define HAS_USER_THERMISTORS ANY_TEMP_SENSOR_IS(1000)
|
||||
|
||||
@@ -521,7 +521,25 @@
|
||||
#undef CHAMBER_MAXTEMP
|
||||
#endif
|
||||
|
||||
#define HOTEND_USES_THERMISTOR ANY(HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, HEATER_4_USES_THERMISTOR)
|
||||
#if TEMP_SENSOR_PROBE == -4
|
||||
#define HEATER_PROBE_USES_AD8495
|
||||
#elif TEMP_SENSOR_PROBE == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
|
||||
#elif TEMP_SENSOR_PROBE == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
|
||||
#elif TEMP_SENSOR_PROBE == -1
|
||||
#define HEATER_PROBE_USES_AD595
|
||||
#elif TEMP_SENSOR_PROBE > 0
|
||||
#define THERMISTORPROBE TEMP_SENSOR_PROBE
|
||||
#define PROBE_USES_THERMISTOR
|
||||
#if TEMP_SENSOR_PROBE == 1000
|
||||
#define PROBE_USER_THERMISTOR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define HOTEND_USES_THERMISTOR ANY( \
|
||||
HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, \
|
||||
HEATER_3_USES_THERMISTOR, HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR)
|
||||
|
||||
/**
|
||||
* Default hotend offsets, if not defined
|
||||
@@ -1014,19 +1032,20 @@
|
||||
|
||||
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
|
||||
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675))
|
||||
#define HAS_TEMP_ADC_0 HAS_ADC_TEST(0)
|
||||
#define HAS_TEMP_ADC_1 HAS_ADC_TEST(1)
|
||||
#define HAS_TEMP_ADC_2 HAS_ADC_TEST(2)
|
||||
#define HAS_TEMP_ADC_3 HAS_ADC_TEST(3)
|
||||
#define HAS_TEMP_ADC_4 HAS_ADC_TEST(4)
|
||||
#define HAS_TEMP_ADC_5 HAS_ADC_TEST(5)
|
||||
#define HAS_TEMP_ADC_BED HAS_ADC_TEST(BED)
|
||||
#define HAS_TEMP_ADC_CHAMBER HAS_ADC_TEST(CHAMBER)
|
||||
#define HAS_TEMP_ADC_0 HAS_ADC_TEST(0)
|
||||
#define HAS_TEMP_ADC_1 HAS_ADC_TEST(1)
|
||||
#define HAS_TEMP_ADC_2 HAS_ADC_TEST(2)
|
||||
#define HAS_TEMP_ADC_3 HAS_ADC_TEST(3)
|
||||
#define HAS_TEMP_ADC_4 HAS_ADC_TEST(4)
|
||||
#define HAS_TEMP_ADC_5 HAS_ADC_TEST(5)
|
||||
#define HAS_TEMP_ADC_BED HAS_ADC_TEST(BED)
|
||||
#define HAS_TEMP_ADC_PROBE HAS_ADC_TEST(PROBE)
|
||||
#define HAS_TEMP_ADC_CHAMBER HAS_ADC_TEST(CHAMBER)
|
||||
|
||||
#define HAS_TEMP_HOTEND (HOTENDS > 0 && (HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)))
|
||||
#define HAS_TEMP_BED HAS_TEMP_ADC_BED
|
||||
#define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER
|
||||
#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER))
|
||||
#define HAS_TEMP_HOTEND ((HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) && HOTENDS)
|
||||
#define HAS_TEMP_BED HAS_TEMP_ADC_BED
|
||||
#define HAS_TEMP_PROBE HAS_TEMP_ADC_PROBE
|
||||
#define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER
|
||||
|
||||
#if ENABLED(JOYSTICK)
|
||||
#define HAS_JOY_ADC_X PIN_EXISTS(JOY_X)
|
||||
@@ -1036,22 +1055,19 @@
|
||||
#endif
|
||||
|
||||
// Heaters
|
||||
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
|
||||
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
|
||||
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
|
||||
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
|
||||
#define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
|
||||
#define HAS_HEATER_5 (PIN_EXISTS(HEATER_5))
|
||||
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
|
||||
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
|
||||
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
|
||||
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
|
||||
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
|
||||
#define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
|
||||
#define HAS_HEATER_5 (PIN_EXISTS(HEATER_5))
|
||||
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
|
||||
|
||||
// Shorthand for common combinations
|
||||
#define HAS_HEATED_BED (HAS_TEMP_BED && HAS_HEATER_BED)
|
||||
#define BED_OR_CHAMBER (HAS_HEATED_BED || HAS_TEMP_CHAMBER)
|
||||
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || BED_OR_CHAMBER)
|
||||
|
||||
#if !HAS_TEMP_SENSOR
|
||||
#undef AUTO_REPORT_TEMPERATURES
|
||||
#endif
|
||||
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE)
|
||||
#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER))
|
||||
|
||||
// PID heating
|
||||
#if !HAS_HEATED_BED
|
||||
@@ -1081,6 +1097,10 @@
|
||||
#define AUTO_CHAMBER_IS_E (_FANOVERLAP(CHAMBER,0) || _FANOVERLAP(CHAMBER,1) || _FANOVERLAP(CHAMBER,2) || _FANOVERLAP(CHAMBER,3) || _FANOVERLAP(CHAMBER,4) || _FANOVERLAP(CHAMBER,5))
|
||||
#endif
|
||||
|
||||
#if !HAS_TEMP_SENSOR
|
||||
#undef AUTO_REPORT_TEMPERATURES
|
||||
#endif
|
||||
|
||||
#if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E
|
||||
#undef AUTO_POWER_CHAMBER_FAN
|
||||
#endif
|
||||
|
||||
@@ -424,6 +424,8 @@
|
||||
#error "FILAMENT_UNLOAD_DELAY is now FILAMENT_UNLOAD_PURGE_DELAY. Please update Configuration_adv.h."
|
||||
#elif defined(HOME_USING_SPREADCYCLE)
|
||||
#error "HOME_USING_SPREADCYCLE is now obsolete. Please remove it from Configuration_adv.h."
|
||||
#elif defined(DGUS_LCD)
|
||||
#error "DGUS_LCD is now DGUS_LCD_UI_(ORIGIN|FYSETC|HIPRECY). Please update your configuration."
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1018,6 +1020,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
|
||||
#elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || HAS_LCD_MENU)
|
||||
#error "DELTA_AUTO_CALIBRATION requires a probe or LCD Controller."
|
||||
#elif ENABLED(DELTA_CALIBRATION_MENU) && !HAS_LCD_MENU
|
||||
#error "DELTA_CALIBRATION_MENU requires an LCD Controller."
|
||||
#elif ABL_GRID
|
||||
#if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0
|
||||
#error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be odd numbers."
|
||||
@@ -1149,6 +1153,20 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled."
|
||||
#endif
|
||||
|
||||
#if ENABLED(NOZZLE_AS_PROBE)
|
||||
constexpr float sanity_nozzle_to_probe_offset[] = NOZZLE_TO_PROBE_OFFSET;
|
||||
static_assert(sanity_nozzle_to_probe_offset[0] == 0.0 && sanity_nozzle_to_probe_offset[1] == 0.0,
|
||||
"NOZZLE_AS_PROBE requires the X,Y offsets in NOZZLE_TO_PROBE_OFFSET to be 0,0.");
|
||||
#endif
|
||||
|
||||
#if DISABLED(NOZZLE_AS_PROBE)
|
||||
static_assert(MIN_PROBE_EDGE >= 0, "MIN_PROBE_EDGE must be >= 0.");
|
||||
static_assert(MIN_PROBE_EDGE_BACK >= 0, "MIN_PROBE_EDGE_BACK must be >= 0.");
|
||||
static_assert(MIN_PROBE_EDGE_FRONT >= 0, "MIN_PROBE_EDGE_FRONT must be >= 0.");
|
||||
static_assert(MIN_PROBE_EDGE_LEFT >= 0, "MIN_PROBE_EDGE_LEFT must be >= 0.");
|
||||
static_assert(MIN_PROBE_EDGE_RIGHT >= 0, "MIN_PROBE_EDGE_RIGHT must be >= 0.");
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Make sure Z raise values are set
|
||||
*/
|
||||
@@ -1553,6 +1571,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "TEMP_SENSOR_5 shouldn't be set with only 1 HOTEND."
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_PROBE
|
||||
#if !PIN_EXISTS(TEMP_PROBE)
|
||||
#error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
|
||||
#elif !HAS_TEMP_ADC_PROBE
|
||||
#error "TEMP_PROBE_PIN must be an ADC pin."
|
||||
#elif !ENABLED(FIX_MOUNTED_PROBE)
|
||||
#error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) && TEMP_SENSOR_1 == 0
|
||||
#error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
|
||||
#endif
|
||||
@@ -1852,8 +1880,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && DISABLED(IS_RRD_FG_SC)) \
|
||||
+ (ENABLED(ULTRA_LCD) && DISABLED(IS_ULTRA_LCD)) \
|
||||
+ (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \
|
||||
+ (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864)) \
|
||||
+ (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(IS_RRW_KEYPAD)) \
|
||||
+ (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \
|
||||
+ (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \
|
||||
+ (ENABLED(ULTIPANEL) && DISABLED(IS_ULTIPANEL)) \
|
||||
+ ENABLED(RADDS_DISPLAY) \
|
||||
@@ -1881,10 +1908,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ ENABLED(LCD_FOR_MELZI) \
|
||||
+ ENABLED(ULTI_CONTROLLER) \
|
||||
+ ENABLED(MKS_MINI_12864) \
|
||||
+ ENABLED(ENDER2_STOCKDISPLAY) \
|
||||
+ ENABLED(FYSETC_MINI_12864_X_X) \
|
||||
+ ENABLED(FYSETC_MINI_12864_1_2) \
|
||||
+ ENABLED(FYSETC_MINI_12864_2_0) \
|
||||
+ ENABLED(FYSETC_MINI_12864_2_1) \
|
||||
+ ENABLED(FYSETC_GENERIC_12864_1_1) \
|
||||
+ ENABLED(CR10_STOCKDISPLAY) \
|
||||
+ ENABLED(ANET_FULL_GRAPHICS_LCD) \
|
||||
+ ENABLED(AZSMZ_12864) \
|
||||
@@ -1895,7 +1924,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ ENABLED(MKS_12864OLED_SSD1306) \
|
||||
+ ENABLED(U8GLIB_SH1106_EINSTART) \
|
||||
+ ENABLED(OVERLORD_OLED) \
|
||||
+ ENABLED(DGUS_LCD) \
|
||||
+ ENABLED(DGUS_LCD_UI_ORIGIN) \
|
||||
+ ENABLED(DGUS_LCD_UI_FYSETC) \
|
||||
+ ENABLED(DGUS_LCD_UI_HIPRECY) \
|
||||
+ ENABLED(MALYAN_LCD) \
|
||||
+ ENABLED(TOUCH_UI_FTDI_EVE) \
|
||||
+ ENABLED(FSMC_GRAPHICAL_TFT)
|
||||
@@ -2124,7 +2155,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "STEALTHCHOP requires TMC2130, TMC2160, TMC2208, TMC2209, or TMC5160 stepper drivers."
|
||||
#endif
|
||||
|
||||
#define IN_CHAIN(A) (A##_CHAIN_POS > 0)
|
||||
#define IN_CHAIN(A) ((A##_CHAIN_POS > 0) && !HAS_L64XX)
|
||||
// TMC SPI Chaining
|
||||
#if IN_CHAIN(X) || IN_CHAIN(Y) || IN_CHAIN(Z) || IN_CHAIN(X2) || IN_CHAIN(Y2) || IN_CHAIN(Z2) || IN_CHAIN(Z3) || IN_CHAIN(E0) || IN_CHAIN(E1) || IN_CHAIN(E2) || IN_CHAIN(E3) || IN_CHAIN(E4) || IN_CHAIN(E5)
|
||||
#if (IN_CHAIN(X) && !PIN_EXISTS(X_CS) ) || (IN_CHAIN(Y) && !PIN_EXISTS(Y_CS) ) \
|
||||
@@ -2488,3 +2519,15 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
#error "SHOW_REMAINING_TIME currently requires a Graphical LCD."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && !WITHIN(ADC_BUTTON_DEBOUNCE_DELAY, 16, 255)
|
||||
#error "ADC_BUTTON_DEBOUNCE_DELAY must be an integer from 16 to 255."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Check to make sure MONITOR_DRIVER_STATUS isn't enabled
|
||||
* on boards where TMC drivers share the SPI bus with SD.
|
||||
*/
|
||||
#if TMC_HAS_SPI && ALL(MONITOR_DRIVER_STATUS, SDSUPPORT, USES_SHARED_SPI)
|
||||
#error "MONITOR_DRIVER_STATUS and SDSUPPORT cannot be used together on boards with shared SPI."
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2019-12-19"
|
||||
#define STRING_DISTRIBUTION_DATE "2020-01-19"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -438,7 +438,7 @@ void MarlinUI::draw_status_screen() {
|
||||
if (p != lastProgress) {
|
||||
lastProgress = p;
|
||||
|
||||
progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * progress / (PROGRESS_SCALE) * 0.01f);
|
||||
progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f);
|
||||
|
||||
#if ENABLED(DOGM_SD_PERCENT)
|
||||
if (progress == 0) {
|
||||
|
||||
@@ -118,7 +118,7 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = {
|
||||
static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // instruction mode
|
||||
U8G_ESC_CS(1), // enable chip
|
||||
#if ENABLED(MKS_MINI_12864)
|
||||
#if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
|
||||
UC1701_START_LINE(0), // set display start line to 0
|
||||
UC1701_ADC_REVERSE(0), // ADC set to reverse
|
||||
UC1701_OUT_MODE(1), // common output mode
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
#define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 4 stripes
|
||||
|
||||
#elif ENABLED(MKS_MINI_12864)
|
||||
#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
|
||||
|
||||
// The MKS_MINI_12864 V1/V2 aren't exact copies of the MiniPanel.
|
||||
// Panel management is in u8g_dev_uc1701_mini12864_HAL.cpp with
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -116,10 +116,52 @@ public:
|
||||
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(DUGS_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
|
||||
// Hook for "Change probe offset z"
|
||||
static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
// 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"
|
||||
@@ -134,6 +176,8 @@ public:
|
||||
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.
|
||||
@@ -164,8 +208,20 @@ public:
|
||||
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_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 FAN_COUNT > 0
|
||||
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);
|
||||
@@ -199,6 +255,25 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/// 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);
|
||||
union { int16_t i; char lb[2]; } endian;
|
||||
|
||||
char tmp[2];
|
||||
endian.i = f;
|
||||
tmp[0] = endian.lb[1];
|
||||
tmp[1] = endian.lb[0];
|
||||
dgusdisplay.WriteVariable(var.VP, tmp, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
|
||||
@@ -38,155 +38,13 @@ struct VPMapping {
|
||||
|
||||
extern const struct VPMapping VPMap[];
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 0,
|
||||
DGUSLCD_SCREEN_MAIN = 10,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 20,
|
||||
DGUSLCD_SCREEN_STATUS = 30,
|
||||
DGUSLCD_SCREEN_STATUS2 = 32,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 40,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE=42,
|
||||
DGUSLCD_SCREEN_FANANDFEEDRATE = 44,
|
||||
DGUSLCD_SCREEN_FLOWRATES = 46,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 50,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52,
|
||||
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_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)
|
||||
|
||||
// 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;
|
||||
|
||||
// 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 = 0x3020;
|
||||
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_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_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_Fan_Percentage = 0x3100; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_PrintTime = 0x3106;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 10;
|
||||
|
||||
// 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
|
||||
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 5; // 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// List of VPs handled by Marlin / The Display.
|
||||
extern const struct DGUS_VP_Variable ListOfVP[];
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
#include "DGUSDisplayDefinitionOrigin.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
#include "DGUSDisplayDefinitionFYSETC.h"
|
||||
#elif ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
#include "DGUSDisplayDefinitionHIPRECY.h"
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,476 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS VPs changed by George Fu in 2019 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
|
||||
#include "DGUSDisplayDefinition.h"
|
||||
#include "DGUSDisplay.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../ultralcd.h"
|
||||
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 0.1;
|
||||
#endif
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
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 VPList_Temp[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_Flowrate_E1,
|
||||
#endif
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Preheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualMove[] PROGMEM = {
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
VP_EPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan0_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_FlowRates[] PROGMEM = {
|
||||
VP_Flowrate_E0, VP_Flowrate_E1,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_heating[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
VP_E1_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_load_unload[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1, VP_SD_FileName2, VP_SD_FileName3, VP_SD_FileName4,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
|
||||
VP_PrintProgress_Percentage, VP_PrintTime,
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan0_Percentage,
|
||||
#if FAN_COUNT > 1
|
||||
VP_Fan1_Percentage,
|
||||
#endif
|
||||
#endif
|
||||
VP_Flowrate_E0,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDPrintTune[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set, VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set, VP_Flowrate_E1,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
VP_Feedrate_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_StepPerMM[] PROGMEM = {
|
||||
VP_X_STEP_PER_MM,
|
||||
VP_Y_STEP_PER_MM,
|
||||
VP_Z_STEP_PER_MM,
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_STEP_PER_MM,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_STEP_PER_MM,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDE0[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_E0_PID_P,
|
||||
VP_E0_PID_I,
|
||||
VP_E0_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDBED[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_BED_PID_P,
|
||||
VP_BED_PID_I,
|
||||
VP_BED_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Infos[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
VP_PrintTime,
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VP_PrintAccTime,
|
||||
VP_PrintsTotal,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDTuningWaiting[] PROGMEM = {
|
||||
VP_WAITING_STATUS,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPreheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPrinting[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
|
||||
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
|
||||
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
|
||||
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
|
||||
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
|
||||
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
|
||||
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
|
||||
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
|
||||
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// 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, DGUSScreenVariableHandler::ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, DGUSScreenVariableHandler::ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &DGUSScreenVariableHandler::HandleAllHeatersOff, nullptr),
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMoveOption, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#else
|
||||
VPHELPER(VP_MOVE_X, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &DGUSScreenVariableHandler::HandleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &DGUSScreenVariableHandler::HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &DGUSScreenVariableHandler::HandleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, &DGUSScreenVariableHandler::HandleZCalibration, nullptr),
|
||||
#endif
|
||||
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &DGUSScreenVariableHandler::HandleFirstLayerCal, nullptr),
|
||||
#endif
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&DGUSScreenVariableHandler::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 =&DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplay },
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &DGUSScreenVariableHandler::HandlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, &DGUSScreenVariableHandler::HandleFilamentOption, &DGUSScreenVariableHandler::HandleFilamentLoadUnload),
|
||||
#endif
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, &DGUSScreenVariableHandler::HandleFilamentOption, &DGUSScreenVariableHandler::HandleFilamentLoadUnload),
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if FAN_COUNT
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, DGUSScreenVariableHandler::DGUSLCD_SetValueDirectly<int16_t>, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay),
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintAccTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintsTotalToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe_offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, DGUSScreenVariableHandler::HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, DGUSScreenVariableHandler::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 = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_FYSETC
|
||||
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 0,
|
||||
DGUSLCD_SCREEN_MAIN = 1,
|
||||
DGUSLCD_SCREEN_STATUS = 1,
|
||||
DGUSLCD_SCREEN_STATUS2 = 1,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 10,
|
||||
DGUSLCD_SCREEN_PREHEAT = 18,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 192,
|
||||
DGUSLCD_SCREEN_UTILITY = 120,
|
||||
DGUSLCD_SCREEN_FILAMENT_HEATING = 146,
|
||||
DGUSLCD_SCREEN_FILAMENT_LOADING = 148,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE = 160,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 71,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 73,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 75,
|
||||
DGUSLCD_SCREEN_FLC_PREHEAT = 94,
|
||||
DGUSLCD_SCREEN_FLC_PRINTING = 96,
|
||||
DGUSLCD_SCREEN_STEPPERMM = 212,
|
||||
DGUSLCD_SCREEN_PID_E = 214,
|
||||
DGUSLCD_SCREEN_PID_BED = 218,
|
||||
DGUSLCD_SCREEN_INFOS = 30,
|
||||
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;
|
||||
|
||||
// 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
|
||||
constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// 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 = 0x3020;
|
||||
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_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_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 = 5; // 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_Print_ProbeOffsetZ = 0x32A0; //
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0;
|
||||
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x3300;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x3302;
|
||||
//constexpr uint16_t VP_FAN2_STATUS = 0x3304;
|
||||
//constexpr uint16_t VP_FAN3_STATUS = 0x3306;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3310;
|
||||
//constexpr uint16_t VP_E1_STATUS = 0x3312;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3314;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3316;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3318;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x331A;
|
||||
constexpr uint16_t VP_BED_STATUS = 0x331C;
|
||||
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3400;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
//constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
//constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
//constexpr uint16_t VP_Z2_STEP_PER_MM = 0x360A;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612;
|
||||
//constexpr uint16_t VP_E2_STEP_PER_MM = 0x3614;
|
||||
//constexpr uint16_t VP_E3_STEP_PER_MM = 0x3616;
|
||||
//constexpr uint16_t VP_E4_STEP_PER_MM = 0x3618;
|
||||
//constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A;
|
||||
|
||||
// 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_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;
|
||||
@@ -0,0 +1,476 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS VPs changed by George Fu in 2019 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_HIPRECY)
|
||||
|
||||
#include "DGUSDisplayDefinition.h"
|
||||
#include "DGUSDisplay.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../ultralcd.h"
|
||||
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 0.1;
|
||||
#endif
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
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 VPList_Temp[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Status2[] PROGMEM = {
|
||||
/* VP_M117, for completeness, but it cannot be auto-uploaded */
|
||||
#if HOTENDS >= 1
|
||||
VP_Flowrate_E0,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_Flowrate_E1,
|
||||
#endif
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTime,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Preheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualMove[] PROGMEM = {
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
VP_EPos,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan0_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_FlowRates[] PROGMEM = {
|
||||
VP_Flowrate_E0, VP_Flowrate_E1,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_heating[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Filament_load_unload[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_FILAMENT_LOAD_UNLOAD,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VP_SD_FileName0, VP_SD_FileName1, VP_SD_FileName2, VP_SD_FileName3, VP_SD_FileName4,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
|
||||
VP_PrintProgress_Percentage, VP_PrintTime,
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan0_Percentage,
|
||||
#if FAN_COUNT > 1
|
||||
VP_Fan1_Percentage,
|
||||
#endif
|
||||
#endif
|
||||
VP_Flowrate_E0,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDPrintTune[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
VP_Feedrate_Percentage,
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_Flowrate_E0,
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_StepPerMM[] PROGMEM = {
|
||||
VP_X_STEP_PER_MM,
|
||||
VP_Y_STEP_PER_MM,
|
||||
VP_Z_STEP_PER_MM,
|
||||
#if HOTENDS >= 1
|
||||
VP_E0_STEP_PER_MM,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_E1_STEP_PER_MM,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDE0[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_E0_PID_P,
|
||||
VP_E0_PID_I,
|
||||
VP_E0_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDBED[] PROGMEM = {
|
||||
#if ENABLED(PIDTEMP)
|
||||
VP_BED_PID_P,
|
||||
VP_BED_PID_I,
|
||||
VP_BED_PID_D,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Infos[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
VP_PrintTime,
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VP_PrintAccTime,
|
||||
VP_PrintsTotal,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PIDTuningWaiting[] PROGMEM = {
|
||||
VP_WAITING_STATUS,
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPreheat[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FLCPrinting[] PROGMEM = {
|
||||
#if HOTENDS >= 1
|
||||
VP_SD_Print_ProbeOffsetZ,
|
||||
#endif
|
||||
0x0000
|
||||
};
|
||||
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
|
||||
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
|
||||
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
|
||||
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
|
||||
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
|
||||
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
|
||||
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
|
||||
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
|
||||
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
|
||||
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
|
||||
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
|
||||
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
|
||||
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// 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, DGUSScreenVariableHandler::ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfSD, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, DGUSScreenVariableHandler::ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &DGUSScreenVariableHandler::HandleAllHeatersOff, nullptr),
|
||||
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMoveOption, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#else
|
||||
VPHELPER(VP_MOVE_X, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &DGUSScreenVariableHandler::HandleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &DGUSScreenVariableHandler::HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &DGUSScreenVariableHandler::HandleSettings, nullptr),
|
||||
#if ENABLED(SINGLE_Z_CALIBRATION)
|
||||
VPHELPER(VP_Z_CALIBRATE, nullptr, &DGUSScreenVariableHandler::HandleZCalibration, nullptr),
|
||||
#endif
|
||||
#if ENABLED(FIRST_LAYER_CAL)
|
||||
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &DGUSScreenVariableHandler::HandleFirstLayerCal, nullptr),
|
||||
#endif
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&DGUSScreenVariableHandler::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 =&DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplay },
|
||||
|
||||
// Temperature Data
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E0, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &DGUSScreenVariableHandler::HandlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, &DGUSScreenVariableHandler::HandleFilamentOption, &DGUSScreenVariableHandler::HandleFilamentLoadUnload),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data
|
||||
#if FAN_COUNT
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, DGUSScreenVariableHandler::DGUSLCD_SetValueDirectly<int16_t>, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
#endif
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ),
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintAccTimeToDisplay ),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintsTotalToDisplay ),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe_offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, DGUSScreenVariableHandler::HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, DGUSScreenVariableHandler::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 = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_HIPRECY
|
||||
@@ -0,0 +1,289 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 160,
|
||||
DGUSLCD_SCREEN_MAIN = 1,
|
||||
DGUSLCD_SCREEN_STATUS = 1,
|
||||
DGUSLCD_SCREEN_STATUS2 = 1,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 17,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 40,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 86,
|
||||
DGUSLCD_SCREEN_PREHEAT = 48,
|
||||
DGUSLCD_SCREEN_UTILITY = 70,
|
||||
DGUSLCD_SCREEN_FILAMENT_HEATING = 80,
|
||||
DGUSLCD_SCREEN_FILAMENT_LOADING = 76,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING = 82,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE = 84,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 3,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 7,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 9,
|
||||
DGUSLCD_SCREEN_FLC_PREHEAT = 94,
|
||||
DGUSLCD_SCREEN_FLC_PRINTING = 96,
|
||||
DGUSLCD_SCREEN_STEPPERMM = 122,
|
||||
DGUSLCD_SCREEN_PID_E = 126,
|
||||
DGUSLCD_SCREEN_PID_BED = 128,
|
||||
DGUSLCD_SCREEN_INFOS = 131,
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
// Settings store , reset
|
||||
constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// 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 = 0x3020;
|
||||
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_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_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 = 5; // 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_Print_ProbeOffsetZ = 0x32A0; //
|
||||
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0; //
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x3300;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x3302;
|
||||
//constexpr uint16_t VP_FAN2_STATUS = 0x3304;
|
||||
//constexpr uint16_t VP_FAN3_STATUS = 0x3306;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3310;
|
||||
//constexpr uint16_t VP_E1_STATUS = 0x3312;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3314;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3316;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3318;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x331A;
|
||||
constexpr uint16_t VP_BED_STATUS = 0x331C;
|
||||
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3400;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
//constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
//constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
//constexpr uint16_t VP_Z2_STEP_PER_MM = 0x360A;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
//constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612;
|
||||
//constexpr uint16_t VP_E2_STEP_PER_MM = 0x3614;
|
||||
//constexpr uint16_t VP_E3_STEP_PER_MM = 0x3616;
|
||||
//constexpr uint16_t VP_E4_STEP_PER_MM = 0x3618;
|
||||
//constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A;
|
||||
|
||||
// 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_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;
|
||||
+101
-24
@@ -24,16 +24,21 @@
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD)
|
||||
#if ENABLED(DGUS_LCD_UI_ORIGIN)
|
||||
|
||||
#include "DGUSDisplayDefinition.h"
|
||||
#include "DGUSDisplay.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../../ultralcd.h"
|
||||
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 0.1;
|
||||
#endif
|
||||
|
||||
const uint16_t VPList_Boot[] PROGMEM = {
|
||||
VP_MARLIN_VERSION,
|
||||
0x0000
|
||||
@@ -49,7 +54,7 @@ const uint16_t VPList_Temp[] PROGMEM = {
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_I, VP_T_E1_S,
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
@@ -63,16 +68,16 @@ const uint16_t VPList_Status[] PROGMEM = {
|
||||
VP_T_E0_Is, VP_T_E0_Set,
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VP_T_E1_I, VP_T_E1_S,
|
||||
VP_T_E1_Is, VP_T_E1_Set,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#endif
|
||||
#if FAN_COUNT > 0
|
||||
VP_Fan_Percentage,
|
||||
VP_Fan0_Percentage,
|
||||
#endif
|
||||
VP_XPos, VP_YPos, VP_ZPos,
|
||||
VP_Fan_Percentage,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
VP_PrintProgress_Percentage,
|
||||
0x0000
|
||||
@@ -102,7 +107,7 @@ const uint16_t VPList_ManualExtrude[] PROGMEM = {
|
||||
};
|
||||
|
||||
const uint16_t VPList_FanAndFeedrate[] PROGMEM = {
|
||||
VP_Feedrate_Percentage, VP_Fan_Percentage,
|
||||
VP_Feedrate_Percentage, VP_Fan0_Percentage,
|
||||
0x0000
|
||||
};
|
||||
|
||||
@@ -150,15 +155,33 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Helper to detect touch events
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, DGUSScreenVariableHandler::ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_ASK, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfIdle, nullptr),
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfSD, nullptr),
|
||||
#if ENABLED(SDSUPPORT)
|
||||
VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, DGUSScreenVariableHandler::ScreenChangeHookIfSD, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_CONFIRMED, nullptr, DGUSScreenVariableHandler::ScreenConfirmedOK, nullptr),
|
||||
|
||||
VPHELPER(VP_TEMP_ALL_OFF, nullptr, &DGUSScreenVariableHandler::HandleAllHeatersOff, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_X, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_OPTION, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMoveOption, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DUGS_UI_MOVE_DIS_OPTION)
|
||||
VPHELPER(VP_MOVE_X, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, &distanceToMove, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#else
|
||||
VPHELPER(VP_MOVE_X, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Y, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_MOVE_Z, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
VPHELPER(VP_HOME_ALL, nullptr, &DGUSScreenVariableHandler::HandleManualMove, nullptr),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &DGUSScreenVariableHandler::HandleMotorLockUnlock, nullptr),
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &DGUSScreenVariableHandler::HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
VPHELPER(VP_SETTINGS, nullptr, &DGUSScreenVariableHandler::HandleSettings, nullptr),
|
||||
|
||||
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&DGUSScreenVariableHandler::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
|
||||
@@ -171,39 +194,82 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
VPHELPER(VP_Flowrate_E0, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_EPos, &destination.e, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_MOVE_E0, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
VPHELPER(VP_E0_BED_PREHEAT, nullptr, &DGUSScreenVariableHandler::HandlePreheat, nullptr),
|
||||
#endif
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, &DGUSScreenVariableHandler::HandleFilamentOption, &DGUSScreenVariableHandler::HandleFilamentLoadUnload),
|
||||
#endif
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_T_E1_I, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_S, &thermalManager.temp_hotend[1].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Flowrate_E1, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MOVE_E1, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
|
||||
#endif
|
||||
#if HOTENDS >= 3
|
||||
#error More than 2 Hotends currently not implemented on the Display UI design.
|
||||
VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMP)
|
||||
VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, &DGUSScreenVariableHandler::HandlePIDAutotune, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, &DGUSScreenVariableHandler::HandleHeaterControl, nullptr),
|
||||
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendHeaterStatusToDisplay),
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, DGUSScreenVariableHandler::HandleTemperaturePIDChanged, DGUSScreenVariableHandler::DGUSLCD_SendTemperaturePID),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Fan Data.
|
||||
#if FAN_COUNT > 0
|
||||
VPHELPER(VP_Fan_Percentage, &thermalManager.fan_speed[0], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay),
|
||||
// Fan Data
|
||||
#if FAN_COUNT
|
||||
#define FAN_VPHELPER(N) \
|
||||
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
|
||||
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \
|
||||
VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, &DGUSScreenVariableHandler::DGUSLCD_SendFanStatusToDisplay),
|
||||
REPEAT(FAN_COUNT, FAN_VPHELPER)
|
||||
#endif
|
||||
|
||||
// Feedrate.
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, DGUSScreenVariableHandler::DGUSLCD_SetValueDirectly<int16_t>, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
|
||||
// Position Data.
|
||||
// Position Data
|
||||
VPHELPER(VP_XPos, ¤t_position.x, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_YPos, ¤t_position.y, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Print Progress.
|
||||
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
// Print Progress
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
|
||||
#endif
|
||||
|
||||
// Print Time
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ),
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintAccTimeToDisplay ),
|
||||
VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintsTotalToDisplay ),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], DGUSScreenVariableHandler::HandleStepPerMMChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], DGUSScreenVariableHandler::HandleStepPerMMExtruderChanged, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
// SDCard File listing.
|
||||
#if ENABLED(SDSUPPORT)
|
||||
@@ -217,6 +283,17 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_SendFilename ),
|
||||
VPHELPER(VP_SD_ResumePauseAbort, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ResumePauseAbort, nullptr),
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe_offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, DGUSScreenVariableHandler::HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, DGUSScreenVariableHandler::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.
|
||||
@@ -228,4 +305,4 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD
|
||||
#endif // DGUS_LCD_UI_ORIGIN
|
||||
@@ -0,0 +1,280 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 0,
|
||||
DGUSLCD_SCREEN_MAIN = 10,
|
||||
DGUSLCD_SCREEN_TEMPERATURE = 20,
|
||||
DGUSLCD_SCREEN_STATUS = 30,
|
||||
DGUSLCD_SCREEN_STATUS2 = 32,
|
||||
DGUSLCD_SCREEN_MANUALMOVE = 40,
|
||||
DGUSLCD_SCREEN_MANUALEXTRUDE=42,
|
||||
DGUSLCD_SCREEN_FANANDFEEDRATE = 44,
|
||||
DGUSLCD_SCREEN_FLOWRATES = 46,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 50,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52,
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 100,
|
||||
DGUSLCD_SCREEN_PREHEAT=120,
|
||||
DGUSLCD_SCREEN_UTILITY=110,
|
||||
DGUSLCD_SCREEN_FILAMENT_HEATING=146,
|
||||
DGUSLCD_SCREEN_FILAMENT_LOADING=148,
|
||||
DGUSLCD_SCREEN_FILAMENT_UNLOADING=158,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 170,
|
||||
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;
|
||||
|
||||
// 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_CONTROL = 0x2222;
|
||||
//constexpr uint16_t VP_E2_BED_CONTROL = 0x2224;
|
||||
//constexpr uint16_t VP_E3_BED_CONTROL = 0x2226;
|
||||
//constexpr uint16_t VP_E4_BED_CONTROL = 0x2228;
|
||||
//constexpr uint16_t VP_E5_BED_CONTROL = 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
|
||||
constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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 = 0x3020;
|
||||
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_E4_Is = 0x3074; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
|
||||
//constexpr uint16_t VP_T_E5_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 = 0x33A2; // 2 Byte Integer (0..100)
|
||||
//constexpr uint16_t VP_Fan2_Percentage = 0x33A4; // 2 Byte Integer (0..100)
|
||||
//constexpr uint16_t VP_Fan3_Percentage = 0x33A6; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x3102; // 2 Byte Integer (0..100)
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x3104; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_PrintTime = 0x3106;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 10;
|
||||
|
||||
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;
|
||||
|
||||
// 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
|
||||
|
||||
// SDCard File Listing
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = 5; // 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_Print_ProbeOffsetZ = 0x32A0; //
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x32C0; //
|
||||
|
||||
// Fan status
|
||||
constexpr uint16_t VP_FAN0_STATUS = 0x3300;
|
||||
constexpr uint16_t VP_FAN1_STATUS = 0x3302;
|
||||
//constexpr uint16_t VP_FAN2_STATUS = 0x3304;
|
||||
//constexpr uint16_t VP_FAN3_STATUS = 0x3306;
|
||||
|
||||
// Heater status
|
||||
constexpr uint16_t VP_E0_STATUS = 0x3310;
|
||||
//constexpr uint16_t VP_E1_STATUS = 0x3312;
|
||||
//constexpr uint16_t VP_E2_STATUS = 0x3314;
|
||||
//constexpr uint16_t VP_E3_STATUS = 0x3316;
|
||||
//constexpr uint16_t VP_E4_STATUS = 0x3318;
|
||||
//constexpr uint16_t VP_E5_STATUS = 0x331A;
|
||||
constexpr uint16_t VP_BED_STATUS = 0x331C;
|
||||
|
||||
constexpr uint16_t VP_MOVE_OPTION = 0x3400;
|
||||
|
||||
// Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , 2 byte unsigned int , 0~1638.4
|
||||
//constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
//constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
//constexpr uint16_t VP_Z2_STEP_PER_MM = 0x360A;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
//constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612;
|
||||
//constexpr uint16_t VP_E2_STEP_PER_MM = 0x3614;
|
||||
//constexpr uint16_t VP_E3_STEP_PER_MM = 0x3616;
|
||||
//constexpr uint16_t VP_E4_STEP_PER_MM = 0x3618;
|
||||
//constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A;
|
||||
|
||||
// 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_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;
|
||||
@@ -80,7 +80,7 @@ uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const {
|
||||
/************************** HOST COMMAND FUNCTION *********************************/
|
||||
|
||||
void CLCD::host_cmd (unsigned char host_command, unsigned char byte2) { // Sends 24-Bit Host Command to LCD
|
||||
if (host_command != ACTIVE) {
|
||||
if (host_command != FTDI::ACTIVE) {
|
||||
host_command |= 0x40;
|
||||
}
|
||||
spi_ftdi_select();
|
||||
@@ -1062,7 +1062,7 @@ void CLCD::init() {
|
||||
host_cmd(CLKINT, 0);
|
||||
}
|
||||
|
||||
host_cmd(ACTIVE, 0); // Activate the System Clock
|
||||
host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock
|
||||
|
||||
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */
|
||||
uint8_t counter;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user