Partial
This commit is contained in:
+44
-23
@@ -53,7 +53,7 @@
|
||||
|
||||
#define tallVersion
|
||||
|
||||
#define ABL_Bilinear
|
||||
//#define ABL_Bilinear
|
||||
/*
|
||||
* Enables a filament sensor plugged into the laser pin. Disables the laser
|
||||
*/
|
||||
@@ -435,6 +435,7 @@
|
||||
* 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
|
||||
* 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
|
||||
* 15 : 100k thermistor calibration for JGAurora A5 hotend
|
||||
* 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327
|
||||
* 20 : the PT100 circuit found in the Ultimainboard V2.x
|
||||
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
||||
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
|
||||
@@ -460,7 +461,7 @@
|
||||
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
|
||||
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
|
||||
*
|
||||
* :{ '0':"Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595", '998':"Dummy 1", '999':"Dummy 2", '1000':"Custom thermistor params" }
|
||||
* :{ '0':"Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '18':"ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327" '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595", '998':"Dummy 1", '999':"Dummy 2", '1000':"Custom thermistor params" }
|
||||
*/
|
||||
#if ENABLED(TREX3)
|
||||
#define TEMP_SENSOR_0 61
|
||||
@@ -755,7 +756,7 @@
|
||||
#if ENABLED(Z_2208)
|
||||
#define Z_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#elif ENABLED(Z_4988)
|
||||
#define Z_DRIVER_TYPE A4988
|
||||
#define Z_DRIVER_TYPE A4988
|
||||
#else
|
||||
#define Z_DRIVER_TYPE DRV8825
|
||||
#endif
|
||||
@@ -766,7 +767,7 @@
|
||||
#define E0_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#define E1_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#else
|
||||
#define E0_DRIVER_TYPE DRV8825
|
||||
#define E0_DRIVER_TYPE DRV8825
|
||||
#define E1_DRIVER_TYPE DRV8825
|
||||
#endif
|
||||
//#define E2_DRIVER_TYPE A4988
|
||||
@@ -965,6 +966,22 @@
|
||||
*/
|
||||
#define BLTOUCH
|
||||
|
||||
/**
|
||||
* Touch-MI Probe by hotends.fr
|
||||
*
|
||||
* This probe is deployed and activated by moving the X-axis to a magnet at the edge of the bed.
|
||||
* By default, the magnet is assumed to be on the left and activated by a home. If the magnet is
|
||||
* on the right, enable and set TOUCH_MI_DEPLOY_XPOS to the deploy position.
|
||||
*
|
||||
* Also requires: BABYSTEPPING, BABYSTEP_ZPROBE_OFFSET, Z_SAFE_HOMING,
|
||||
* MIN_PROBE_EDGE, and a minimum Z_HOMING_HEIGHT of 10.
|
||||
*/
|
||||
//#define TOUCH_MI_PROBE
|
||||
#if ENABLED(TOUCH_MI_PROBE)
|
||||
#define TOUCH_MI_RETRACT_Z 0.5 // Height at which the probe retracts
|
||||
//#define TOUCH_MI_DEPLOY_XPOS (X_MAX_BED + 2) // For a magnet on the right side of the bed
|
||||
#endif
|
||||
|
||||
// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN)
|
||||
//#define SOLENOID_PROBE
|
||||
|
||||
@@ -984,23 +1001,23 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* Z Probe to nozzle (X,Y) offset, relative to (0, 0).
|
||||
* X and Y offsets must be integers.
|
||||
* Z Probe to nozzle (X,Y) offset, relative to (0, 0).
|
||||
* X and Y offsets must be integers.
|
||||
*
|
||||
* In the following example the X and Y offsets are both positive:
|
||||
* #define X_PROBE_OFFSET_FROM_EXTRUDER 10
|
||||
* #define Y_PROBE_OFFSET_FROM_EXTRUDER 10
|
||||
* In the following example the X and Y offsets are both positive:
|
||||
* #define X_PROBE_OFFSET_FROM_EXTRUDER 10
|
||||
* #define Y_PROBE_OFFSET_FROM_EXTRUDER 10
|
||||
*
|
||||
* +-- BACK ---+
|
||||
* | |
|
||||
* L | (+) P | R <-- probe (20,20)
|
||||
* E | | I
|
||||
* F | (-) N (+) | G <-- nozzle (10,10)
|
||||
* T | | H
|
||||
* | (-) | T
|
||||
* | |
|
||||
* O-- FRONT --+
|
||||
* (0,0)
|
||||
* +-- BACK ---+
|
||||
* | |
|
||||
* L | (+) P | R <-- probe (20,20)
|
||||
* E | | I
|
||||
* F | (-) N (+) | G <-- nozzle (10,10)
|
||||
* T | | H
|
||||
* | (-) | T
|
||||
* | |
|
||||
* O-- FRONT --+
|
||||
* (0,0)
|
||||
*/
|
||||
|
||||
#if ENABLED(TREX3)
|
||||
@@ -1338,10 +1355,10 @@
|
||||
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
|
||||
|
||||
// Set the boundaries for probing (where the probe can reach).
|
||||
#define LEFT_PROBE_BED_POSITION (MAX(X_MIN_BED + MIN_PROBE_EDGE, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) + 5
|
||||
#define FRONT_PROBE_BED_POSITION (MAX(Y_MIN_BED + MIN_PROBE_EDGE, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER)) + 5
|
||||
#define RIGHT_PROBE_BED_POSITION (MIN(X_MAX_BED - (MIN_PROBE_EDGE), X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) - 5
|
||||
#define BACK_PROBE_BED_POSITION (MIN(Y_MAX_BED - (MIN_PROBE_EDGE), Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER)) - 5
|
||||
//#define LEFT_PROBE_BED_POSITION MIN_PROBE_EDGE
|
||||
//#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - (MIN_PROBE_EDGE))
|
||||
//#define FRONT_PROBE_BED_POSITION MIN_PROBE_EDGE
|
||||
//#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - (MIN_PROBE_EDGE))
|
||||
|
||||
// Probe along the Y axis, advancing X after each column
|
||||
//#define PROBE_Y_FIRST
|
||||
@@ -2265,6 +2282,10 @@
|
||||
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
|
||||
#define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255)
|
||||
//#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup
|
||||
|
||||
// Use a single Neopixel LED for static (background) lighting
|
||||
//#define NEOPIXEL_BKGD_LED_INDEX 0 // Index of the LED to use
|
||||
//#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
+48
-25
@@ -316,7 +316,7 @@
|
||||
* 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
|
||||
* 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 behaviour.
|
||||
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
|
||||
*
|
||||
* USE_OCR2A_AS_TOP [undefined by default]
|
||||
* Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2:
|
||||
@@ -381,17 +381,14 @@
|
||||
#define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW
|
||||
#define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on
|
||||
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin)
|
||||
#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu
|
||||
#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu
|
||||
#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting.
|
||||
//#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED.
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
//============================ Mechanical Settings ==========================
|
||||
//===========================================================================
|
||||
|
||||
// @section homing
|
||||
|
||||
// If you want endstops to stay on (by default) even when not homing
|
||||
@@ -655,12 +652,11 @@
|
||||
// @section lcd
|
||||
|
||||
#if EITHER(ULTIPANEL, EXTENSIBLE_UI)
|
||||
#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
#define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions
|
||||
#define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder
|
||||
#define MANUAL_FEEDRATE { 50*60, 50*60, 4*60, 60 } // Feedrates for manual moves along X, Y, Z, E from panel
|
||||
#if ENABLED(ULTIPANEL)
|
||||
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
||||
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// @section extras
|
||||
@@ -822,6 +818,7 @@
|
||||
* A (A shifted) B (B shifted) IC
|
||||
* Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451
|
||||
* AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451
|
||||
* AZTEEG_X5_MINI 0x2C (0x58) 0x2E (0x5C) MCP4451
|
||||
* AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451
|
||||
* MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018
|
||||
*/
|
||||
@@ -918,7 +915,7 @@
|
||||
|
||||
//#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files
|
||||
|
||||
#define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
|
||||
#define EVENT_GCODE_SD_STOP "G28X\nM84" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
|
||||
|
||||
/**
|
||||
* Continue after Power-Loss (Creality3D)
|
||||
@@ -932,8 +929,8 @@
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
//#define POWER_LOSS_PIN 44 // Pin to detect power loss
|
||||
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
||||
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
|
||||
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.
|
||||
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
|
||||
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.
|
||||
|
||||
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
|
||||
// especially with "vase mode" printing. Set too high and vases cannot be continued.
|
||||
@@ -984,12 +981,15 @@
|
||||
// Enable this option to scroll long filenames in the SD card menu
|
||||
#define SCROLL_LONG_FILENAMES
|
||||
|
||||
// Leave the heaters on after Stop Print (not recommended!)
|
||||
//#define SD_ABORT_NO_COOLDOWN
|
||||
|
||||
/**
|
||||
* This option allows you to abort SD printing when any endstop is triggered.
|
||||
* This feature must be enabled with "M540 S1" or from the LCD menu.
|
||||
* To have any effect, endstops must be enabled during SD printing.
|
||||
*/
|
||||
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
//#define SD_ABORT_ON_ENDSTOP_HIT
|
||||
|
||||
/**
|
||||
* This option makes it easier to print the same SD Card file again.
|
||||
@@ -1119,6 +1119,7 @@
|
||||
#define STATUS_HOTEND_INVERTED // Show solid nozzle bitmaps when heating (Requires STATUS_HOTEND_ANIM)
|
||||
#define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating
|
||||
#define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating
|
||||
#define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating
|
||||
//#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap
|
||||
//#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
|
||||
//#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
|
||||
@@ -1308,7 +1309,8 @@
|
||||
/**
|
||||
* Minimum stepper driver pulse width (in µs)
|
||||
* 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers
|
||||
* 1 : Minimum for A4988, A5984, and LV8729 stepper drivers
|
||||
* 0 : Minimum 500ns for LV8729, adjusted in stepper.h
|
||||
* 1 : Minimum for A4988 and A5984 stepper drivers
|
||||
* 2 : Minimum for DRV8825 stepper drivers
|
||||
* 3 : Minimum for TB6600 stepper drivers
|
||||
* 30 : Minimum for TB6560 stepper drivers
|
||||
@@ -1323,8 +1325,8 @@
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 400000 : Maximum for TMC2xxx stepper drivers
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 200000 : Maximum for LV8729 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 130000 : Maximum for LV8729 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
*
|
||||
* Override the default value based on the driver type set in Configuration.h.
|
||||
@@ -1461,7 +1463,7 @@
|
||||
#if EXTRUDERS > 1
|
||||
// Z raise distance for tool-change, as needed for some extruders
|
||||
#define TOOLCHANGE_ZRAISE 1 // (mm)
|
||||
#define TOOLCHANGE_RETURN_NEXT_MOVE // Instead of returning to old position, wait for next move command
|
||||
#define TOOLCHANGE_NO_RETURN // Don't return to the previous position on tool-change
|
||||
|
||||
// Retract and prime filament on tool-change
|
||||
#define TOOLCHANGE_FILAMENT_SWAP
|
||||
@@ -1860,6 +1862,12 @@
|
||||
//#define Z_STALL_SENSITIVITY 8
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Beta feature!
|
||||
* Create a 50/50 square wave step pulse optimal for stepper drivers.
|
||||
*/
|
||||
//#define SQUARE_WAVE_STEPPING
|
||||
|
||||
/**
|
||||
* Enable M122 debugging command for TMC stepper drivers.
|
||||
* M122 S0/1 will enable continous reporting.
|
||||
@@ -2140,6 +2148,21 @@
|
||||
//#define SPEED_POWER_MAX 100 // 0-100%
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Coolant Control
|
||||
*
|
||||
* Add the M7, M8, and M9 commands to turn mist or flood coolant on and off.
|
||||
*
|
||||
* Note: COOLANT_MIST_PIN and/or COOLANT_FLOOD_PIN must also be defined.
|
||||
*/
|
||||
//#define COOLANT_CONTROL
|
||||
#if ENABLED(COOLANT_CONTROL)
|
||||
#define COOLANT_MIST // Enable if mist coolant is present
|
||||
#define COOLANT_FLOOD // Enable if flood coolant is present
|
||||
#define COOLANT_MIST_INVERT false // Set "true" if the on/off function is reversed
|
||||
#define COOLANT_FLOOD_INVERT false // Set "true" if the on/off function is reversed
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Filament Width Sensor
|
||||
*
|
||||
@@ -2263,7 +2286,7 @@
|
||||
#define CUSTOM_USER_MENUS
|
||||
#if ENABLED(CUSTOM_USER_MENUS)
|
||||
//#define USER_SCRIPT_DONE "M117 User Script Done"
|
||||
#define CUSTOM_USER_MENU_TITLE "Commissioning"
|
||||
#define CUSTOM_USER_MENU_TITLE "Setup"
|
||||
#define USER_SCRIPT_AUDIBLE_FEEDBACK
|
||||
#define USER_SCRIPT_RETURN // Return to status screen after a script
|
||||
|
||||
@@ -2273,7 +2296,7 @@
|
||||
#define COMMFANNSPEED "M106 S128 \n"
|
||||
#endif
|
||||
|
||||
#define USER_DESC_1 "Mesh Commission"
|
||||
#define USER_DESC_1 "Mesh Setup"
|
||||
#define USER_DESC_3 "Prep for Z Adjust"
|
||||
#if ENABLED(ABL_Bilinear)
|
||||
#define USER_GCODE_1 "M502 \n M500 \n M501 \n M190 S75 \n G28 \n G29 \n M500 \n G28 \n M420 S1 \n " COMMFANNSPEED " M109 S225 \n G1 X100 Y 100 \n G1 Z0 \n M77 \n M117 Set Z Offset"
|
||||
@@ -2286,8 +2309,8 @@
|
||||
#define USER_DESC_4 "Fill Mesh Points"
|
||||
#define USER_GCODE_4 "G29 P3 \n G29 P3 \n G29 P3 \n G29 T"
|
||||
|
||||
#define USER_DESC_2 "PID Tune"
|
||||
#define USER_GCODE_2 "M106 S128 \n M303 C8 S225 E1 U \n M500 \n M117 PID Tune Done"
|
||||
#define USER_DESC_2 "PID Bed"
|
||||
#define USER_GCODE_2 "M303 C4 S75 E-1 U \n M500 \n M117 PID Tune Done"
|
||||
|
||||
#define USER_DESC_5 "Run Mesh Validation"
|
||||
#define USER_GCODE_5 "G26"
|
||||
@@ -2378,7 +2401,7 @@
|
||||
|
||||
//#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given
|
||||
// axis after which the printer will abort. Comment out to
|
||||
// disable abort behaviour.
|
||||
// disable abort behavior.
|
||||
|
||||
#define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault
|
||||
// for this amount of time (in ms) before the encoder
|
||||
@@ -2438,7 +2461,7 @@
|
||||
//#define NANODLP_Z_SYNC
|
||||
#if ENABLED(NANODLP_Z_SYNC)
|
||||
//#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move.
|
||||
// Default behaviour is limited to Z axis only.
|
||||
// Default behavior is limited to Z axis only.
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Originally from Arduino Sd2Card Library
|
||||
* Adapted from Arduino Sd2Card Library
|
||||
* Copyright (C) 2009 by William Greiman
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description: HAL for AVR - SPI functions
|
||||
* HAL for AVR - SPI functions
|
||||
*/
|
||||
|
||||
#ifdef __AVR__
|
||||
@@ -37,35 +37,24 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Public Variables
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Public functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
void spiBegin (void) {
|
||||
SET_OUTPUT(SS_PIN);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
void spiBegin(void) {
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
|
||||
#if DISABLED(SOFTWARE_SPI)
|
||||
// SS must be in output mode even it is not chip select
|
||||
SET_OUTPUT(SS_PIN);
|
||||
//SET_OUTPUT(SS_PIN);
|
||||
// set SS high - may be chip select for another SPI device
|
||||
#if SET_SPI_SS_HIGH
|
||||
WRITE(SS_PIN, HIGH);
|
||||
#endif // SET_SPI_SS_HIGH
|
||||
//#if SET_SPI_SS_HIGH
|
||||
//WRITE(SS_PIN, HIGH);
|
||||
//#endif
|
||||
// set a default rate
|
||||
spiInit(1);
|
||||
#endif // SOFTWARE_SPI
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if DISABLED(SOFTWARE_SPI, FORCE_SOFT_SPI)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -190,22 +179,26 @@ void spiBegin (void) {
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
#else // SOFTWARE_SPI || FORCE_SOFT_SPI
|
||||
|
||||
/** nop to tune soft SPI timing */
|
||||
//------------------------------------------------------------------------------
|
||||
// Software SPI
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// nop to tune soft SPI timing
|
||||
#define nop asm volatile ("\tnop\n")
|
||||
|
||||
/** Set SPI rate */
|
||||
// Set SPI rate
|
||||
void spiInit(uint8_t spiRate) {
|
||||
UNUSED(spiRate); // nothing to do
|
||||
}
|
||||
|
||||
/** Begin SPI transaction, set clock, bit order, data mode */
|
||||
// Begin SPI transaction, set clock, bit order, data mode
|
||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
||||
UNUSED(spiBeginTransaction); // nothing to do
|
||||
}
|
||||
|
||||
/** Soft SPI receive byte */
|
||||
// Soft SPI receive byte
|
||||
uint8_t spiRec() {
|
||||
uint8_t data = 0;
|
||||
// no interrupts during byte receive - about 8µs
|
||||
@@ -230,13 +223,13 @@ void spiBegin (void) {
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Soft SPI read 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 */
|
||||
// Soft SPI send byte
|
||||
void spiSend(uint8_t data) {
|
||||
// no interrupts during byte send - about 8µs
|
||||
cli();
|
||||
@@ -257,13 +250,13 @@ void spiBegin (void) {
|
||||
sei();
|
||||
}
|
||||
|
||||
/** Soft SPI send block */
|
||||
// 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]);
|
||||
}
|
||||
|
||||
#endif // SOFTWARE_SPI, FORCE_SOFT_SPI
|
||||
#endif // SOFTWARE_SPI || FORCE_SOFT_SPI
|
||||
|
||||
#endif // __AVR__
|
||||
|
||||
@@ -37,9 +37,10 @@
|
||||
*/
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include <stdint.h>
|
||||
#include "../../module/endstops.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// One ISR for all EXT-Interrupts
|
||||
void endstop_ISR(void) { endstops.update(); }
|
||||
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
* Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al.
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "../../core/macros.h"
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
|
||||
#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
|
||||
#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include "../../core/serial.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "../shared/backtrace/unwinder.h"
|
||||
#include "../shared/backtrace/unwmemaccess.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
// Debug monitor that dumps to the Programming port all status when
|
||||
// an exception or WDT timeout happens - And then resets the board
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
|
||||
#define NUM_HARDWARE_TIMERS 9
|
||||
|
||||
#define PRESCALER 2
|
||||
// --------------------------------------------------------------------------
|
||||
// Types
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -87,5 +87,21 @@
|
||||
#define HANDLER_FOR_TIMER5 TC0_Handler
|
||||
#endif
|
||||
|
||||
//typedef enum { _timer1, _timer2, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t;
|
||||
typedef enum { _timer3, _timer5, _Nbr_16timers } timer16_Sequence_t;
|
||||
typedef enum : unsigned char {
|
||||
#ifdef _useTimer1
|
||||
_timer1,
|
||||
#endif
|
||||
#ifdef _useTimer2
|
||||
_timer2,
|
||||
#endif
|
||||
#ifdef _useTimer3
|
||||
_timer3,
|
||||
#endif
|
||||
#ifdef _useTimer4
|
||||
_timer4,
|
||||
#endif
|
||||
#ifdef _useTimer5
|
||||
_timer5,
|
||||
#endif
|
||||
_Nbr_16timers
|
||||
} timer16_Sequence_t;
|
||||
|
||||
@@ -26,19 +26,22 @@
|
||||
*
|
||||
* Available chip select pins for HW SPI are 4 10 52 77
|
||||
*/
|
||||
#if (SDSS == 4) || (SDSS == 10) || (SDSS == 52) || (SDSS == 77)
|
||||
#if (SDSS == 4)
|
||||
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
|
||||
#if SDSS == 4
|
||||
#define SPI_PIN 87
|
||||
#define SPI_CHAN 1
|
||||
#elif (SDSS == 10)
|
||||
#elif SDSS == 10
|
||||
#define SPI_PIN 77
|
||||
#define SPI_CHAN 0
|
||||
#elif (SDSS == 52)
|
||||
#elif SDSS == 52
|
||||
#define SPI_PIN 86
|
||||
#define SPI_CHAN 2
|
||||
#else
|
||||
#elif SDSS == 77
|
||||
#define SPI_PIN 77
|
||||
#define SPI_CHAN 0
|
||||
#else
|
||||
#define SPI_PIN 87
|
||||
#define SPI_CHAN 1
|
||||
#endif
|
||||
#define SCK_PIN 76
|
||||
#define MISO_PIN 74
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_GRAPHICAL_LCD && !ENABLED(U8GLIB_ST7920)
|
||||
#if HAS_GRAPHICAL_LCD && DISABLED(U8GLIB_ST7920)
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
@@ -144,5 +144,5 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
#endif // HAS_GRAPHICAL_LCD && !U8GLIB_ST7920
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
|
||||
@@ -67,9 +67,9 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
|
||||
.bLength = sizeof(usb_dev_desc_t),
|
||||
.bDescriptorType = USB_DT_DEVICE,
|
||||
.bcdUSB = LE16(USB_V2_0),
|
||||
.bDeviceClass = 0,
|
||||
.bDeviceSubClass = 0,
|
||||
.bDeviceProtocol = 0,
|
||||
.bDeviceClass = CDC_CLASS_MULTI,
|
||||
.bDeviceSubClass = CDC_SUBCLASS_ACM,
|
||||
.bDeviceProtocol = CDC_PROTOCOL_V25TER,
|
||||
.bMaxPacketSize0 = USB_DEVICE_EP_CTRL_SIZE,
|
||||
.idVendor = LE16(USB_DEVICE_VENDOR_ID),
|
||||
.idProduct = LE16(USB_DEVICE_PRODUCT_ID),
|
||||
@@ -101,9 +101,9 @@ UDC_DESC_STORAGE usb_dev_qual_desc_t udc_device_qual = {
|
||||
.bLength = sizeof(usb_dev_qual_desc_t),
|
||||
.bDescriptorType = USB_DT_DEVICE_QUALIFIER,
|
||||
.bcdUSB = LE16(USB_V2_0),
|
||||
.bDeviceClass = 0,
|
||||
.bDeviceSubClass = 0,
|
||||
.bDeviceProtocol = 0,
|
||||
.bDeviceClass = CDC_CLASS_MULTI,
|
||||
.bDeviceSubClass = CDC_SUBCLASS_ACM,
|
||||
.bDeviceProtocol = CDC_PROTOCOL_V25TER,
|
||||
.bMaxPacketSize0 = USB_DEVICE_EP_CTRL_SIZE,
|
||||
.bNumConfigurations = 1
|
||||
};
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
#define CDC_CLASS_DEVICE 0x02 //!< USB Communication Device Class
|
||||
#define CDC_CLASS_COMM 0x02 //!< CDC Communication Class Interface
|
||||
#define CDC_CLASS_DATA 0x0A //!< CDC Data Class Interface
|
||||
#define CDC_CLASS_MULTI 0xEF //!< CDC Multi-interface Function
|
||||
|
||||
//@}
|
||||
|
||||
//! \name USB CDC Subclass IDs
|
||||
|
||||
@@ -148,7 +148,7 @@ adc1_channel_t get_channel(int pin) {
|
||||
void HAL_adc_init() {
|
||||
// Configure ADC
|
||||
adc1_config_width(ADC_WIDTH_12Bit);
|
||||
|
||||
|
||||
// Configure channels only if used as (re-)configuring a pin for ADC that is used elsewhere might have adverse effects
|
||||
#if HAS_TEMP_ADC_0
|
||||
adc1_config_channel_atten(get_channel(TEMP_0_PIN), ADC_ATTEN_11db);
|
||||
@@ -193,6 +193,9 @@ void HAL_adc_start_conversion(uint8_t adc_pin) {
|
||||
}
|
||||
|
||||
void analogWrite(int pin, int value) {
|
||||
|
||||
if (!PWM_PIN(pin)) return;
|
||||
|
||||
static int cnt_channel = 1,
|
||||
pin_to_channel[40] = {};
|
||||
if (pin_to_channel[pin] == 0) {
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
|
||||
#include "HAL_Servo_ESP32.h"
|
||||
|
||||
int Servo::channel_next_free = 0;
|
||||
// Adjacent channels (0/1, 2/3 etc.) share the same timer and therefore the same frequency and resolution settings on ESP32,
|
||||
// so we only allocate servo channels up high to avoid side effects with regards to analogWrite (fans, leds, laser pwm etc.)
|
||||
int Servo::channel_next_free = 12;
|
||||
|
||||
Servo::Servo() {
|
||||
this->channel = channel_next_free++;
|
||||
@@ -42,7 +44,7 @@ int8_t Servo::attach(const int pin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Servo::detach() { ledcDetachPin(this->pin) }
|
||||
void Servo::detach() { ledcDetachPin(this->pin); }
|
||||
|
||||
int Servo::read() { return this->degrees; }
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "HAL.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "pins_arduino.h"
|
||||
#include <pins_arduino.h>
|
||||
#include "spi_pins.h"
|
||||
#include "../../core/macros.h"
|
||||
#include <SPI.h>
|
||||
@@ -62,8 +62,7 @@ void spiBegin() {
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
|
||||
WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SS_PIN);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "i2s.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../../core/macros.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "rom/lldesc.h"
|
||||
#include "soc/i2s_struct.h"
|
||||
|
||||
@@ -33,9 +33,3 @@ uint8_t i2s_state(uint8_t pin);
|
||||
void i2s_write(uint8_t pin, uint8_t val);
|
||||
|
||||
void i2s_push_sample();
|
||||
|
||||
// pin definitions
|
||||
|
||||
#define I2S_WS 25
|
||||
#define I2S_BCK 26
|
||||
#define I2S_DATA 27
|
||||
|
||||
@@ -49,7 +49,7 @@ void Heater::update() {
|
||||
last = now;
|
||||
heat += (heater_state - heat) * (delta / 1000000000.0);
|
||||
|
||||
if (heat < room_temp_raw) heat = room_temp_raw;
|
||||
NOLESS(heat, room_temp_raw);
|
||||
Gpio::pin_map[analogInputToDigitalPin(adc_pin)].value = 0xFFFF - (uint16_t)heat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "src/core/macros.h"
|
||||
#include "../../core/macros.h"
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if BOTH(SDSUPPORT, DOGLCD) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
||||
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||
|
||||
@@ -78,13 +78,11 @@ void HAL_init() {
|
||||
//_DBG("\n\nDebug running\n");
|
||||
// Initialise the SD card chip select pins as soon as possible
|
||||
#if PIN_EXISTS(SS)
|
||||
WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SS_PIN);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
#if defined(ONBOARD_SD_CS) && ONBOARD_SD_CS > -1
|
||||
WRITE(ONBOARD_SD_CS, HIGH);
|
||||
SET_OUTPUT(ONBOARD_SD_CS);
|
||||
OUT_WRITE(ONBOARD_SD_CS, HIGH);
|
||||
#endif
|
||||
|
||||
USB_Init(); // USB Initialization
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "src/core/macros.h"
|
||||
#include "../../core/macros.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT) && HAS_GRAPHICAL_LCD && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
||||
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
@@ -69,8 +69,7 @@ void spiBegin(void) {
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
|
||||
SET_OUTPUT(SS_PIN);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
/** Configure SPI for specified SPI speed */
|
||||
|
||||
@@ -32,9 +32,10 @@
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include "HAL.h"
|
||||
#include <STM32ADC.h>
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include <STM32ADC.h>
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Externals
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -45,8 +46,7 @@
|
||||
|
||||
#define __I
|
||||
#define __IO volatile
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
__I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
||||
__IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
||||
__IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
|
||||
@@ -161,12 +161,11 @@ enum TEMP_PINS : char {
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH,
|
||||
#endif
|
||||
ADC_PIN_COUNT
|
||||
ADC_PIN_COUNT
|
||||
};
|
||||
|
||||
uint16_t HAL_adc_results[ADC_PIN_COUNT];
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Function prototypes
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -209,6 +208,9 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
|
||||
|
||||
void HAL_init(void) {
|
||||
NVIC_SetPriorityGrouping(0x3);
|
||||
#if PIN_EXISTS(LED)
|
||||
OUT_WRITE(LED_PIN, LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* VGPV Done with defines
|
||||
@@ -313,4 +315,15 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
|
||||
uint16_t HAL_adc_get_result(void) { return HAL_adc_result; }
|
||||
|
||||
uint16_t analogRead(pin_t pin) {
|
||||
const bool is_analog = _GET_MODE(pin) == GPIO_INPUT_ANALOG;
|
||||
return is_analog ? analogRead(uint8_t(pin)) : 0;
|
||||
}
|
||||
|
||||
// Wrapper to maple unprotected analogWrite
|
||||
void analogWrite(pin_t pin, int pwm_val8) {
|
||||
if (PWM_PIN(pin) && IS_OUTPUT(pin))
|
||||
analogWrite(uint8_t(pin), pwm_val8);
|
||||
}
|
||||
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -255,6 +255,9 @@ void HAL_adc_init(void);
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
uint16_t HAL_adc_get_result(void);
|
||||
|
||||
uint16_t analogRead(pin_t pin); // need HAL_ANALOG_SELECT() first
|
||||
void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
|
||||
|
||||
#define GET_PIN_MAP_PIN(index) index
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
uint8_t ServoCount = 0;
|
||||
|
||||
#include "HAL_Servo_STM32F1.h"
|
||||
#include "HAL_timers_STM32F1.h"
|
||||
|
||||
//#include "Servo.h"
|
||||
|
||||
@@ -46,7 +47,7 @@ uint8_t ServoCount = 0;
|
||||
*
|
||||
* This uses the smallest prescaler that allows an overflow < 2^16.
|
||||
*/
|
||||
#define MAX_OVERFLOW ((1 << 16) - 1)
|
||||
#define MAX_OVERFLOW UINT16_MAX //((1 << 16) - 1)
|
||||
#define CYC_MSEC (1000 * CYCLES_PER_MICROSECOND)
|
||||
#define TAU_MSEC 20
|
||||
#define TAU_USEC (TAU_MSEC * 1000)
|
||||
@@ -62,22 +63,45 @@ uint8_t ServoCount = 0;
|
||||
#define US_TO_ANGLE(us) ((int16_t)(map((us), SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW, \
|
||||
this->minAngle, this->maxAngle)))
|
||||
|
||||
void libServo::servoWrite(uint8_t pin, uint16_t duty_cycle) {
|
||||
#ifdef SERVO0_TIMER_NUM
|
||||
if (this->servoIndex == 0) {
|
||||
this->pwmSetDuty(duty_cycle);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
timer_dev *tdev = PIN_MAP[pin].timer_device;
|
||||
uint8_t tchan = PIN_MAP[pin].timer_channel;
|
||||
if (tdev) timer_set_compare(tdev, tchan, duty_cycle);
|
||||
}
|
||||
|
||||
libServo::libServo() {
|
||||
this->servoIndex = ServoCount < MAX_SERVOS ? ServoCount++ : INVALID_SERVO;
|
||||
}
|
||||
|
||||
bool libServo::attach(const int32_t pin, const int32_t minAngle, const int32_t maxAngle) {
|
||||
if (this->servoIndex >= MAX_SERVOS) return false;
|
||||
if (!PWM_PIN(pin)) return false;
|
||||
if (pin >= BOARD_NR_GPIO_PINS) return false;
|
||||
|
||||
this->minAngle = minAngle;
|
||||
this->maxAngle = maxAngle;
|
||||
this->angle = -1;
|
||||
|
||||
#ifdef SERVO0_TIMER_NUM
|
||||
if (this->servoIndex == 0 && this->setupSoftPWM(pin)) {
|
||||
this->pin = pin; // set attached()
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!PWM_PIN(pin)) return false;
|
||||
|
||||
timer_dev *tdev = PIN_MAP[pin].timer_device;
|
||||
uint8_t tchan = PIN_MAP[pin].timer_channel;
|
||||
//uint8_t tchan = PIN_MAP[pin].timer_channel;
|
||||
|
||||
pinMode(pin, PWM);
|
||||
pwmWrite(pin, 0);
|
||||
SET_PWM(pin);
|
||||
servoWrite(pin, 0);
|
||||
|
||||
timer_pause(tdev);
|
||||
timer_set_prescaler(tdev, SERVO_PRESCALER - 1); // prescaler is 1-based
|
||||
@@ -92,12 +116,16 @@ bool libServo::attach(const int32_t pin, const int32_t minAngle, const int32_t m
|
||||
|
||||
bool libServo::detach() {
|
||||
if (!this->attached()) return false;
|
||||
pwmWrite(this->pin, 0);
|
||||
this->angle = -1;
|
||||
servoWrite(this->pin, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t libServo::read() const {
|
||||
if (this->attached()) {
|
||||
#ifdef SERVO0_TIMER_NUM
|
||||
if (this->servoIndex == 0) return this->angle;
|
||||
#endif
|
||||
timer_dev *tdev = PIN_MAP[this->pin].timer_device;
|
||||
uint8_t tchan = PIN_MAP[this->pin].timer_channel;
|
||||
return US_TO_ANGLE(COMPARE_TO_US(timer_get_compare(tdev, tchan)));
|
||||
@@ -110,13 +138,95 @@ void libServo::move(const int32_t value) {
|
||||
static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
|
||||
|
||||
if (this->attached()) {
|
||||
pwmWrite(this->pin, US_TO_COMPARE(ANGLE_TO_US(constrain(value, this->minAngle, this->maxAngle))));
|
||||
this->angle = constrain(value, this->minAngle, this->maxAngle);
|
||||
servoWrite(this->pin, US_TO_COMPARE(ANGLE_TO_US(this->angle)));
|
||||
safe_delay(servo_delay[this->servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
this->detach();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SERVO0_TIMER_NUM
|
||||
extern "C" void Servo_IRQHandler(void) {
|
||||
static timer_dev *tdev = get_timer_dev(SERVO0_TIMER_NUM);
|
||||
uint16_t SR = timer_get_status(tdev);
|
||||
if (SR & TIMER_SR_CC1IF) { // channel 1 off
|
||||
#ifdef SERVO0_PWM_OD
|
||||
OUT_WRITE_OD(SERVO0_PIN, 1); // off
|
||||
#else
|
||||
OUT_WRITE(SERVO0_PIN, 0);
|
||||
#endif
|
||||
timer_reset_status_bit(tdev, TIMER_SR_CC1IF_BIT);
|
||||
}
|
||||
if (SR & TIMER_SR_CC2IF) { // channel 2 resume
|
||||
#ifdef SERVO0_PWM_OD
|
||||
OUT_WRITE_OD(SERVO0_PIN, 0); // on
|
||||
#else
|
||||
OUT_WRITE(SERVO0_PIN, 1);
|
||||
#endif
|
||||
timer_reset_status_bit(tdev, TIMER_SR_CC2IF_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
bool libServo::setupSoftPWM(const int32_t pin) {
|
||||
timer_dev *tdev = get_timer_dev(SERVO0_TIMER_NUM);
|
||||
if (!tdev) return false;
|
||||
#ifdef SERVO0_PWM_OD
|
||||
OUT_WRITE_OD(pin, 1);
|
||||
#else
|
||||
OUT_WRITE(pin, 0);
|
||||
#endif
|
||||
|
||||
timer_pause(tdev);
|
||||
timer_set_mode(tdev, 1, TIMER_OUTPUT_COMPARE); // counter with isr
|
||||
timer_oc_set_mode(tdev, 1, TIMER_OC_MODE_FROZEN, 0); // no pin output change
|
||||
timer_oc_set_mode(tdev, 2, TIMER_OC_MODE_FROZEN, 0); // no pin output change
|
||||
timer_set_prescaler(tdev, SERVO_PRESCALER - 1); // prescaler is 1-based
|
||||
timer_set_reload(tdev, SERVO_OVERFLOW);
|
||||
timer_set_compare(tdev, 1, SERVO_OVERFLOW);
|
||||
timer_set_compare(tdev, 2, SERVO_OVERFLOW);
|
||||
timer_attach_interrupt(tdev, 1, Servo_IRQHandler);
|
||||
timer_attach_interrupt(tdev, 2, Servo_IRQHandler);
|
||||
timer_generate_update(tdev);
|
||||
timer_resume(tdev);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void libServo::pwmSetDuty(const uint16_t duty_cycle) {
|
||||
timer_dev *tdev = get_timer_dev(SERVO0_TIMER_NUM);
|
||||
timer_set_compare(tdev, 1, duty_cycle);
|
||||
timer_generate_update(tdev);
|
||||
if (duty_cycle) {
|
||||
timer_enable_irq(tdev, 1);
|
||||
timer_enable_irq(tdev, 2);
|
||||
}
|
||||
else {
|
||||
timer_disable_irq(tdev, 1);
|
||||
timer_disable_irq(tdev, 2);
|
||||
#ifdef SERVO0_PWM_OD
|
||||
OUT_WRITE_OD(this->pin, 1); // off
|
||||
#else
|
||||
OUT_WRITE(this->pin, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void libServo::pauseSoftPWM() { // detach
|
||||
timer_dev *tdev = get_timer_dev(SERVO0_TIMER_NUM);
|
||||
timer_pause(tdev);
|
||||
pwmSetDuty(0);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool libServo::setupSoftPWM(const int32_t pin) { return false; }
|
||||
void libServo::pwmSetDuty(const uint16_t duty_cycle) {}
|
||||
void libServo::pauseSoftPWM() {}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // HAS_SERVOS
|
||||
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -46,8 +46,15 @@ class libServo {
|
||||
void move(const int32_t value);
|
||||
int32_t read() const;
|
||||
private:
|
||||
void servoWrite(uint8_t pin, const uint16_t duty_cycle);
|
||||
|
||||
uint8_t servoIndex; // index into the channel data for this servo
|
||||
int32_t pin = NOT_ATTACHED;
|
||||
int32_t minAngle;
|
||||
int32_t maxAngle;
|
||||
int32_t angle;
|
||||
|
||||
bool setupSoftPWM(const int32_t pin);
|
||||
void pauseSoftPWM();
|
||||
void pwmSetDuty(const uint16_t duty_cycle);
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ bool SDIO_Init(void) {
|
||||
|
||||
dma_init(SDIO_DMA_DEV);
|
||||
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
|
||||
dma_set_priority(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, DMA_PRIORITY_VERY_HIGH);
|
||||
dma_set_priority(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, DMA_PRIORITY_MEDIUM);
|
||||
|
||||
if (!SDIO_CmdGoIdleState()) return false;
|
||||
if (!SDIO_CmdGoIdleState()) return false; /* Hotplugged cards tends to miss first CMD0, so give them a second chance. */
|
||||
|
||||
@@ -36,19 +36,14 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include "HAL.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "pins_arduino.h"
|
||||
#include "spi_pins.h"
|
||||
#include "../../core/macros.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include <SPI.h>
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Public Variables
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
static SPISettings spiConfig;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Public functions
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -81,8 +76,7 @@ void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
SET_OUTPUT(SS_PIN);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,8 +98,11 @@ void spiInit(uint8_t spiRate) {
|
||||
case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break;
|
||||
default: clock = SPI_CLOCK_DIV2; // Default from the SPI library
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
SPI.setModule(SPI_DEVICE);
|
||||
SPI.begin();
|
||||
SPI.setClockDivider(clock);
|
||||
SPI.setBitOrder(MSBFIRST);
|
||||
SPI.setDataMode(SPI_MODE0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,9 +113,7 @@ void spiInit(uint8_t spiRate) {
|
||||
* @details
|
||||
*/
|
||||
uint8_t spiRec(void) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
SPI.endTransaction();
|
||||
return returnByte;
|
||||
}
|
||||
|
||||
@@ -132,9 +127,7 @@ uint8_t spiRec(void) {
|
||||
* @details Uses DMA
|
||||
*/
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,9 +138,7 @@ void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
* @details
|
||||
*/
|
||||
void spiSend(uint8_t b) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.send(b);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,27 +150,25 @@ void spiSend(uint8_t b) {
|
||||
* @details Use DMA
|
||||
*/
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.send(token);
|
||||
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Begin SPI transaction, set clock, bit order, data mode
|
||||
*
|
||||
* @param spiClock Clock setting
|
||||
* @param bitOrder Bit Order setting
|
||||
* @param dataMode Data Mode setting
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Uses an SPI Config via SPISettings
|
||||
*/
|
||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
||||
spiConfig = SPISettings(spiClock, (BitOrder)bitOrder, dataMode);
|
||||
SPI.beginTransaction(spiConfig);
|
||||
#if ENABLED(SPI_EEPROM)
|
||||
|
||||
// Read single byte from specified SPI channel
|
||||
uint8_t spiRec(uint32_t chan) { return SPI.transfer(ff); }
|
||||
|
||||
// Write single byte to specified SPI channel
|
||||
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
|
||||
|
||||
// Write buffer to specified SPI channel
|
||||
void spiSend(uint32_t chan, const uint8_t* buf, size_t n) {
|
||||
for (size_t p = 0; p < n; p++) spiSend(chan, buf[p]);
|
||||
}
|
||||
|
||||
#endif // SPI_EEPROM
|
||||
|
||||
#endif // SOFTWARE_SPI
|
||||
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <libmaple/gpio.h>
|
||||
|
||||
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
|
||||
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !((bool)V)))
|
||||
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << ((V) ? 0 : 16))
|
||||
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
|
||||
#define WRITE_VAR(IO,V) WRITE(IO,V)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#define SET_PWM_OD(IO) pinMode(IO, PWM_OPEN_DRAIN)
|
||||
|
||||
#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
|
||||
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
|
||||
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP || _GET_MODE(IO) == GPIO_OUTPUT_OD)
|
||||
|
||||
#define PWM_PIN(IO) (PIN_MAP[IO].timer_device != nullptr)
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && EITHER(SPI_EEPROM, I2C_EEPROM)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
bool PersistentStore::access_start() { return true; }
|
||||
bool PersistentStore::access_finish() { return true; }
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
while (size--) {
|
||||
uint8_t * const p = (uint8_t * const)pos;
|
||||
uint8_t v = *value;
|
||||
// EEPROM has only ~100,000 write cycles,
|
||||
// so only write bytes that have changed!
|
||||
if (v != eeprom_read_byte(p)) {
|
||||
eeprom_write_byte(p, v);
|
||||
if (eeprom_read_byte(p) != v) {
|
||||
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
crc16(crc, &v, 1);
|
||||
pos++;
|
||||
value++;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool set/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (set && value) *value = c;
|
||||
crc16(crc, &c, 1);
|
||||
pos++;
|
||||
value++;
|
||||
} while (--size);
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS && EITHER(SPI_EEPROM, I2C_EEPROM)
|
||||
#endif // __STM32F1__
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
|
||||
@@ -1 +1,127 @@
|
||||
#error Debug pins is not supported on this Platform!
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Support routines for STM32F1
|
||||
*/
|
||||
#ifdef __STM32F1__
|
||||
|
||||
/**
|
||||
* Translation of routines & variables used by pinsDebug.h
|
||||
*/
|
||||
#include "fastio_STM32F1.h"
|
||||
|
||||
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];
|
||||
|
||||
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
|
||||
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < BOARD_NR_GPIO_PINS)
|
||||
#define GET_ARRAY_PIN(p) pin_t(pin_array[p].pin)
|
||||
#define pwm_status(pin) PWM_PIN(pin)
|
||||
#define digitalRead_mod(p) extDigitalRead(p)
|
||||
#define NAME_FORMAT(p) PSTR("%-##p##s")
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PORT(p) print_port(p)
|
||||
#define PRINT_ARRAY_NAME(x) do {sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer);} while (0)
|
||||
#define MULTI_NAME_PAD 20 // spaces needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
|
||||
#ifndef M43_NEVER_TOUCH
|
||||
#define M43_NEVER_TOUCH(Q) (Q >= 9 && Q <= 12) // SERIAL/USB pins PA9(TX) PA10(RX)
|
||||
#endif
|
||||
|
||||
static inline int8_t get_pin_mode(pin_t pin) {
|
||||
return VALID_PIN(pin) ? _GET_MODE(pin) : -1;
|
||||
}
|
||||
|
||||
static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return -1;
|
||||
int8_t adc_channel = int8_t(PIN_MAP[pin].adc_channel);
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
if (adc_channel >= NUM_ANALOG_INPUTS) adc_channel = ADCx;
|
||||
#endif
|
||||
return pin_t(adc_channel);
|
||||
}
|
||||
|
||||
static inline bool IS_ANALOG(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return false;
|
||||
if (PIN_MAP[pin].adc_channel != ADCx) {
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
if (PIN_MAP[pin].adc_channel >= NUM_ANALOG_INPUTS) return false;
|
||||
#endif
|
||||
return _GET_MODE(pin) == GPIO_INPUT_ANALOG && !M43_NEVER_TOUCH(pin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool GET_PINMODE(pin_t pin) {
|
||||
return VALID_PIN(pin) ? !IS_INPUT(pin) : false;
|
||||
}
|
||||
|
||||
static inline bool GET_ARRAY_IS_DIGITAL(int16_t array_pin) {
|
||||
pin_t pin = GET_ARRAY_PIN(array_pin);
|
||||
bool isDigital = !IS_ANALOG(pin);
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
if (!isDigital && PIN_MAP[pin].adc_channel >= NUM_ANALOG_INPUTS)
|
||||
isDigital = true;
|
||||
#endif
|
||||
return isDigital;
|
||||
}
|
||||
|
||||
static inline void pwm_details(pin_t pin) {
|
||||
if (PWM_PIN(pin)) {
|
||||
char buffer[16], num = '?';
|
||||
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
||||
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||
if (tdev == &timer1) num = '1';
|
||||
else if (tdev == &timer1) num = '1';
|
||||
else if (tdev == &timer2) num = '2';
|
||||
else if (tdev == &timer3) num = '3';
|
||||
else if (tdev == &timer4) num = '4';
|
||||
#ifdef STM32_HIGH_DENSITY
|
||||
else if (tdev == &timer5) num = '5';
|
||||
else if (tdev == &timer8) num = '8';
|
||||
#endif
|
||||
sprintf_P(buffer, PSTR(" TIM%c CH%c"), num, ('0' + channel));
|
||||
SERIAL_ECHO(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void print_port(pin_t pin) {
|
||||
char buffer[8];
|
||||
char port = 'A' + char(pin >> 4); // pin div 16
|
||||
/* seems not to be required for our devices
|
||||
gpio_dev* gp = PIN_MAP[pin].gpio_device;
|
||||
if (gp == &gpioa) port = 'A';
|
||||
else if (gp == &gpiob) port = 'B';
|
||||
else if (gp == &gpioc) port = 'C';
|
||||
else if (gp == &gpiod) port = 'D';
|
||||
#if STM32_NR_GPIO_PORTS > 4
|
||||
else if (gp == &gpioe) port = 'E';
|
||||
else if (gp == &gpiof) port = 'F';
|
||||
else if (gp == &gpiog) port = 'G';
|
||||
#endif
|
||||
*/
|
||||
const int16_t gbit = PIN_MAP[pin].gpio_bit;
|
||||
sprintf_P(buffer, PSTR("P%c%hd "), port, gbit);
|
||||
if (gbit < 10) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHO(buffer);
|
||||
}
|
||||
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -23,11 +23,36 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define SPI Pins: SCK, MISO, MOSI, SS
|
||||
* STM32F1 Default SPI Pins
|
||||
*
|
||||
* Any PIN can be used for Chip Select (SS)
|
||||
* SS SCK MISO MOSI
|
||||
* +-----------------------------+
|
||||
* SPI1 | PA4 PA5 PA6 PA7 |
|
||||
* SPI2 | PB12 PB13 PB14 PB15 |
|
||||
* SPI3 | PA15 PB3 PB4 PB5 |
|
||||
* +-----------------------------+
|
||||
* Any pin can be used for Chip Select (SS_PIN)
|
||||
* SPI1 is enabled by default
|
||||
*/
|
||||
#define SCK_PIN PA5
|
||||
#define MISO_PIN PA6
|
||||
#define MOSI_PIN PA7
|
||||
#define SS_PIN PA4
|
||||
#ifndef SCK_PIN
|
||||
#define SCK_PIN PA5
|
||||
#endif
|
||||
#ifndef MISO_PIN
|
||||
#define MISO_PIN PA6
|
||||
#endif
|
||||
#ifndef MOSI_PIN
|
||||
#define MOSI_PIN PA7
|
||||
#endif
|
||||
#ifndef SS_PIN
|
||||
#define SS_PIN PA4
|
||||
#endif
|
||||
#undef SDSS
|
||||
#define SDSS SS_PIN
|
||||
|
||||
#if ENABLED(ENABLE_SPI3)
|
||||
#define SPI_DEVICE 3
|
||||
#elif ENABLED(ENABLE_SPI2)
|
||||
#define SPI_DEVICE 2
|
||||
#else
|
||||
#define SPI_DEVICE 1
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,6 @@ if __name__ == "__main__":
|
||||
"-mcpu=cortex-m3",
|
||||
"-mthumb",
|
||||
|
||||
"-ffreestanding",
|
||||
"-fsigned-char",
|
||||
"-fno-move-loop-invariants",
|
||||
"-fno-strict-aliasing",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
|
||||
#if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS) // FSMC on 100/144 pins SoCs
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
void LCD_IO_Init(uint8_t cs, uint8_t rs);
|
||||
void LCD_IO_WriteData(uint16_t RegValue);
|
||||
void LCD_IO_WriteReg(uint8_t Reg);
|
||||
void LCD_IO_WriteReg(uint16_t Reg);
|
||||
uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
|
||||
|
||||
static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT
|
||||
@@ -250,8 +250,8 @@ void LCD_IO_WriteData(uint16_t RegValue) {
|
||||
__DSB();
|
||||
}
|
||||
|
||||
void LCD_IO_WriteReg(uint8_t Reg) {
|
||||
LCD->REG = (uint16_t)Reg;
|
||||
void LCD_IO_WriteReg(uint16_t Reg) {
|
||||
LCD->REG = Reg;
|
||||
__DSB();
|
||||
}
|
||||
|
||||
@@ -272,4 +272,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
|
||||
#endif // ARDUINO_ARCH_STM32F1 && FSMC_CS_PIN
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_GRAPHICAL_LCD && ENABLED(FORCE_SOFT_SPI)
|
||||
|
||||
#include "HAL.h"
|
||||
#include <U8glib.h>
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 0 // Fastest
|
||||
//#define SPI_SPEED 2 // Slower
|
||||
|
||||
static uint8_t SPI_speed = SPI_SPEED;
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
if (spi_speed == 0) {
|
||||
WRITE(DOGLCD_MOSI, !!(b & 0x80));
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && READ(miso_pin)) b |= 1;
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
}
|
||||
else {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
WRITE(DOGLCD_MOSI, state);
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && READ(miso_pin)) b |= 1;
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
if (spi_speed == 0) {
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
WRITE(DOGLCD_MOSI, state);
|
||||
WRITE(DOGLCD_MOSI, state); // need some setup time
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
}
|
||||
else {
|
||||
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
WRITE(DOGLCD_MOSI, state);
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
}
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && READ(miso_pin)) b |= 1;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static void u8g_sw_spi_HAL_STM32F1_shift_out(uint8_t val) {
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
swSpiTransfer_mode_3(val, SPI_speed);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed);
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint8_t swSpiInit(const uint8_t spi_speed) {
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
SET_OUTPUT(LCD_RESET_PIN);
|
||||
#endif
|
||||
SET_OUTPUT(DOGLCD_A0);
|
||||
OUT_WRITE(DOGLCD_SCK, LOW);
|
||||
OUT_WRITE(DOGLCD_MOSI, LOW);
|
||||
OUT_WRITE(DOGLCD_CS, HIGH);
|
||||
return spi_speed;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_INIT:
|
||||
SPI_speed = swSpiInit(SPI_SPEED);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
WRITE(LCD_RESET_PIN, arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ENABLED(FYSETC_MINI_12864) // This LCD SPI is running mode 3 while SD card is running mode 0
|
||||
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
|
||||
// the next chip select goes active
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
WRITE(DOGLCD_CS, LOW);
|
||||
}
|
||||
else {
|
||||
WRITE(DOGLCD_CS, HIGH);
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
WRITE(DOGLCD_CS, !arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_sw_spi_HAL_STM32F1_shift_out(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
u8g_sw_spi_HAL_STM32F1_shift_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
} break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
u8g_sw_spi_HAL_STM32F1_shift_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
} break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
WRITE(DOGLCD_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
#endif // STM32F1
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "watchdog_STM32F1.h"
|
||||
|
||||
void watchdog_reset() {
|
||||
#if PIN_EXISTS(LED)
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
#endif
|
||||
iwdg_feed();
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include "HAL.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "pins_arduino.h"
|
||||
#include <pins_arduino.h>
|
||||
#include "spi_pins.h"
|
||||
#include "../../core/macros.h"
|
||||
#include <SPI.h>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include "HAL.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "pins_arduino.h"
|
||||
#include <pins_arduino.h>
|
||||
#include "spi_pins.h"
|
||||
#include "../../core/macros.h"
|
||||
#include <SPI.h>
|
||||
@@ -81,8 +81,7 @@ void spiBegin(void) {
|
||||
#error SS_PIN not defined!
|
||||
#endif
|
||||
|
||||
SET_OUTPUT(SS_PIN);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
/** Configure SPI for specified SPI speed */
|
||||
|
||||
@@ -38,14 +38,12 @@ void spiBegin(void) {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
SET_OUTPUT(SS_PIN);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
|
||||
//#if DISABLED(SOFTWARE_SPI)
|
||||
#if 0
|
||||
#if 0 && DISABLED(SOFTWARE_SPI)
|
||||
// set SS high - may be chip select for another SPI device
|
||||
#if SET_SPI_SS_HIGH
|
||||
WRITE(SS_PIN, HIGH);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <Servo.h>
|
||||
|
||||
// Inherit and expand on the official library
|
||||
// Inherit and expand on core Servo library
|
||||
class libServo : public Servo {
|
||||
public:
|
||||
int8_t attach(const int pin);
|
||||
@@ -32,5 +32,5 @@ class libServo : public Servo {
|
||||
private:
|
||||
uint16_t min_ticks;
|
||||
uint16_t max_ticks;
|
||||
uint8_t servoIndex; // index into the channel data for this servo
|
||||
uint8_t servoIndex; // Index into the channel data for this servo
|
||||
};
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
|
||||
#include "HAL.h"
|
||||
@@ -8,32 +29,27 @@
|
||||
|
||||
static SPISettings spiConfig;
|
||||
|
||||
// Standard SPI functions
|
||||
/** Initialize SPI bus */
|
||||
void spiBegin(void) {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error SS_PIN not defined!
|
||||
#endif
|
||||
SET_OUTPUT(SS_PIN);
|
||||
WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
SET_INPUT(MISO_PIN);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
|
||||
//#if DISABLED(SOFTWARE_SPI)
|
||||
#if 0
|
||||
#if 0 && DISABLED(SOFTWARE_SPI)
|
||||
// set SS high - may be chip select for another SPI device
|
||||
#if SET_SPI_SS_HIGH
|
||||
WRITE(SS_PIN, HIGH);
|
||||
#endif // SET_SPI_SS_HIGH
|
||||
#endif
|
||||
// set a default rate
|
||||
spiInit(SPI_HALF_SPEED); // 1
|
||||
#endif // SOFTWARE_SPI
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Configure SPI for specified SPI speed */
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
// Use Marlin data-rates
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 10000000; break;
|
||||
@@ -49,44 +65,39 @@ void spiInit(uint8_t spiRate) {
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** SPI receive a byte */
|
||||
uint8_t spiRec(void) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
SPI.endTransaction();
|
||||
return returnByte;
|
||||
// SPDR = 0xFF;
|
||||
// while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
// return SPDR;
|
||||
//SPDR = 0xFF;
|
||||
//while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
//return SPDR;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/** SPI read data */
|
||||
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(buf, nbyte);
|
||||
SPI.endTransaction();
|
||||
//if (nbyte-- == 0) return;
|
||||
// SPDR = 0xFF;
|
||||
//for (uint16_t i = 0; i < nbyte; i++) {
|
||||
// while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
// buf[i] = SPDR;
|
||||
// SPDR = 0xFF;
|
||||
//}
|
||||
//while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
//buf[nbyte] = SPDR;
|
||||
//if (nbyte-- == 0) return;
|
||||
// SPDR = 0xFF;
|
||||
//for (uint16_t i = 0; i < nbyte; i++) {
|
||||
// while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
// buf[i] = SPDR;
|
||||
// SPDR = 0xFF;
|
||||
//}
|
||||
//while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
//buf[nbyte] = SPDR;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/** SPI send a byte */
|
||||
|
||||
void spiSend(uint8_t b) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(b);
|
||||
SPI.endTransaction();
|
||||
// SPDR = b;
|
||||
// while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
//SPDR = b;
|
||||
//while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/** SPI send block */
|
||||
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPDR = token;
|
||||
@@ -100,11 +111,9 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
|
||||
/** Begin SPI transaction, set clock, bit order, data mode */
|
||||
// Begin SPI transaction, set clock, bit order, data mode
|
||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
||||
spiConfig = SPISettings(spiClock, bitOrder, dataMode);
|
||||
|
||||
SPI.beginTransaction(spiConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Teensy3.5 __MK64FX512__
|
||||
* Teensy3.6 __MK66FX1M0__
|
||||
|
||||
@@ -115,5 +115,4 @@ void eeprom_update_block(const void* src, void* eeprom_address, size_t n) {
|
||||
delay(7); // wait for page write to complete
|
||||
}
|
||||
|
||||
|
||||
#endif // ENABLED(SPI_EEPROM)
|
||||
#endif // SPI_EEPROM
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../../libs/crc16.h"
|
||||
|
||||
class PersistentStore {
|
||||
public:
|
||||
static bool access_start();
|
||||
|
||||
+26
-28
@@ -73,10 +73,6 @@
|
||||
#include "feature/mixing.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BEZIER_CURVE_SUPPORT)
|
||||
#include "module/planner_bezier.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
#include "feature/Max7219_Debug_LEDs.h"
|
||||
#endif
|
||||
@@ -93,10 +89,6 @@
|
||||
#include "module/servo.h"
|
||||
#endif
|
||||
|
||||
#if HAS_DIGIPOTSS
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#include "feature/dac/stepper_dac.h"
|
||||
#endif
|
||||
@@ -110,7 +102,7 @@
|
||||
#include "feature/I2CPositionEncoder.h"
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC
|
||||
#if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)
|
||||
#include "feature/tmc_util.h"
|
||||
#endif
|
||||
|
||||
@@ -179,10 +171,6 @@
|
||||
|
||||
bool Running = true;
|
||||
|
||||
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
||||
TempUnit input_temp_units = TEMPUNIT_C;
|
||||
#endif
|
||||
|
||||
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
|
||||
bool wait_for_heatup = true;
|
||||
|
||||
@@ -381,7 +369,7 @@ void disable_all_steppers() {
|
||||
#endif // HOST_ACTION_COMMANDS
|
||||
|
||||
if (run_runout_script)
|
||||
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
||||
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
||||
}
|
||||
|
||||
#endif // HAS_FILAMENT_SENSOR
|
||||
@@ -437,7 +425,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
runout.run();
|
||||
#endif
|
||||
|
||||
if (commands_in_queue < BUFSIZE) get_available_commands();
|
||||
if (queue.length < BUFSIZE) queue.get_available_commands();
|
||||
|
||||
const millis_t ms = millis();
|
||||
|
||||
@@ -520,7 +508,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
const int HOME_DEBOUNCE_DELAY = 2500;
|
||||
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) {
|
||||
if (!homeDebounceCount) {
|
||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||
queue.inject_P(PSTR("G28"));
|
||||
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
||||
}
|
||||
if (homeDebounceCount < HOME_DEBOUNCE_DELAY)
|
||||
@@ -809,7 +797,7 @@ void stop() {
|
||||
#endif
|
||||
|
||||
if (IsRunning()) {
|
||||
Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
|
||||
queue.stop();
|
||||
SERIAL_ERROR_MSG(MSG_ERR_STOPPED);
|
||||
LCD_MESSAGEPGM(MSG_STOPPED);
|
||||
safe_delay(350); // allow enough time for messages to get out before stopping
|
||||
@@ -873,6 +861,10 @@ void setup() {
|
||||
|
||||
setup_killpin();
|
||||
|
||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
tmc_serial_begin();
|
||||
#endif
|
||||
|
||||
setup_powerhold();
|
||||
|
||||
#if HAS_STEPPER_RESET
|
||||
@@ -904,9 +896,6 @@ void setup() {
|
||||
#endif
|
||||
tmc_init_cs_pins();
|
||||
#endif
|
||||
#if HAS_DRIVER(TMC2208)
|
||||
tmc2208_serial_begin();
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_INIT
|
||||
BOARD_INIT();
|
||||
@@ -937,8 +926,6 @@ void setup() {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(MSG_FREE_MEMORY, freeMemory(), MSG_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE));
|
||||
|
||||
queue_setup();
|
||||
|
||||
// UI must be initialized before EEPROM
|
||||
// (because EEPROM code calls the UI).
|
||||
ui.init();
|
||||
@@ -948,7 +935,7 @@ void setup() {
|
||||
ui.show_bootscreen();
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDIO_SUPPORT) && SD_DETECT_PIN == -1
|
||||
#if ENABLED(SDIO_SUPPORT) && !PIN_EXISTS(SD_DETECT)
|
||||
// Auto-mount the SD for EEPROM.dat emulation
|
||||
if (!card.isDetected()) card.initsd();
|
||||
#endif
|
||||
@@ -996,6 +983,13 @@ void setup() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(COOLANT_MIST)
|
||||
OUT_WRITE(COOLANT_MIST_PIN, COOLANT_MIST_INVERT); // Init Mist Coolant OFF
|
||||
#endif
|
||||
#if ENABLED(COOLANT_FLOOD)
|
||||
OUT_WRITE(COOLANT_FLOOD_PIN, COOLANT_FLOOD_INVERT); // Init Flood Coolant OFF
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
endstops.enable_z_probe(false);
|
||||
#endif
|
||||
@@ -1130,6 +1124,7 @@ void loop() {
|
||||
for (;;) {
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
card.checkautostart();
|
||||
|
||||
if (card.flag.abort_sd_printing) {
|
||||
@@ -1138,23 +1133,26 @@ void loop() {
|
||||
true
|
||||
#endif
|
||||
);
|
||||
clear_command_queue();
|
||||
queue.clear();
|
||||
quickstop_stepper();
|
||||
print_job_timer.stop();
|
||||
thermalManager.disable_all_heaters();
|
||||
#if DISABLED(SD_ABORT_NO_COOLDOWN)
|
||||
thermalManager.disable_all_heaters();
|
||||
#endif
|
||||
thermalManager.zero_fan_speeds();
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
#endif
|
||||
#ifdef EVENT_GCODE_SD_STOP
|
||||
enqueue_and_echo_commands_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
if (commands_in_queue < BUFSIZE) get_available_commands();
|
||||
advance_command_queue();
|
||||
if (queue.length < BUFSIZE) queue.get_available_commands();
|
||||
queue.advance();
|
||||
endstops.event_handler();
|
||||
idle();
|
||||
}
|
||||
|
||||
+182
-177
@@ -27,254 +27,259 @@
|
||||
// RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560
|
||||
//
|
||||
|
||||
#define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2
|
||||
#define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2
|
||||
|
||||
#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_13_SF 38 // RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_13_SF 38 // RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
|
||||
|
||||
#define BOARD_RAMPS_14_EFB 43 // RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_14_EEB 44 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_14_EFF 45 // RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_14_EEF 46 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_14_SF 48 // RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS_14_EFB 43 // RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_14_EEB 44 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_14_EFF 45 // RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_14_EEF 46 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_14_SF 48 // RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
|
||||
|
||||
#define BOARD_RAMPS_PLUS_EFB 143 // RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_PLUS_EEB 144 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_PLUS_EFF 145 // RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_PLUS_EEF 146 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_PLUS_SF 148 // RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS_PLUS_EFB 143 // RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_PLUS_EEB 144 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_PLUS_EFF 145 // RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_PLUS_EEF 146 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_PLUS_SF 148 // RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
|
||||
|
||||
//
|
||||
// RAMPS Derivatives - ATmega1280, ATmega2560
|
||||
//
|
||||
|
||||
#define BOARD_3DRAG 77 // 3Drag Controller
|
||||
#define BOARD_K8200 78 // Velleman K8200 Controller (derived from 3Drag Controller)
|
||||
#define BOARD_K8400 79 // Velleman K8400 Controller (derived from 3Drag Controller)
|
||||
#define BOARD_BAM_DICE 401 // 2PrintBeta BAM&DICE with STK drivers
|
||||
#define BOARD_BAM_DICE_DUE 402 // 2PrintBeta BAM&DICE Due with STK drivers
|
||||
#define BOARD_MKS_BASE 40 // MKS BASE v1.0
|
||||
#define BOARD_MKS_BASE_14 404 // MKS v1.4 A4982 stepper drivers
|
||||
#define BOARD_MKS_BASE_15 405 // MKS v1.5 with Allegro A4982 stepper drivers
|
||||
#define BOARD_MKS_BASE_HEROIC 41 // MKS BASE 1.0 with Heroic HR4982 stepper drivers
|
||||
#define BOARD_MKS_GEN_13 47 // MKS GEN v1.3 or 1.4
|
||||
#define BOARD_MKS_GEN_L 53 // MKS GEN L
|
||||
#define BOARD_KFB_2 136 // Bigtreetech or BIQU KFB2.0
|
||||
#define BOARD_ZRIB_V20 504 // zrib V2.0 control board (Chinese knock off RAMPS replica)
|
||||
#define BOARD_FELIX2 37 // Felix 2.0+ Electronics Board (RAMPS like)
|
||||
#define BOARD_RIGIDBOARD 42 // Invent-A-Part RigidBoard
|
||||
#define BOARD_RIGIDBOARD_V2 52 // Invent-A-Part RigidBoard V2
|
||||
#define BOARD_SAINSMART_2IN1 49 // Sainsmart 2-in-1 board
|
||||
#define BOARD_ULTIMAKER 7 // Ultimaker
|
||||
#define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
||||
#define BOARD_AZTEEG_X3 67 // Azteeg X3
|
||||
#define BOARD_AZTEEG_X3_PRO 68 // Azteeg X3 Pro
|
||||
#define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
|
||||
#define BOARD_RUMBA 80 // Rumba
|
||||
#define BOARD_RUMBA_RAISE3D 333 // Raise3D N series Rumba derivative
|
||||
#define BOARD_RL200 801 // Rapide Lite 200 (v1, low-cost RUMBA clone with drv)
|
||||
#define BOARD_FORMBOT_TREX2PLUS 95 // Formbot T-Rex 2 Plus
|
||||
#define BOARD_FORMBOT_TREX3 96 // Formbot T-Rex 3
|
||||
#define BOARD_FORMBOT_RAPTOR 97 // Formbot Raptor
|
||||
#define BOARD_FORMBOT_RAPTOR2 98 // Formbot Raptor 2
|
||||
#define BOARD_BQ_ZUM_MEGA_3D 503 // bq ZUM Mega 3D
|
||||
#define BOARD_MAKEBOARD_MINI 431 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake
|
||||
#define BOARD_TRIGORILLA_13 343 // TriGorilla Anycubic version 1.3 based on RAMPS EFB
|
||||
#define BOARD_TRIGORILLA_14 443 // TriGorilla Anycubic version 1.4 based on RAMPS EFB
|
||||
#define BOARD_RAMPS_ENDER_4 243 // Creality: Ender-4, CR-8
|
||||
#define BOARD_RAMPS_CREALITY 244 // Creality: CR10S, CR20, CR-X
|
||||
#define BOARD_FYSETC_F6_13 541 // Fysetc F6
|
||||
#define BOARD_DUPLICATOR_I3_PLUS 31 // Wanhao Duplicator i3 Plus
|
||||
#define BOARD_VORON 441 // VORON Design
|
||||
#define BOARD_TRONXY_V3_1_0 442 // Tronxy TRONXY-V3-1.0
|
||||
#define BOARD_3DRAG 77 // 3Drag Controller
|
||||
#define BOARD_K8200 78 // Velleman K8200 Controller (derived from 3Drag Controller)
|
||||
#define BOARD_K8400 79 // Velleman K8400 Controller (derived from 3Drag Controller)
|
||||
#define BOARD_BAM_DICE 401 // 2PrintBeta BAM&DICE with STK drivers
|
||||
#define BOARD_BAM_DICE_DUE 402 // 2PrintBeta BAM&DICE Due with STK drivers
|
||||
#define BOARD_MKS_BASE 40 // MKS BASE v1.0
|
||||
#define BOARD_MKS_BASE_14 404 // MKS v1.4 A4982 stepper drivers
|
||||
#define BOARD_MKS_BASE_15 405 // MKS v1.5 with Allegro A4982 stepper drivers
|
||||
#define BOARD_MKS_BASE_HEROIC 41 // MKS BASE 1.0 with Heroic HR4982 stepper drivers
|
||||
#define BOARD_MKS_GEN_13 47 // MKS GEN v1.3 or 1.4
|
||||
#define BOARD_MKS_GEN_L 53 // MKS GEN L
|
||||
#define BOARD_KFB_2 136 // Bigtreetech or BIQU KFB2.0
|
||||
#define BOARD_ZRIB_V20 504 // zrib V2.0 control board (Chinese knock off RAMPS replica)
|
||||
#define BOARD_FELIX2 37 // Felix 2.0+ Electronics Board (RAMPS like)
|
||||
#define BOARD_RIGIDBOARD 42 // Invent-A-Part RigidBoard
|
||||
#define BOARD_RIGIDBOARD_V2 52 // Invent-A-Part RigidBoard V2
|
||||
#define BOARD_SAINSMART_2IN1 49 // Sainsmart 2-in-1 board
|
||||
#define BOARD_ULTIMAKER 7 // Ultimaker
|
||||
#define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
||||
#define BOARD_AZTEEG_X3 67 // Azteeg X3
|
||||
#define BOARD_AZTEEG_X3_PRO 68 // Azteeg X3 Pro
|
||||
#define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
|
||||
#define BOARD_RUMBA 80 // Rumba
|
||||
#define BOARD_RUMBA_RAISE3D 333 // Raise3D N series Rumba derivative
|
||||
#define BOARD_RL200 801 // Rapide Lite 200 (v1, low-cost RUMBA clone with drv)
|
||||
#define BOARD_FORMBOT_TREX2PLUS 95 // Formbot T-Rex 2 Plus
|
||||
#define BOARD_FORMBOT_TREX3 96 // Formbot T-Rex 3
|
||||
#define BOARD_FORMBOT_RAPTOR 97 // Formbot Raptor
|
||||
#define BOARD_FORMBOT_RAPTOR2 98 // Formbot Raptor 2
|
||||
#define BOARD_BQ_ZUM_MEGA_3D 503 // bq ZUM Mega 3D
|
||||
#define BOARD_MAKEBOARD_MINI 431 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake
|
||||
#define BOARD_TRIGORILLA_13 343 // TriGorilla Anycubic version 1.3 based on RAMPS EFB
|
||||
#define BOARD_TRIGORILLA_14 443 // ... Ver 1.4
|
||||
#define BOARD_TRIGORILLA_14_11 444 // ... Rev 1.1 (new servo pin order)
|
||||
#define BOARD_RAMPS_ENDER_4 243 // Creality: Ender-4, CR-8
|
||||
#define BOARD_RAMPS_CREALITY 244 // Creality: CR10S, CR20, CR-X
|
||||
#define BOARD_RAMPS_DAGOMA 245 // Dagoma F5
|
||||
#define BOARD_FYSETC_F6_13 541 // Fysetc F6
|
||||
#define BOARD_DUPLICATOR_I3_PLUS 31 // Wanhao Duplicator i3 Plus
|
||||
#define BOARD_VORON 441 // VORON Design
|
||||
#define BOARD_TRONXY_V3_1_0 442 // Tronxy TRONXY-V3-1.0
|
||||
#define BOARD_Z_BOLT_X_SERIES 550 // Z-Bolt X Series
|
||||
|
||||
//
|
||||
// Other ATmega1280, ATmega2560
|
||||
//
|
||||
|
||||
#define BOARD_CNCONTROLS_11 111 // Cartesio CN Controls V11
|
||||
#define BOARD_CNCONTROLS_12 112 // Cartesio CN Controls V12
|
||||
#define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0
|
||||
#define BOARD_CHEAPTRONIC_V2 21 // Cheaptronic v2.0
|
||||
#define BOARD_MIGHTYBOARD_REVE 200 // Makerbot Mightyboard Revision E
|
||||
#define BOARD_MEGATRONICS 70 // Megatronics
|
||||
#define BOARD_MEGATRONICS_2 701 // Megatronics v2.0
|
||||
#define BOARD_MEGATRONICS_3 703 // Megatronics v3.0
|
||||
#define BOARD_MEGATRONICS_31 704 // Megatronics v3.1
|
||||
#define BOARD_MEGATRONICS_32 705 // Megatronics v3.2
|
||||
#define BOARD_RAMBO 301 // Rambo
|
||||
#define BOARD_MINIRAMBO 302 // Mini-Rambo
|
||||
#define BOARD_MINIRAMBO_10A 303 // Mini-Rambo 1.0a
|
||||
#define BOARD_EINSY_RAMBO 304 // Einsy Rambo
|
||||
#define BOARD_EINSY_RETRO 305 // Einsy Retro
|
||||
#define BOARD_ELEFU_3 21 // Elefu Ra Board (v3)
|
||||
#define BOARD_LEAPFROG 999 // Leapfrog
|
||||
#define BOARD_MEGACONTROLLER 310 // Mega controller
|
||||
#define BOARD_SCOOVO_X9H 321 // abee Scoovo X9H
|
||||
#define BOARD_GT2560_REV_A 74 // Geeetech GT2560 Rev. A
|
||||
#define BOARD_GT2560_REV_A_PLUS 75 // Geeetech GT2560 Rev. A+ (with auto level probe)
|
||||
#define BOARD_GT2560_V3 76 // Geeetech GT2560 Rev B for A10(M/D)
|
||||
#define BOARD_GT2560_V3_MC2 73 // Geeetech GT2560 Rev B for Mecreator2
|
||||
#define BOARD_GT2560_V3_A20 86 // Geeetech GT2560 Rev B for A20(M/D)
|
||||
#define BOARD_EINSTART_S 666 // Einstart retrofit
|
||||
#define BOARD_CNCONTROLS_11 111 // Cartesio CN Controls V11
|
||||
#define BOARD_CNCONTROLS_12 112 // Cartesio CN Controls V12
|
||||
#define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0
|
||||
#define BOARD_CHEAPTRONIC_V2 21 // Cheaptronic v2.0
|
||||
#define BOARD_MIGHTYBOARD_REVE 200 // Makerbot Mightyboard Revision E
|
||||
#define BOARD_MEGATRONICS 70 // Megatronics
|
||||
#define BOARD_MEGATRONICS_2 701 // Megatronics v2.0
|
||||
#define BOARD_MEGATRONICS_3 703 // Megatronics v3.0
|
||||
#define BOARD_MEGATRONICS_31 704 // Megatronics v3.1
|
||||
#define BOARD_MEGATRONICS_32 705 // Megatronics v3.2
|
||||
#define BOARD_RAMBO 301 // Rambo
|
||||
#define BOARD_MINIRAMBO 302 // Mini-Rambo
|
||||
#define BOARD_MINIRAMBO_10A 303 // Mini-Rambo 1.0a
|
||||
#define BOARD_EINSY_RAMBO 304 // Einsy Rambo
|
||||
#define BOARD_EINSY_RETRO 305 // Einsy Retro
|
||||
#define BOARD_ELEFU_3 23 // Elefu Ra Board (v3)
|
||||
#define BOARD_LEAPFROG 999 // Leapfrog
|
||||
#define BOARD_MEGACONTROLLER 310 // Mega controller
|
||||
#define BOARD_SCOOVO_X9H 321 // abee Scoovo X9H
|
||||
#define BOARD_GT2560_REV_A 74 // Geeetech GT2560 Rev. A
|
||||
#define BOARD_GT2560_REV_A_PLUS 75 // Geeetech GT2560 Rev. A+ (with auto level probe)
|
||||
#define BOARD_GT2560_V3 76 // Geeetech GT2560 Rev B for A10(M/D)
|
||||
#define BOARD_GT2560_V3_MC2 73 // Geeetech GT2560 Rev B for Mecreator2
|
||||
#define BOARD_GT2560_V3_A20 86 // Geeetech GT2560 Rev B for A20(M/D)
|
||||
#define BOARD_EINSTART_S 666 // Einstart retrofit
|
||||
|
||||
//
|
||||
// ATmega1281, ATmega2561
|
||||
//
|
||||
|
||||
#define BOARD_MINITRONICS 702 // Minitronics v1.0/1.1
|
||||
#define BOARD_SILVER_GATE 25 // Silvergate v1.0
|
||||
#define BOARD_MINITRONICS 702 // Minitronics v1.0/1.1
|
||||
#define BOARD_SILVER_GATE 25 // Silvergate v1.0
|
||||
|
||||
//
|
||||
// Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
||||
//
|
||||
|
||||
#define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2
|
||||
#define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above
|
||||
#define BOARD_MELZI 63 // Melzi
|
||||
#define BOARD_MELZI_MAKR3D 66 // Melzi with ATmega1284 (MaKr3d version)
|
||||
#define BOARD_MELZI_CREALITY 89 // Melzi Creality3D board (for CR-10 etc)
|
||||
#define BOARD_MELZI_MALYAN 92 // Melzi Malyan M150 board
|
||||
#define BOARD_MELZI_TRONXY 505 // Tronxy X5S
|
||||
#define BOARD_STB_11 64 // STB V1.1
|
||||
#define BOARD_AZTEEG_X1 65 // Azteeg X1
|
||||
#define BOARD_ANET_10 69 // Anet 1.0 (Melzi clone)
|
||||
#define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2
|
||||
#define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above
|
||||
#define BOARD_MELZI 63 // Melzi
|
||||
#define BOARD_MELZI_MAKR3D 66 // Melzi with ATmega1284 (MaKr3d version)
|
||||
#define BOARD_MELZI_CREALITY 89 // Melzi Creality3D board (for CR-10 etc)
|
||||
#define BOARD_MELZI_MALYAN 92 // Melzi Malyan M150 board
|
||||
#define BOARD_MELZI_TRONXY 505 // Tronxy X5S
|
||||
#define BOARD_STB_11 64 // STB V1.1
|
||||
#define BOARD_AZTEEG_X1 65 // Azteeg X1
|
||||
#define BOARD_ANET_10 69 // Anet 1.0 (Melzi clone)
|
||||
|
||||
//
|
||||
// Other ATmega644P, ATmega644, ATmega1284P
|
||||
//
|
||||
|
||||
#define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics
|
||||
#define BOARD_GEN3_PLUS 9 // Gen3+
|
||||
#define BOARD_GEN6 5 // Gen6
|
||||
#define BOARD_GEN6_DELUXE 51 // Gen6 deluxe
|
||||
#define BOARD_GEN7_CUSTOM 10 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
|
||||
#define BOARD_GEN7_12 11 // Gen7 v1.1, v1.2
|
||||
#define BOARD_GEN7_13 12 // Gen7 v1.3
|
||||
#define BOARD_GEN7_14 13 // Gen7 v1.4
|
||||
#define BOARD_OMCA_A 90 // Alpha OMCA board
|
||||
#define BOARD_OMCA 91 // Final OMCA board
|
||||
#define BOARD_SETHI 20 // Sethi 3D_1
|
||||
#define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics
|
||||
#define BOARD_GEN3_PLUS 9 // Gen3+
|
||||
#define BOARD_GEN6 5 // Gen6
|
||||
#define BOARD_GEN6_DELUXE 51 // Gen6 deluxe
|
||||
#define BOARD_GEN7_CUSTOM 10 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
|
||||
#define BOARD_GEN7_12 11 // Gen7 v1.1, v1.2
|
||||
#define BOARD_GEN7_13 12 // Gen7 v1.3
|
||||
#define BOARD_GEN7_14 13 // Gen7 v1.4
|
||||
#define BOARD_OMCA_A 90 // Alpha OMCA board
|
||||
#define BOARD_OMCA 91 // Final OMCA board
|
||||
#define BOARD_SETHI 20 // Sethi 3D_1
|
||||
|
||||
//
|
||||
// Teensyduino - AT90USB1286, AT90USB1286P
|
||||
//
|
||||
|
||||
#define BOARD_TEENSYLU 8 // Teensylu
|
||||
#define BOARD_PRINTRBOARD 81 // Printrboard (AT90USB1286)
|
||||
#define BOARD_PRINTRBOARD_REVF 811 // Printrboard Revision F (AT90USB1286)
|
||||
#define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646)
|
||||
#define BOARD_BRAINWAVE_PRO 85 // Brainwave Pro (AT90USB1286)
|
||||
#define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286)
|
||||
#define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286)
|
||||
#define BOARD_5DPRINT 88 // 5DPrint D8 Driver Board
|
||||
#define BOARD_TEENSYLU 8 // Teensylu
|
||||
#define BOARD_PRINTRBOARD 81 // Printrboard (AT90USB1286)
|
||||
#define BOARD_PRINTRBOARD_REVF 811 // Printrboard Revision F (AT90USB1286)
|
||||
#define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646)
|
||||
#define BOARD_BRAINWAVE_PRO 85 // Brainwave Pro (AT90USB1286)
|
||||
#define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286)
|
||||
#define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286)
|
||||
#define BOARD_5DPRINT 88 // 5DPrint D8 Driver Board
|
||||
|
||||
//
|
||||
// LPC1768 ARM Cortex M3
|
||||
//
|
||||
|
||||
#define BOARD_RAMPS_14_RE_ARM_EFB 1743 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EEB 1744 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EFF 1745 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EEF 1746 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_14_RE_ARM_SF 1748 // Re-ARM with RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_MKS_SBASE 1750 // MKS-Sbase (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_AZSMZ_MINI 1751 // AZSMZ Mini
|
||||
#define BOARD_AZTEEG_X5_GT 1752 // Azteeg X5 GT (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_BIQU_BQ111_A4 1753 // BIQU BQ111-A4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_SELENA_COMPACT 1754 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1)
|
||||
#define BOARD_COHESION3D_REMIX 1755 // Cohesion3D ReMix
|
||||
#define BOARD_COHESION3D_MINI 1756 // Cohesion3D Mini
|
||||
#define BOARD_SMOOTHIEBOARD 1757 // Smoothieboard
|
||||
#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_BIQU_SKR_V1_1 1759 // BIQU SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed)
|
||||
#define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
|
||||
#define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN 1763 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EFB 1743 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EEB 1744 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EFF 1745 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_14_RE_ARM_EEF 1746 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_14_RE_ARM_SF 1748 // Re-ARM with RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_MKS_SBASE 1750 // MKS-Sbase (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_AZSMZ_MINI 1751 // AZSMZ Mini
|
||||
#define BOARD_AZTEEG_X5_GT 1752 // Azteeg X5 GT (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_BIQU_BQ111_A4 1753 // BIQU BQ111-A4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_SELENA_COMPACT 1754 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1)
|
||||
#define BOARD_COHESION3D_REMIX 1755 // Cohesion3D ReMix
|
||||
#define BOARD_COHESION3D_MINI 1756 // Cohesion3D Mini
|
||||
#define BOARD_SMOOTHIEBOARD 1757 // Smoothieboard
|
||||
#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_BIQU_SKR_V1_1 1759 // BIQU SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed)
|
||||
#define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
|
||||
#define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN 1763 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
|
||||
//
|
||||
// SAM3X8E ARM Cortex M3
|
||||
//
|
||||
|
||||
#define BOARD_DUE3DOM 1411 // DUE3DOM for Arduino DUE
|
||||
#define BOARD_DUE3DOM_MINI 1412 // DUE3DOM MINI for Arduino DUE
|
||||
#define BOARD_RADDS 1502 // RADDS
|
||||
#define BOARD_RAMPS_FD_V1 1503 // RAMPS-FD v1
|
||||
#define BOARD_RAMPS_FD_V2 1504 // RAMPS-FD v2
|
||||
#define BOARD_RAMPS_SMART_EFB 1523 // RAMPS-SMART (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_SMART_EEB 1524 // RAMPS-SMART (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_SMART_EFF 1525 // RAMPS-SMART (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_SMART_EEF 1526 // RAMPS-SMART (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_SMART_SF 1528 // RAMPS-SMART (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS_DUO_EFB 1533 // RAMPS Duo (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_DUO_EEB 1534 // RAMPS Duo (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_DUO_EFF 1535 // RAMPS Duo (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_DUO_EEF 1536 // RAMPS Duo (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_DUO_SF 1538 // RAMPS Duo (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS4DUE_EFB 1543 // RAMPS4DUE (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS4DUE_EEB 1544 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS4DUE_EFF 1545 // RAMPS4DUE (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS4DUE_EEF 1546 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS4DUE_SF 1548 // RAMPS4DUE (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RURAMPS4D_11 1550 // RuRAMPS4Duo v1.1 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed)
|
||||
#define BOARD_RURAMPS4D_13 1551 // RuRAMPS4Duo v1.3 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed)
|
||||
#define BOARD_ULTRATRONICS_PRO 1560 // ReprapWorld Ultratronics Pro V1.0
|
||||
#define BOARD_ARCHIM1 1591 // UltiMachine Archim1 (with DRV8825 drivers)
|
||||
#define BOARD_ARCHIM2 1592 // UltiMachine Archim2 (with TMC2130 drivers)
|
||||
#define BOARD_ALLIGATOR 1602 // Alligator Board R2
|
||||
#define BOARD_DUE3DOM 1411 // DUE3DOM for Arduino DUE
|
||||
#define BOARD_DUE3DOM_MINI 1412 // DUE3DOM MINI for Arduino DUE
|
||||
#define BOARD_RADDS 1502 // RADDS
|
||||
#define BOARD_RAMPS_FD_V1 1503 // RAMPS-FD v1
|
||||
#define BOARD_RAMPS_FD_V2 1504 // RAMPS-FD v2
|
||||
#define BOARD_RAMPS_SMART_EFB 1523 // RAMPS-SMART (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_SMART_EEB 1524 // RAMPS-SMART (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_SMART_EFF 1525 // RAMPS-SMART (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_SMART_EEF 1526 // RAMPS-SMART (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_SMART_SF 1528 // RAMPS-SMART (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS_DUO_EFB 1533 // RAMPS Duo (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS_DUO_EEB 1534 // RAMPS Duo (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS_DUO_EFF 1535 // RAMPS Duo (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS_DUO_EEF 1536 // RAMPS Duo (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS_DUO_SF 1538 // RAMPS Duo (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RAMPS4DUE_EFB 1543 // RAMPS4DUE (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_RAMPS4DUE_EEB 1544 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Bed)
|
||||
#define BOARD_RAMPS4DUE_EFF 1545 // RAMPS4DUE (Power outputs: Hotend, Fan0, Fan1)
|
||||
#define BOARD_RAMPS4DUE_EEF 1546 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Fan)
|
||||
#define BOARD_RAMPS4DUE_SF 1548 // RAMPS4DUE (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_RURAMPS4D_11 1550 // RuRAMPS4Duo v1.1 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed)
|
||||
#define BOARD_RURAMPS4D_13 1551 // RuRAMPS4Duo v1.3 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed)
|
||||
#define BOARD_ULTRATRONICS_PRO 1560 // ReprapWorld Ultratronics Pro V1.0
|
||||
#define BOARD_ARCHIM1 1591 // UltiMachine Archim1 (with DRV8825 drivers)
|
||||
#define BOARD_ARCHIM2 1592 // UltiMachine Archim2 (with TMC2130 drivers)
|
||||
#define BOARD_ALLIGATOR 1602 // Alligator Board R2
|
||||
|
||||
//
|
||||
// SAM3X8C ARM Cortex M3
|
||||
//
|
||||
|
||||
#define BOARD_PRINTRBOARD_G2 1620 // PRINTRBOARD G2
|
||||
#define BOARD_ADSK 1610 // Arduino DUE Shield Kit (ADSK)
|
||||
#define BOARD_PRINTRBOARD_G2 1620 // PRINTRBOARD G2
|
||||
#define BOARD_ADSK 1610 // Arduino DUE Shield Kit (ADSK)
|
||||
|
||||
//
|
||||
// STM32 ARM Cortex-M3
|
||||
//
|
||||
|
||||
#define BOARD_STM32F1R 1800 // STM32R Libmaple based STM32F1 controller
|
||||
#define BOARD_MALYAN_M200 1801 // STM32C8T6 Libmaple based stm32f1 controller
|
||||
#define BOARD_STM3R_MINI 1803 // STM32 Libmaple based stm32f1 controller
|
||||
#define BOARD_GTM32_PRO_VB 1805 // STM32f103VET6 controller
|
||||
#define BOARD_MORPHEUS 1806 // STM32F103C8/STM32F103CB Libmaple based stm32f1 controller
|
||||
#define BOARD_MKS_ROBIN 1808 // MKS Robin / STM32F103ZET6
|
||||
#define BOARD_STM32F1R 1800 // STM32R Libmaple based STM32F1 controller
|
||||
#define BOARD_MALYAN_M200 1801 // STM32C8T6 Libmaple based stm32f1 controller
|
||||
#define BOARD_STM3R_MINI 1803 // STM32 Libmaple based stm32f1 controller
|
||||
#define BOARD_GTM32_PRO_VB 1805 // STM32f103VET6 controller
|
||||
#define BOARD_MORPHEUS 1806 // STM32F103C8/STM32F103CB Libmaple based stm32f1 controller
|
||||
#define BOARD_MKS_ROBIN 1808 // MKS Robin / STM32F103ZET6
|
||||
#define BOARD_BIGTREE_SKR_MINI_V1_1 1814 // STM32F103RC
|
||||
#define BOARD_JGAURORA_A5S_A1 1820 // JGAurora A5S A1 / STM32F103ZET6
|
||||
|
||||
//
|
||||
// STM32 ARM Cortex-M4F
|
||||
//
|
||||
|
||||
#define BOARD_TEENSY31_32 1552 // Teensy3.1 and Teensy3.2
|
||||
#define BOARD_TEENSY35_36 841 // Teensy3.5 and Teensy3.6
|
||||
#define BOARD_BEAST 1802 // STM32FxxxVxT6 Libmaple based stm32f4 controller
|
||||
#define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller
|
||||
#define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller
|
||||
#define BOARD_RUMBA32 1809 // RUMBA32 STM32F4 based controller
|
||||
#define BOARD_BLACK_STM32F407VE 1810 // BLACK_STM32F407VE
|
||||
#define BOARD_BLACK_STM32F407ZE 1811 // BLACK_STM32F407ZE
|
||||
#define BOARD_STEVAL 1866 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
#define BOARD_TEENSY31_32 1552 // Teensy3.1 and Teensy3.2
|
||||
#define BOARD_TEENSY35_36 841 // Teensy3.5 and Teensy3.6
|
||||
#define BOARD_BEAST 1802 // STM32FxxxVxT6 Libmaple based stm32f4 controller
|
||||
#define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller
|
||||
#define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller
|
||||
#define BOARD_RUMBA32 1809 // RUMBA32 STM32F4 based controller
|
||||
#define BOARD_BLACK_STM32F407VE 1810 // BLACK_STM32F407VE
|
||||
#define BOARD_BLACK_STM32F407ZE 1811 // BLACK_STM32F407ZE
|
||||
#define BOARD_STEVAL 1866 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
//
|
||||
|
||||
#define BOARD_THE_BORG 1860 // THE-BORG (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_REMRAM_V1 1862 // RemRam v1
|
||||
#define BOARD_THE_BORG 1860 // THE-BORG (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_REMRAM_V1 1862 // RemRam v1
|
||||
|
||||
//
|
||||
// Espressif ESP32 WiFi
|
||||
//
|
||||
#define BOARD_ESP32 1900
|
||||
#define BOARD_ESP32 1900
|
||||
|
||||
//
|
||||
// Simulations
|
||||
//
|
||||
|
||||
#define BOARD_LINUX_RAMPS 2000
|
||||
#define BOARD_LINUX_RAMPS 2000
|
||||
|
||||
#define MB(board) (defined(BOARD_##board) && MOTHERBOARD==BOARD_##board)
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#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
|
||||
@@ -77,6 +79,7 @@
|
||||
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \
|
||||
|| HAS_DRIVER(TMC2160) \
|
||||
|| HAS_DRIVER(TMC2208) \
|
||||
|| HAS_DRIVER(TMC2209) \
|
||||
|| HAS_DRIVER(TMC2660) \
|
||||
|| HAS_DRIVER(TMC5130) \
|
||||
|| HAS_DRIVER(TMC5160) )
|
||||
@@ -84,6 +87,7 @@
|
||||
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2209) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5160) )
|
||||
@@ -96,8 +100,12 @@
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5160) )
|
||||
|
||||
#define AXIS_HAS_UART(A) ( AXIS_DRIVER_TYPE(A,TMC2208) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2209) )
|
||||
|
||||
#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2209) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5160) )
|
||||
@@ -105,5 +113,6 @@
|
||||
#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2209) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5160) )
|
||||
|
||||
@@ -56,7 +56,13 @@
|
||||
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
|
||||
|
||||
// Remove compiler warning on an unused variable
|
||||
#define UNUSED(X) (void)X
|
||||
#ifndef UNUSED
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#define UNUSED(X) (void)X
|
||||
#else
|
||||
#define UNUSED(x) ((void)(x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Macros to make a string from a macro
|
||||
#define STRINGIFY_(M) #M
|
||||
|
||||
+6
-282
@@ -35,293 +35,13 @@ void safe_delay(millis_t ms) {
|
||||
thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
|
||||
}
|
||||
|
||||
#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE)
|
||||
|
||||
void crc16(uint16_t *crc, const void * const data, uint16_t cnt) {
|
||||
uint8_t *ptr = (uint8_t *)data;
|
||||
while (cnt--) {
|
||||
*crc = (uint16_t)(*crc ^ (uint16_t)(((uint16_t)*ptr++) << 8));
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
*crc = (uint16_t)((*crc & 0x8000) ? ((uint16_t)(*crc << 1) ^ 0x1021) : (*crc << 1));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE
|
||||
|
||||
#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI)
|
||||
|
||||
char conv[8] = { 0 };
|
||||
|
||||
#define DIGIT(n) ('0' + (n))
|
||||
#define DIGIMOD(n, f) DIGIT((n)/(f) % 10)
|
||||
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
|
||||
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
|
||||
|
||||
// Convert a full-range unsigned 8bit int to a percentage
|
||||
char* ui8tostr4pct(const uint8_t i) {
|
||||
const uint8_t n = ui8_to_percent(i);
|
||||
conv[3] = RJDIGIT(n, 100);
|
||||
conv[4] = RJDIGIT(n, 10);
|
||||
conv[5] = DIGIMOD(n, 1);
|
||||
conv[6] = '%';
|
||||
return &conv[3];
|
||||
}
|
||||
|
||||
// Convert unsigned 8bit int to string 123 format
|
||||
char* ui8tostr3(const uint8_t i) {
|
||||
conv[4] = RJDIGIT(i, 100);
|
||||
conv[5] = RJDIGIT(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[4];
|
||||
}
|
||||
|
||||
// Convert signed 8bit int to rj string with 123 or -12 format
|
||||
char* i8tostr3(const int8_t x) {
|
||||
int xx = x;
|
||||
conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
|
||||
conv[5] = RJDIGIT(xx, 10);
|
||||
conv[6] = DIGIMOD(xx, 1);
|
||||
return &conv[4];
|
||||
}
|
||||
|
||||
// Convert unsigned 16bit int to string 123 format
|
||||
char* ui16tostr3(const uint16_t xx) {
|
||||
conv[4] = RJDIGIT(xx, 100);
|
||||
conv[5] = RJDIGIT(xx, 10);
|
||||
conv[6] = DIGIMOD(xx, 1);
|
||||
return &conv[4];
|
||||
}
|
||||
|
||||
// Convert unsigned 16bit int to string 1234 format
|
||||
char* ui16tostr4(const uint16_t xx) {
|
||||
conv[3] = RJDIGIT(xx, 1000);
|
||||
conv[4] = RJDIGIT(xx, 100);
|
||||
conv[5] = RJDIGIT(xx, 10);
|
||||
conv[6] = DIGIMOD(xx, 1);
|
||||
return &conv[3];
|
||||
}
|
||||
|
||||
// Convert signed 16bit int to rj string with 123 or -12 format
|
||||
char* i16tostr3(const int16_t x) {
|
||||
int xx = x;
|
||||
conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
|
||||
conv[5] = RJDIGIT(xx, 10);
|
||||
conv[6] = DIGIMOD(xx, 1);
|
||||
return &conv[4];
|
||||
}
|
||||
|
||||
// Convert unsigned 16bit int to lj string with 123 format
|
||||
char* i16tostr3left(const int16_t i) {
|
||||
char *str = &conv[6];
|
||||
*str = DIGIMOD(i, 1);
|
||||
if (i >= 10) {
|
||||
*(--str) = DIGIMOD(i, 10);
|
||||
if (i >= 100)
|
||||
*(--str) = DIGIMOD(i, 100);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// Convert signed 16bit int to rj string with 1234, _123, -123, _-12, or __-1 format
|
||||
char* i16tostr4sign(const int16_t i) {
|
||||
const bool neg = i < 0;
|
||||
const int ii = neg ? -i : i;
|
||||
if (i >= 1000) {
|
||||
conv[3] = DIGIMOD(ii, 1000);
|
||||
conv[4] = DIGIMOD(ii, 100);
|
||||
conv[5] = DIGIMOD(ii, 10);
|
||||
}
|
||||
else if (ii >= 100) {
|
||||
conv[3] = neg ? '-' : ' ';
|
||||
conv[4] = DIGIMOD(ii, 100);
|
||||
conv[5] = DIGIMOD(ii, 10);
|
||||
}
|
||||
else {
|
||||
conv[3] = ' ';
|
||||
conv[4] = ' ';
|
||||
if (ii >= 10) {
|
||||
conv[4] = neg ? '-' : ' ';
|
||||
conv[5] = DIGIMOD(ii, 10);
|
||||
}
|
||||
else {
|
||||
conv[5] = neg ? '-' : ' ';
|
||||
}
|
||||
}
|
||||
conv[6] = DIGIMOD(ii, 1);
|
||||
return &conv[3];
|
||||
}
|
||||
|
||||
// Convert unsigned float to string with 1.23 format
|
||||
char* ftostr12ns(const float &f) {
|
||||
const long i = ((f < 0 ? -f : f) * 1000 + 5) / 10;
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
conv[4] = '.';
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[3];
|
||||
}
|
||||
|
||||
// Convert signed float to fixed-length string with 12.34 / -2.34 format or 123.45 / -23.45 format
|
||||
char* ftostr42_52(const float &f) {
|
||||
if (f <= -10 || f >= 100) return ftostr52(f); // need more digits
|
||||
long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[2] = (f >= 0 && f < 10) ? ' ' : MINUSOR(i, DIGIMOD(i, 1000));
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
conv[4] = '.';
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[2];
|
||||
}
|
||||
|
||||
// Convert signed float to fixed-length string with 023.45 / -23.45 format
|
||||
char* ftostr52(const float &f) {
|
||||
long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[1] = MINUSOR(i, DIGIMOD(i, 10000));
|
||||
conv[2] = DIGIMOD(i, 1000);
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
conv[4] = '.';
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[1];
|
||||
}
|
||||
|
||||
#if ENABLED(LCD_DECIMAL_SMALL_XY)
|
||||
|
||||
// Convert float to rj string with 1234, _123, -123, _-12, 12.3, _1.2, or -1.2 format
|
||||
char* ftostr4sign(const float &f) {
|
||||
const int i = (f * 100 + (f < 0 ? -5: 5)) / 10;
|
||||
if (!WITHIN(i, -99, 999)) return i16tostr4sign((int)f);
|
||||
const bool neg = i < 0;
|
||||
const int ii = neg ? -i : i;
|
||||
conv[3] = neg ? '-' : (ii >= 100 ? DIGIMOD(ii, 100) : ' ');
|
||||
conv[4] = DIGIMOD(ii, 10);
|
||||
conv[5] = '.';
|
||||
conv[6] = DIGIMOD(ii, 1);
|
||||
return &conv[3];
|
||||
}
|
||||
|
||||
#endif // LCD_DECIMAL_SMALL_XY
|
||||
|
||||
// Convert float to fixed-length string with +123.4 / -123.4 format
|
||||
char* ftostr41sign(const float &f) {
|
||||
int i = (f * 100 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[1] = MINUSOR(i, '+');
|
||||
conv[2] = DIGIMOD(i, 1000);
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
conv[4] = DIGIMOD(i, 10);
|
||||
conv[5] = '.';
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[1];
|
||||
}
|
||||
|
||||
// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
|
||||
char* ftostr43sign(const float &f, char plus/*=' '*/) {
|
||||
long i = (f * 10000 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[1] = i ? MINUSOR(i, plus) : ' ';
|
||||
conv[2] = DIGIMOD(i, 1000);
|
||||
conv[3] = '.';
|
||||
conv[4] = DIGIMOD(i, 100);
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[1];
|
||||
}
|
||||
|
||||
// Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format
|
||||
char* ftostr54sign(const float &f, char plus/*=' '*/) {
|
||||
long i = (f * 100000 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[0] = i ? MINUSOR(i, plus) : ' ';
|
||||
conv[1] = DIGIMOD(i, 10000);
|
||||
conv[2] = '.';
|
||||
conv[3] = DIGIMOD(i, 1000);
|
||||
conv[4] = DIGIMOD(i, 100);
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[0];
|
||||
}
|
||||
|
||||
// Convert unsigned float to rj string with 12345 format
|
||||
char* ftostr5rj(const float &f) {
|
||||
const long i = ((f < 0 ? -f : f) * 10 + 5) / 10;
|
||||
conv[2] = RJDIGIT(i, 10000);
|
||||
conv[3] = RJDIGIT(i, 1000);
|
||||
conv[4] = RJDIGIT(i, 100);
|
||||
conv[5] = RJDIGIT(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return &conv[2];
|
||||
}
|
||||
|
||||
// Convert signed float to string with +1234.5 format
|
||||
char* ftostr51sign(const float &f) {
|
||||
long i = (f * 100 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[0] = MINUSOR(i, '+');
|
||||
conv[1] = DIGIMOD(i, 10000);
|
||||
conv[2] = DIGIMOD(i, 1000);
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
conv[4] = DIGIMOD(i, 10);
|
||||
conv[5] = '.';
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return conv;
|
||||
}
|
||||
|
||||
// Convert signed float to string with +123.45 format
|
||||
char* ftostr52sign(const float &f) {
|
||||
long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;
|
||||
conv[0] = MINUSOR(i, '+');
|
||||
conv[1] = DIGIMOD(i, 10000);
|
||||
conv[2] = DIGIMOD(i, 1000);
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
conv[4] = '.';
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return conv;
|
||||
}
|
||||
|
||||
// Convert unsigned float to string with 1234.5 format omitting trailing zeros
|
||||
char* ftostr51rj(const float &f) {
|
||||
const long i = ((f < 0 ? -f : f) * 100 + 5) / 10;
|
||||
conv[0] = ' ';
|
||||
conv[1] = RJDIGIT(i, 10000);
|
||||
conv[2] = RJDIGIT(i, 1000);
|
||||
conv[3] = RJDIGIT(i, 100);
|
||||
conv[4] = DIGIMOD(i, 10);
|
||||
conv[5] = '.';
|
||||
conv[6] = DIGIMOD(i, 1);
|
||||
return conv;
|
||||
}
|
||||
|
||||
// Convert signed float to space-padded string with -_23.4_ format
|
||||
char* ftostr52sp(const float &f) {
|
||||
long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;
|
||||
uint8_t dig;
|
||||
conv[0] = MINUSOR(i, ' ');
|
||||
conv[1] = RJDIGIT(i, 10000);
|
||||
conv[2] = RJDIGIT(i, 1000);
|
||||
conv[3] = DIGIMOD(i, 100);
|
||||
|
||||
if ((dig = i % 10)) { // second digit after decimal point?
|
||||
conv[4] = '.';
|
||||
conv[5] = DIGIMOD(i, 10);
|
||||
conv[6] = DIGIT(dig);
|
||||
}
|
||||
else {
|
||||
if ((dig = (i / 10) % 10)) { // first digit after decimal point?
|
||||
conv[4] = '.';
|
||||
conv[5] = DIGIT(dig);
|
||||
}
|
||||
else // nothing after decimal point
|
||||
conv[4] = conv[5] = ' ';
|
||||
conv[6] = ' ';
|
||||
}
|
||||
return conv;
|
||||
}
|
||||
|
||||
#endif // ULTRA_LCD
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
|
||||
#include "../module/probe.h"
|
||||
#include "../module/motion.h"
|
||||
#include "../module/stepper.h"
|
||||
#include "../module/stepper.h"
|
||||
#include "../libs/numtostr.h"
|
||||
#include "../feature/bedlevel/bedlevel.h"
|
||||
|
||||
void log_machine_info() {
|
||||
@@ -346,10 +66,14 @@ void safe_delay(millis_t ms) {
|
||||
"BLTOUCH"
|
||||
#elif HAS_Z_SERVO_PROBE
|
||||
"SERVO PROBE"
|
||||
#elif ENABLED(TOUCH_MI_PROBE)
|
||||
"TOUCH_MI_PROBE"
|
||||
#elif ENABLED(Z_PROBE_SLED)
|
||||
"Z_PROBE_SLED"
|
||||
#elif ENABLED(Z_PROBE_ALLEN_KEY)
|
||||
"Z_PROBE_ALLEN_KEY"
|
||||
#elif ENABLED(SOLENOID_PROBE)
|
||||
"SOLENOID_PROBE"
|
||||
#else
|
||||
"NONE"
|
||||
#endif
|
||||
|
||||
@@ -37,93 +37,10 @@ inline void serial_delay(const millis_t ms) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE)
|
||||
void crc16(uint16_t *crc, const void * const data, uint16_t cnt);
|
||||
#endif
|
||||
|
||||
#if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
|
||||
/**
|
||||
* These support functions allow the use of large bit arrays of flags that take very
|
||||
* little RAM. Currently they are limited to being 16x16 in size. Changing the declaration
|
||||
* to unsigned long will allow us to go to 32x32 if higher resolution Mesh's are needed
|
||||
* in the future.
|
||||
*/
|
||||
FORCE_INLINE void bitmap_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
|
||||
FORCE_INLINE void bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
|
||||
FORCE_INLINE bool is_bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }
|
||||
#endif
|
||||
|
||||
#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI)
|
||||
|
||||
// Convert a full-range unsigned 8bit int to a percentage
|
||||
char* ui8tostr4pct(const uint8_t i);
|
||||
|
||||
// Convert uint8_t to string with 123 format
|
||||
char* ui8tostr3(const uint8_t x);
|
||||
|
||||
// Convert int8_t to string with 123 format
|
||||
char* i8tostr3(const int8_t x);
|
||||
|
||||
// Convert uint16_t to string with 123 format
|
||||
char* ui16tostr3(const uint16_t x);
|
||||
|
||||
// Convert uint16_t to string with 1234 format
|
||||
char* ui16tostr4(const uint16_t x);
|
||||
|
||||
// Convert int16_t to string with 123 format
|
||||
char* i16tostr3(const int16_t x);
|
||||
|
||||
// Convert unsigned int to lj string with 123 format
|
||||
char* i16tostr3left(const int16_t xx);
|
||||
|
||||
// Convert signed int to rj string with _123, -123, _-12, or __-1 format
|
||||
char* i16tostr4sign(const int16_t x);
|
||||
|
||||
// Convert unsigned float to string with 1.23 format
|
||||
char* ftostr12ns(const float &x);
|
||||
|
||||
// Convert signed float to fixed-length string with 12.34 / -2.34 or 023.45 / -23.45 format
|
||||
char* ftostr42_52(const float &x);
|
||||
|
||||
// Convert signed float to fixed-length string with 023.45 / -23.45 format
|
||||
char* ftostr52(const float &x);
|
||||
|
||||
// Convert float to fixed-length string with +123.4 / -123.4 format
|
||||
char* ftostr41sign(const float &x);
|
||||
|
||||
// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
|
||||
char* ftostr43sign(const float &x, char plus=' ');
|
||||
|
||||
// Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format
|
||||
char* ftostr54sign(const float &x, char plus=' ');
|
||||
|
||||
// Convert unsigned float to rj string with 12345 format
|
||||
char* ftostr5rj(const float &x);
|
||||
|
||||
// Convert signed float to string with +1234.5 format
|
||||
char* ftostr51sign(const float &x);
|
||||
|
||||
// Convert signed float to space-padded string with -_23.4_ format
|
||||
char* ftostr52sp(const float &x);
|
||||
|
||||
// Convert signed float to string with +123.45 format
|
||||
char* ftostr52sign(const float &x);
|
||||
|
||||
// Convert unsigned float to string with 1234.5 format omitting trailing zeros
|
||||
char* ftostr51rj(const float &x);
|
||||
|
||||
// Convert float to rj string with 123 or -12 format
|
||||
FORCE_INLINE char* ftostr3(const float &x) { return i16tostr3(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
|
||||
|
||||
#if ENABLED(LCD_DECIMAL_SMALL_XY)
|
||||
// Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format
|
||||
char* ftostr4sign(const float &fx);
|
||||
#else
|
||||
// Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format
|
||||
FORCE_INLINE char* ftostr4sign(const float &x) { return i16tostr4sign(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
|
||||
#endif
|
||||
|
||||
#endif // ULTRA_LCD
|
||||
// 16x16 bit arrays
|
||||
FORCE_INLINE void bitmap_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
|
||||
FORCE_INLINE void bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
|
||||
FORCE_INLINE bool is_bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
void log_machine_info();
|
||||
@@ -148,4 +65,3 @@ public:
|
||||
// Converts from an uint8_t in the range of 0-255 to an uint8_t
|
||||
// in the range 0-100 while avoiding rounding artifacts
|
||||
constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127) / 255; }
|
||||
constexpr uint8_t all_on = 0xFF, all_off = 0x00;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
#include "../module/planner.h"
|
||||
|
||||
constexpr uint8_t all_on = 0xFF, all_off = 0x00;
|
||||
|
||||
class Backlash {
|
||||
public:
|
||||
#ifdef BACKLASH_DISTANCE_MM
|
||||
|
||||
@@ -313,6 +313,7 @@
|
||||
|
||||
// Check for commands that require the printer to be homed
|
||||
if (may_move) {
|
||||
planner.synchronize();
|
||||
if (axis_unhomed_error()) gcode.home_all_axes();
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (active_extruder != 0) tool_change(0);
|
||||
@@ -1449,7 +1450,7 @@
|
||||
#if HAS_LCD_MENU
|
||||
ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 3/3"));
|
||||
#endif
|
||||
|
||||
|
||||
measured_z = probe_pt(PROBE_PT_3_X, PROBE_PT_3_Y, PROBE_PT_STOW, g29_verbose_level);
|
||||
//z3 = measured_z;
|
||||
if (isnan(measured_z))
|
||||
@@ -1477,7 +1478,7 @@
|
||||
else { // !do_3_pt_leveling
|
||||
|
||||
bool zig_zag = false;
|
||||
|
||||
|
||||
uint16_t total_points = g29_grid_size * g29_grid_size, current = 1;
|
||||
|
||||
for (uint8_t ix = 0; ix < g29_grid_size; ix++) {
|
||||
|
||||
@@ -53,6 +53,9 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
|
||||
// This mode will stay active until manual SET_OD_MODE or power cycle
|
||||
// BLTOUCH V3.1: SET_5V_MODE or SET_OD_MODE (if enabled).
|
||||
// At power on, the probe will default to the eeprom settings configured by the user
|
||||
_reset();
|
||||
_stow();
|
||||
|
||||
#if ENABLED(BLTOUCH_FORCE_MODE_SET)
|
||||
|
||||
constexpr bool should_set = true;
|
||||
@@ -84,9 +87,6 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
|
||||
|| true
|
||||
#endif
|
||||
));
|
||||
|
||||
_reset();
|
||||
_stow();
|
||||
}
|
||||
|
||||
void BLTouch::clear() {
|
||||
|
||||
@@ -36,24 +36,22 @@ typedef unsigned char BLTCommand;
|
||||
#define BLTOUCH_RESET 160
|
||||
|
||||
/**
|
||||
* The following commands may require different delays.
|
||||
* The following commands require different minimum delays.
|
||||
*
|
||||
* ANTClabs recommends 2000ms for 5V/OD commands. However it is
|
||||
* not common for other commands to immediately follow these,
|
||||
* and testing has shown that these complete in 500ms reliably.
|
||||
* 500ms required for a reliable Reset.
|
||||
*
|
||||
* AntClabs recommends 750ms for Deploy/Stow, otherwise you will
|
||||
* not catch an alarm state until the following move command.
|
||||
* 750ms required for Deploy/Stow, otherwise the alarm state
|
||||
* will not be seen until the following move command.
|
||||
*/
|
||||
|
||||
#ifndef BLTOUCH_SET5V_DELAY
|
||||
#define BLTOUCH_SET5V_DELAY BLTOUCH_DELAY
|
||||
#define BLTOUCH_SET5V_DELAY 150
|
||||
#endif
|
||||
#ifndef BLTOUCH_SETOD_DELAY
|
||||
#define BLTOUCH_SETOD_DELAY BLTOUCH_DELAY
|
||||
#define BLTOUCH_SETOD_DELAY 150
|
||||
#endif
|
||||
#ifndef BLTOUCH_MODE_STORE_DELAY
|
||||
#define BLTOUCH_MODE_STORE_DELAY BLTOUCH_DELAY
|
||||
#define BLTOUCH_MODE_STORE_DELAY 150
|
||||
#endif
|
||||
#ifndef BLTOUCH_DEPLOY_DELAY
|
||||
#define BLTOUCH_DEPLOY_DELAY 750
|
||||
@@ -62,7 +60,7 @@ typedef unsigned char BLTCommand;
|
||||
#define BLTOUCH_STOW_DELAY 750
|
||||
#endif
|
||||
#ifndef BLTOUCH_RESET_DELAY
|
||||
#define BLTOUCH_RESET_DELAY BLTOUCH_DELAY
|
||||
#define BLTOUCH_RESET_DELAY 500
|
||||
#endif
|
||||
|
||||
class BLTouch {
|
||||
|
||||
@@ -69,12 +69,15 @@ void update_case_light() {
|
||||
|
||||
#else // !CASE_LIGHT_USE_NEOPIXEL
|
||||
|
||||
if (PWM_PIN(CASE_LIGHT_PIN))
|
||||
analogWrite(CASE_LIGHT_PIN, n10ct);
|
||||
else {
|
||||
const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
|
||||
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
|
||||
}
|
||||
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
|
||||
if (PWM_PIN(CASE_LIGHT_PIN))
|
||||
analogWrite(CASE_LIGHT_PIN, n10ct);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
|
||||
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
|
||||
}
|
||||
|
||||
#endif // !CASE_LIGHT_USE_NEOPIXEL
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ void mcp4728_init() {
|
||||
* Write input resister value to specified channel using fastwrite method.
|
||||
* Channel : 0-3, Values : 0-4095
|
||||
*/
|
||||
uint8_t mcp4728_analogWrite(uint8_t channel, uint16_t value) {
|
||||
uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value) {
|
||||
mcp4728_values[channel] = value;
|
||||
return mcp4728_fastWrite();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ uint8_t mcp4728_eepromWrite() {
|
||||
/**
|
||||
* Write Voltage reference setting to all input regiters
|
||||
*/
|
||||
uint8_t mcp4728_setVref_all(uint8_t value) {
|
||||
uint8_t mcp4728_setVref_all(const uint8_t value) {
|
||||
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
|
||||
Wire.write(VREFWRITE | (value ? 0x0F : 0x00));
|
||||
return Wire.endTransmission();
|
||||
@@ -89,7 +89,7 @@ uint8_t mcp4728_setVref_all(uint8_t value) {
|
||||
/**
|
||||
* Write Gain setting to all input regiters
|
||||
*/
|
||||
uint8_t mcp4728_setGain_all(uint8_t value) {
|
||||
uint8_t mcp4728_setGain_all(const uint8_t value) {
|
||||
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
|
||||
Wire.write(GAINWRITE | (value ? 0x0F : 0x00));
|
||||
return Wire.endTransmission();
|
||||
@@ -98,25 +98,24 @@ uint8_t mcp4728_setGain_all(uint8_t value) {
|
||||
/**
|
||||
* Return Input Register value
|
||||
*/
|
||||
uint16_t mcp4728_getValue(uint8_t channel) { return mcp4728_values[channel]; }
|
||||
uint16_t mcp4728_getValue(const uint8_t channel) { return mcp4728_values[channel]; }
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Steph: Might be useful in the future
|
||||
* Return Vout
|
||||
*/
|
||||
uint16_t mcp4728_getVout(uint8_t channel) {
|
||||
uint32_t vref = 2048,
|
||||
vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
|
||||
if (vOut > defaultVDD) vOut = defaultVDD;
|
||||
return vOut;
|
||||
uint16_t mcp4728_getVout(const uint8_t channel) {
|
||||
const uint32_t vref = 2048,
|
||||
vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
|
||||
return MIN(vOut, defaultVDD);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns DAC values as a 0-100 percentage of drive strength
|
||||
*/
|
||||
uint8_t mcp4728_getDrvPct(uint8_t channel) { return uint8_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
|
||||
uint8_t mcp4728_getDrvPct(const uint8_t channel) { return uint8_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
|
||||
|
||||
/**
|
||||
* Receives all Drive strengths as 0-100 percent values, updates
|
||||
@@ -144,7 +143,7 @@ uint8_t mcp4728_fastWrite() {
|
||||
/**
|
||||
* Common function for simple general commands
|
||||
*/
|
||||
uint8_t mcp4728_simpleCommand(byte simpleCommand) {
|
||||
uint8_t mcp4728_simpleCommand(const byte simpleCommand) {
|
||||
Wire.beginTransmission(I2C_ADDRESS(GENERALCALL));
|
||||
Wire.write(simpleCommand);
|
||||
return Wire.endTransmission();
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
#define DAC_DEV_ADDRESS (BASE_ADDR | DAC_OR_ADDRESS)
|
||||
|
||||
void mcp4728_init();
|
||||
uint8_t mcp4728_analogWrite(uint8_t channel, uint16_t value);
|
||||
uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value);
|
||||
uint8_t mcp4728_eepromWrite();
|
||||
uint8_t mcp4728_setVref_all(uint8_t value);
|
||||
uint8_t mcp4728_setGain_all(uint8_t value);
|
||||
uint16_t mcp4728_getValue(uint8_t channel);
|
||||
uint8_t mcp4728_setVref_all(const uint8_t value);
|
||||
uint8_t mcp4728_setGain_all(const uint8_t value);
|
||||
uint16_t mcp4728_getValue(const uint8_t channel);
|
||||
uint8_t mcp4728_fastWrite();
|
||||
uint8_t mcp4728_simpleCommand(byte simpleCommand);
|
||||
uint8_t mcp4728_getDrvPct(uint8_t channel);
|
||||
uint8_t mcp4728_simpleCommand(const byte simpleCommand);
|
||||
uint8_t mcp4728_getDrvPct(const uint8_t channel);
|
||||
void mcp4728_setDrvPct(uint8_t pct[XYZE]);
|
||||
|
||||
@@ -142,7 +142,7 @@ void host_action(const char * const pstr, const bool eol) {
|
||||
break;
|
||||
case PROMPT_PAUSE_RESUME:
|
||||
msg = PSTR("LCD_PAUSE_RESUME");
|
||||
enqueue_and_echo_commands_P(PSTR("M24"));
|
||||
queue.inject_P(PSTR("M24"));
|
||||
break;
|
||||
case PROMPT_INFO:
|
||||
msg = PSTR("GCODE_INFO");
|
||||
|
||||
@@ -71,6 +71,9 @@ void LEDLights::setup() {
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
setup_neopixel();
|
||||
#endif
|
||||
#if ENABLED(PCA9533)
|
||||
RGBinit();
|
||||
#endif
|
||||
#if ENABLED(LED_USER_PRESET_STARTUP)
|
||||
set_default();
|
||||
#endif
|
||||
@@ -115,7 +118,9 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
|
||||
// This variant uses 3-4 separate pins for the RGB(W) components.
|
||||
// If the pins can do PWM then their intensity will be set.
|
||||
#define UPDATE_RGBW(C,c) do{ if (PWM_PIN(RGB_LED_##C##_PIN)) analogWrite(RGB_LED_##C##_PIN, incol.c); else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0)
|
||||
#define UPDATE_RGBW(C,c) do { if (PWM_PIN(RGB_LED_##C##_PIN)) \
|
||||
analogWrite(pin_t(RGB_LED_##C##_PIN), incol.c); \
|
||||
else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); } while(0)
|
||||
UPDATE_RGBW(R,r);
|
||||
UPDATE_RGBW(G,g);
|
||||
UPDATE_RGBW(B,b);
|
||||
@@ -145,4 +150,18 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
void LEDLights::toggle() { if (lights_on) set_off(); else update(); }
|
||||
#endif
|
||||
|
||||
#ifdef LED_BACKLIGHT_TIMEOUT
|
||||
|
||||
millis_t LEDLights::led_off_time; // = 0
|
||||
|
||||
void LEDLights::update_timeout(const bool power_on) {
|
||||
const millis_t ms = millis();
|
||||
if (power_on)
|
||||
reset_timeout(ms);
|
||||
else if (ELAPSED(ms, led_off_time))
|
||||
set_off();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // HAS_COLOR_LEDS
|
||||
|
||||
@@ -201,6 +201,17 @@ public:
|
||||
static void toggle(); // swap "off" with color
|
||||
static inline void update() { set_color(color); }
|
||||
#endif
|
||||
|
||||
#ifdef LED_BACKLIGHT_TIMEOUT
|
||||
private:
|
||||
static millis_t led_off_time;
|
||||
public:
|
||||
static inline void reset_timeout(const millis_t &ms) {
|
||||
led_off_time = ms + LED_BACKLIGHT_TIMEOUT;
|
||||
if (!lights_on) set_default();
|
||||
}
|
||||
static void update_timeout(const bool power_on);
|
||||
#endif
|
||||
};
|
||||
|
||||
extern LEDLights leds;
|
||||
|
||||
@@ -36,10 +36,20 @@
|
||||
|
||||
Adafruit_NeoPixel pixels(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800);
|
||||
|
||||
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
||||
void set_neopixel_color_background() {
|
||||
uint8_t background_color[4] = NEOPIXEL_BKGD_COLOR;
|
||||
pixels.setPixelColor(NEOPIXEL_BKGD_LED_INDEX, pixels.Color(background_color[0], background_color[1], background_color[2], background_color[3]));
|
||||
}
|
||||
#endif
|
||||
|
||||
void set_neopixel_color(const uint32_t color) {
|
||||
for (uint16_t i = 0; i < pixels.numPixels(); ++i) {
|
||||
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
||||
if (NEOPIXEL_BKGD_LED_INDEX == i) i++;
|
||||
if (i == NEOPIXEL_BKGD_LED_INDEX && color != 0x000000) {
|
||||
set_neopixel_color_background();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
pixels.setPixelColor(i, color);
|
||||
}
|
||||
@@ -52,14 +62,6 @@ void set_neopixel_color_startup(const uint32_t color) {
|
||||
pixels.show();
|
||||
}
|
||||
|
||||
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
||||
void set_neopixel_color_background() {
|
||||
uint8_t background_color[4] = NEOPIXEL_BKGD_COLOR;
|
||||
pixels.setPixelColor(NEOPIXEL_BKGD_LED_INDEX, pixels.Color(background_color[0], background_color[1], background_color[2], background_color[3]));
|
||||
pixels.show();
|
||||
}
|
||||
#endif
|
||||
|
||||
void setup_neopixel() {
|
||||
SET_OUTPUT(NEOPIXEL_PIN);
|
||||
pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
|
||||
|
||||
@@ -681,8 +681,11 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
||||
// Resume the print job timer if it was running
|
||||
if (print_job_timer.isPaused()) print_job_timer.start();
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.return_to_status();
|
||||
#if HAS_DISPLAY
|
||||
ui.reset_status();
|
||||
#if HAS_LCD_MENU
|
||||
ui.return_to_status();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void PrintJobRecovery::check() {
|
||||
if (card.isDetected()) {
|
||||
load();
|
||||
if (!valid()) return purge();
|
||||
enqueue_and_echo_commands_P(PSTR("M1000 S"));
|
||||
queue.inject_P(PSTR("M1000 S"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,9 +209,9 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
||||
info.relative_modes_e = gcode.axis_relative_modes[E_AXIS];
|
||||
|
||||
// Commands in the queue
|
||||
info.commands_in_queue = save_queue ? commands_in_queue : 0;
|
||||
info.cmd_queue_index_r = cmd_queue_index_r;
|
||||
COPY(info.command_queue, command_queue);
|
||||
info.queue_length = save_queue ? queue.length : 0;
|
||||
info.queue_index_r = queue.index_r;
|
||||
COPY(info.queue_buffer, queue.buffer);
|
||||
|
||||
// Elapsed print job time
|
||||
info.print_job_elapsed = print_job_timer.duration();
|
||||
@@ -278,7 +278,7 @@ void PrintJobRecovery::resume() {
|
||||
// Pretend that all axes are homed
|
||||
axis_homed = axis_known_position = xyz_bits;
|
||||
|
||||
char cmd[50], str_1[16], str_2[16];
|
||||
char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16];
|
||||
|
||||
// Select the previously active tool (with no_move)
|
||||
#if EXTRUDERS > 1
|
||||
@@ -361,7 +361,12 @@ void PrintJobRecovery::resume() {
|
||||
|
||||
// Move back to the saved Z
|
||||
dtostrf(info.current_position[Z_AXIS], 1, 3, str_1);
|
||||
sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1);
|
||||
#if Z_HOME_DIR > 0
|
||||
sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1);
|
||||
#else
|
||||
gcode.process_subcommands_now_P(PSTR("G1 Z0 F200"));
|
||||
sprintf_P(cmd, PSTR("G92.9 Z%s"), str_1);
|
||||
#endif
|
||||
gcode.process_subcommands_now(cmd);
|
||||
|
||||
// Un-retract
|
||||
@@ -397,9 +402,9 @@ void PrintJobRecovery::resume() {
|
||||
#endif
|
||||
|
||||
// Process commands from the old pending queue
|
||||
uint8_t c = info.commands_in_queue, r = info.cmd_queue_index_r;
|
||||
uint8_t c = info.queue_length, r = info.queue_index_r;
|
||||
for (; c--; r = (r + 1) % BUFSIZE)
|
||||
gcode.process_subcommands_now(info.command_queue[r]);
|
||||
gcode.process_subcommands_now(info.queue_buffer[r]);
|
||||
|
||||
// Resume the SD file from the last position
|
||||
char *fn = info.sd_filename;
|
||||
@@ -479,9 +484,9 @@ void PrintJobRecovery::resume() {
|
||||
DEBUG_EOL();
|
||||
DEBUG_ECHOLNPAIR("retract_hop: ", info.retract_hop);
|
||||
#endif
|
||||
DEBUG_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
|
||||
DEBUG_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
|
||||
for (uint8_t i = 0; i < info.commands_in_queue; i++) DEBUG_ECHOLNPAIR("> ", info.command_queue[i]);
|
||||
DEBUG_ECHOLNPAIR("queue_index_r: ", int(info.queue_index_r));
|
||||
DEBUG_ECHOLNPAIR("queue_length: ", int(info.queue_length));
|
||||
for (uint8_t i = 0; i < info.queue_length; i++) DEBUG_ECHOLNPAIR("> ", info.queue_buffer[i]);
|
||||
DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename);
|
||||
DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos);
|
||||
DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
|
||||
|
||||
@@ -87,8 +87,8 @@ typedef struct {
|
||||
bool relative_mode, relative_modes_e;
|
||||
|
||||
// Command queue
|
||||
uint8_t commands_in_queue, cmd_queue_index_r;
|
||||
char command_queue[BUFSIZE][MAX_CMD_SIZE];
|
||||
uint8_t queue_length, queue_index_r;
|
||||
char queue_buffer[BUFSIZE][MAX_CMD_SIZE];
|
||||
|
||||
// SD Filename and position
|
||||
char sd_filename[MAXPATHNAMELENGTH];
|
||||
|
||||
@@ -650,7 +650,7 @@ void MMU2::set_filament_type(uint8_t index, uint8_t filamentType) {
|
||||
}
|
||||
|
||||
void MMU2::filament_runout() {
|
||||
enqueue_and_echo_commands_P(PSTR(MMU2_FILAMENT_RUNOUT_SCRIPT));
|
||||
queue.inject_P(PSTR(MMU2_FILAMENT_RUNOUT_SCRIPT));
|
||||
planner.synchronize();
|
||||
}
|
||||
|
||||
|
||||
+103
-83
@@ -69,7 +69,7 @@
|
||||
#endif
|
||||
;
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
#if HAS_TMCX1X0 || HAS_DRIVER(TMC2208)
|
||||
#if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
uint8_t cs_actual;
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
@@ -95,38 +95,40 @@
|
||||
constexpr uint8_t STST_bp = 31;
|
||||
#endif
|
||||
TMC_driver_data data;
|
||||
data.drv_status = st.DRV_STATUS();
|
||||
const auto ds = data.drv_status = st.DRV_STATUS();
|
||||
#ifdef __AVR__
|
||||
|
||||
// 8-bit optimization saves up to 70 bytes of PROGMEM per axis
|
||||
uint8_t spart;
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
data.sg_result = data.drv_status & SG_RESULT_bm;
|
||||
spart = data.drv_status >> 8;
|
||||
data.is_stealth = !!(spart & _BV(STEALTH_bp - 8));
|
||||
spart = data.drv_status >> 16;
|
||||
data.sg_result = ds & SG_RESULT_bm;
|
||||
spart = ds >> 8;
|
||||
data.is_stealth = TEST(spart, STEALTH_bp - 8);
|
||||
spart = ds >> 16;
|
||||
data.cs_actual = spart & (CS_ACTUAL_bm >> 16);
|
||||
#endif
|
||||
spart = data.drv_status >> 24;
|
||||
data.is_ot = !!(spart & _BV(OT_bp - 24));
|
||||
data.is_otpw = !!(spart & _BV(OTPW_bp - 24));
|
||||
spart = ds >> 24;
|
||||
data.is_ot = TEST(spart, OT_bp - 24);
|
||||
data.is_otpw = TEST(spart, OTPW_bp - 24);
|
||||
data.is_s2g = !!(spart & (S2G_bm >> 24));
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
data.is_stall = !!(spart & _BV(STALL_GUARD_bp - 24));
|
||||
data.is_standstill = !!(spart & _BV(STST_bp - 24));
|
||||
data.is_stall = TEST(spart, STALL_GUARD_bp - 24);
|
||||
data.is_standstill = TEST(spart, STST_bp - 24);
|
||||
data.sg_result_reasonable = !data.is_standstill; // sg_result has no reasonable meaning while standstill
|
||||
#endif
|
||||
|
||||
#else // !__AVR__
|
||||
|
||||
data.is_ot = !!(data.drv_status & _BV(OT_bp));
|
||||
data.is_otpw = !!(data.drv_status & _BV(OTPW_bp));
|
||||
data.is_s2g = !!(data.drv_status & S2G_bm);
|
||||
data.is_ot = TEST(ds, OT_bp);
|
||||
data.is_otpw = TEST(ds, OTPW_bp);
|
||||
data.is_s2g = !!(ds & S2G_bm);
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
constexpr uint8_t CS_ACTUAL_sb = 16;
|
||||
data.sg_result = data.drv_status & SG_RESULT_bm;
|
||||
data.is_stealth = !!(data.drv_status & _BV(STEALTH_bp));
|
||||
data.cs_actual = (data.drv_status & CS_ACTUAL_bm) >> CS_ACTUAL_sb;
|
||||
data.is_stall = !!(data.drv_status & _BV(STALL_GUARD_bp));
|
||||
data.is_standstill = !!(data.drv_status & _BV(STST_bp));
|
||||
data.sg_result = ds & SG_RESULT_bm;
|
||||
data.is_stealth = TEST(ds, STEALTH_bp);
|
||||
data.cs_actual = (ds & CS_ACTUAL_bm) >> CS_ACTUAL_sb;
|
||||
data.is_stall = TEST(ds, STALL_GUARD_bp);
|
||||
data.is_standstill = TEST(ds, STST_bp);
|
||||
data.sg_result_reasonable = !data.is_standstill; // sg_result has no reasonable meaning while standstill
|
||||
#endif
|
||||
|
||||
@@ -137,7 +139,7 @@
|
||||
|
||||
#endif // HAS_TMCX1X0
|
||||
|
||||
#if HAS_DRIVER(TMC2208)
|
||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
|
||||
@@ -147,25 +149,25 @@
|
||||
constexpr uint8_t OTPW_bp = 0, OT_bp = 1;
|
||||
constexpr uint8_t S2G_bm = 0b11110; // 2..5
|
||||
TMC_driver_data data;
|
||||
data.drv_status = st.DRV_STATUS();
|
||||
data.is_otpw = !!(data.drv_status & _BV(OTPW_bp));
|
||||
data.is_ot = !!(data.drv_status & _BV(OT_bp));
|
||||
data.is_s2g = !!(data.drv_status & S2G_bm);
|
||||
const auto ds = data.drv_status = st.DRV_STATUS();
|
||||
data.is_otpw = TEST(ds, OTPW_bp);
|
||||
data.is_ot = TEST(ds, OT_bp);
|
||||
data.is_s2g = !!(ds & S2G_bm);
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
constexpr uint32_t CS_ACTUAL_bm = 0x1F0000; // 16:20
|
||||
constexpr uint8_t STEALTH_bp = 30, STST_bp = 31;
|
||||
#ifdef __AVR__
|
||||
// 8-bit optimization saves up to 12 bytes of PROGMEM per axis
|
||||
uint8_t spart = data.drv_status >> 16;
|
||||
uint8_t spart = ds >> 16;
|
||||
data.cs_actual = spart & (CS_ACTUAL_bm >> 16);
|
||||
spart = data.drv_status >> 24;
|
||||
data.is_stealth = !!(spart & _BV(STEALTH_bp - 24));
|
||||
data.is_standstill = !!(spart & _BV(STST_bp - 24));
|
||||
spart = ds >> 24;
|
||||
data.is_stealth = TEST(spart, STEALTH_bp - 24);
|
||||
data.is_standstill = TEST(spart, STST_bp - 24);
|
||||
#else
|
||||
constexpr uint8_t CS_ACTUAL_sb = 16;
|
||||
data.cs_actual = (data.drv_status & CS_ACTUAL_bm) >> CS_ACTUAL_sb;
|
||||
data.is_stealth = !!(data.drv_status & _BV(STEALTH_bp));
|
||||
data.is_standstill = !!(data.drv_status & _BV(STST_bp));
|
||||
data.cs_actual = (ds & CS_ACTUAL_bm) >> CS_ACTUAL_sb;
|
||||
data.is_stealth = TEST(ds, STEALTH_bp);
|
||||
data.is_standstill = TEST(ds, STST_bp);
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
data.sg_result_reasonable = false;
|
||||
@@ -174,7 +176,7 @@
|
||||
return data;
|
||||
}
|
||||
|
||||
#endif // TMC2208
|
||||
#endif // TMC2208 || TMC2209
|
||||
|
||||
#if HAS_DRIVER(TMC2660)
|
||||
|
||||
@@ -186,18 +188,18 @@
|
||||
constexpr uint8_t OT_bp = 1, OTPW_bp = 2;
|
||||
constexpr uint8_t S2G_bm = 0b11000;
|
||||
TMC_driver_data data;
|
||||
data.drv_status = st.DRVSTATUS();
|
||||
uint8_t spart = data.drv_status & 0xFF;
|
||||
data.is_otpw = !!(spart & _BV(OTPW_bp));
|
||||
data.is_ot = !!(spart & _BV(OT_bp));
|
||||
data.is_s2g = !!(data.drv_status & S2G_bm);
|
||||
const auto ds = data.drv_status = st.DRVSTATUS();
|
||||
uint8_t spart = ds & 0xFF;
|
||||
data.is_otpw = TEST(spart, OTPW_bp);
|
||||
data.is_ot = TEST(spart, OT_bp);
|
||||
data.is_s2g = !!(ds & S2G_bm);
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
constexpr uint8_t STALL_GUARD_bp = 0;
|
||||
constexpr uint8_t STST_bp = 7, SG_RESULT_sp = 10;
|
||||
constexpr uint32_t SG_RESULT_bm = 0xFFC00; // 10:19
|
||||
data.is_stall = !!(spart & _BV(STALL_GUARD_bp));
|
||||
data.is_standstill = !!(spart & _BV(STST_bp));
|
||||
data.sg_result = (data.drv_status & SG_RESULT_bm) >> SG_RESULT_sp;
|
||||
data.is_stall = TEST(spart, STALL_GUARD_bp);
|
||||
data.is_standstill = TEST(spart, STST_bp);
|
||||
data.sg_result = (ds & SG_RESULT_bm) >> SG_RESULT_sp;
|
||||
data.sg_result_reasonable = true;
|
||||
#endif
|
||||
return data;
|
||||
@@ -228,9 +230,7 @@
|
||||
SERIAL_ECHO(timestamp);
|
||||
SERIAL_ECHOPGM(": ");
|
||||
st.printLabel();
|
||||
SERIAL_ECHOPGM(" driver overtemperature warning! (");
|
||||
SERIAL_ECHO(st.getMilliamps());
|
||||
SERIAL_ECHOLNPGM("mA)");
|
||||
SERIAL_ECHOLNPAIR(" driver overtemperature warning! (", st.getMilliamps(), "mA)");
|
||||
}
|
||||
|
||||
template<typename TMC>
|
||||
@@ -239,7 +239,7 @@
|
||||
st.printLabel();
|
||||
SERIAL_CHAR(':'); SERIAL_PRINT(pwm_scale, DEC);
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
#if HAS_TMCX1X0 || HAS_DRIVER(TMC2208)
|
||||
#if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
SERIAL_CHAR('/'); SERIAL_PRINT(data.cs_actual, DEC);
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
@@ -386,7 +386,7 @@
|
||||
if ((report_tmc_status_interval = update_interval))
|
||||
SERIAL_ECHOLNPGM("axis:pwm_scale"
|
||||
#if HAS_STEALTHCHOP
|
||||
"/current_scale"
|
||||
"/curr_scale"
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
"/mech_load"
|
||||
@@ -398,6 +398,7 @@
|
||||
|
||||
enum TMC_debug_enum : char {
|
||||
TMC_CODES,
|
||||
TMC_UART_ADDR,
|
||||
TMC_ENABLED,
|
||||
TMC_CURRENT,
|
||||
TMC_RMS_CURRENT,
|
||||
@@ -482,9 +483,9 @@
|
||||
#if HAS_TMCX1X0
|
||||
static void _tmc_parse_drv_status(TMC2130Stepper &st, const TMC_drv_status_enum i) {
|
||||
switch (i) {
|
||||
case TMC_STALLGUARD: if (st.stallguard()) SERIAL_CHAR('X'); break;
|
||||
case TMC_SG_RESULT: SERIAL_PRINT(st.sg_result(), DEC); break;
|
||||
case TMC_FSACTIVE: if (st.fsactive()) SERIAL_CHAR('X'); break;
|
||||
case TMC_STALLGUARD: if (st.stallguard()) SERIAL_CHAR('*'); break;
|
||||
case TMC_SG_RESULT: SERIAL_PRINT(st.sg_result(), DEC); break;
|
||||
case TMC_FSACTIVE: if (st.fsactive()) SERIAL_CHAR('*'); break;
|
||||
case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break;
|
||||
default: break;
|
||||
}
|
||||
@@ -515,22 +516,37 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(TMC2208)
|
||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
static void _tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
|
||||
switch (i) {
|
||||
case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
|
||||
case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break;
|
||||
case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break;
|
||||
case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('X'); break;
|
||||
case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('*'); break;
|
||||
case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('*'); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_DRIVER(TMC2209)
|
||||
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
|
||||
static void _tmc_status(TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const TMC_debug_enum i) {
|
||||
switch (i) {
|
||||
case TMC_SGT: SERIAL_PRINT(st.SGTHRS(), DEC); break;
|
||||
case TMC_UART_ADDR: SERIAL_PRINT(st.get_address(), DEC); break;
|
||||
default:
|
||||
TMC2208Stepper *parent = &st;
|
||||
_tmc_status(*parent, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _tmc_parse_drv_status(TMC2208Stepper &st, const TMC_drv_status_enum i) {
|
||||
switch (i) {
|
||||
case TMC_T157: if (st.t157()) SERIAL_CHAR('X'); break;
|
||||
case TMC_T150: if (st.t150()) SERIAL_CHAR('X'); break;
|
||||
case TMC_T143: if (st.t143()) SERIAL_CHAR('X'); break;
|
||||
case TMC_T120: if (st.t120()) SERIAL_CHAR('X'); break;
|
||||
case TMC_T157: if (st.t157()) SERIAL_CHAR('*'); break;
|
||||
case TMC_T150: if (st.t150()) SERIAL_CHAR('*'); break;
|
||||
case TMC_T143: if (st.t143()) SERIAL_CHAR('*'); break;
|
||||
case TMC_T120: if (st.t120()) SERIAL_CHAR('*'); break;
|
||||
case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break;
|
||||
default: break;
|
||||
}
|
||||
@@ -565,24 +581,16 @@
|
||||
case TMC_VSENSE: print_vsense(st); break;
|
||||
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
|
||||
case TMC_TSTEP: {
|
||||
uint32_t tstep_value = st.TSTEP();
|
||||
if (tstep_value == 0xFFFFF) SERIAL_ECHOPGM("max");
|
||||
else SERIAL_ECHO(tstep_value);
|
||||
}
|
||||
break;
|
||||
case TMC_TPWMTHRS: {
|
||||
uint32_t tpwmthrs_val = st.TPWMTHRS();
|
||||
SERIAL_ECHO(tpwmthrs_val);
|
||||
}
|
||||
break;
|
||||
case TMC_TPWMTHRS_MMS: {
|
||||
uint32_t tpwmthrs_val = st.get_pwm_thrs();
|
||||
if (tpwmthrs_val)
|
||||
SERIAL_ECHO(tpwmthrs_val);
|
||||
else
|
||||
SERIAL_CHAR('-');
|
||||
}
|
||||
break;
|
||||
const uint32_t tstep_value = st.TSTEP();
|
||||
if (tstep_value != 0xFFFFF) SERIAL_ECHO(tstep_value); else SERIAL_ECHOPGM("max");
|
||||
} break;
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
case TMC_TPWMTHRS: SERIAL_ECHO(uint32_t(st.TPWMTHRS())); break;
|
||||
case TMC_TPWMTHRS_MMS: {
|
||||
const uint32_t tpwmthrs_val = st.get_pwm_thrs();
|
||||
if (tpwmthrs_val) SERIAL_ECHO(tpwmthrs_val); else SERIAL_CHAR('-');
|
||||
} break;
|
||||
#endif
|
||||
case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
|
||||
@@ -628,13 +636,13 @@
|
||||
SERIAL_CHAR('\t');
|
||||
switch (i) {
|
||||
case TMC_DRV_CODES: st.printLabel(); break;
|
||||
case TMC_STST: if (st.stst()) SERIAL_CHAR('X'); break;
|
||||
case TMC_OLB: if (st.olb()) SERIAL_CHAR('X'); break;
|
||||
case TMC_OLA: if (st.ola()) SERIAL_CHAR('X'); break;
|
||||
case TMC_S2GB: if (st.s2gb()) SERIAL_CHAR('X'); break;
|
||||
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('X'); break;
|
||||
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('X'); break;
|
||||
case TMC_OT: if (st.ot()) SERIAL_CHAR('X'); break;
|
||||
case TMC_STST: if (st.stst()) SERIAL_CHAR('*'); break;
|
||||
case TMC_OLB: if (st.olb()) SERIAL_CHAR('*'); break;
|
||||
case TMC_OLA: if (st.ola()) SERIAL_CHAR('*'); break;
|
||||
case TMC_S2GB: if (st.s2gb()) SERIAL_CHAR('*'); break;
|
||||
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('*'); break;
|
||||
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('*'); break;
|
||||
case TMC_OT: if (st.ot()) SERIAL_CHAR('*'); break;
|
||||
case TMC_DRV_STATUS_HEX: {
|
||||
const uint32_t drv_status = st.DRV_STATUS();
|
||||
SERIAL_CHAR('\t');
|
||||
@@ -767,6 +775,9 @@
|
||||
#define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM, print_x, print_y, print_z, print_e); }while(0)
|
||||
#define DRV_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); drv_status_loop(ITEM, print_x, print_y, print_z, print_e); }while(0)
|
||||
TMC_REPORT("\t", TMC_CODES);
|
||||
#if HAS_DRIVER(TMC2209)
|
||||
TMC_REPORT("Address\t", TMC_UART_ADDR);
|
||||
#endif
|
||||
TMC_REPORT("Enabled\t", TMC_ENABLED);
|
||||
TMC_REPORT("Set current", TMC_CURRENT);
|
||||
TMC_REPORT("RMS current", TMC_RMS_CURRENT);
|
||||
@@ -778,7 +789,7 @@
|
||||
#endif
|
||||
TMC_REPORT("CS actual\t", TMC_CS_ACTUAL);
|
||||
TMC_REPORT("PWM scale", TMC_PWM_SCALE);
|
||||
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2208)
|
||||
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
TMC_REPORT("vsense\t", TMC_VSENSE);
|
||||
#endif
|
||||
TMC_REPORT("stealthChop", TMC_STEALTHCHOP);
|
||||
@@ -810,7 +821,7 @@
|
||||
DRV_REPORT("s2ga\t", TMC_S2GA);
|
||||
DRV_REPORT("otpw\t", TMC_DRV_OTPW);
|
||||
DRV_REPORT("ot\t", TMC_OT);
|
||||
#if HAS_DRIVER(TMC2208)
|
||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
DRV_REPORT("157C\t", TMC_T157);
|
||||
DRV_REPORT("150C\t", TMC_T150);
|
||||
DRV_REPORT("143C\t", TMC_T143);
|
||||
@@ -834,7 +845,7 @@
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if HAS_DRIVER(TMC2208)
|
||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
||||
static void tmc_get_ic_registers(TMC2208Stepper, const TMC_get_registers_enum) { SERIAL_CHAR('\t'); }
|
||||
#endif
|
||||
|
||||
@@ -969,6 +980,15 @@
|
||||
st.en_pwm_mode(restore_stealth);
|
||||
st.diag1_stall(false);
|
||||
}
|
||||
|
||||
bool tmc_enable_stallguard(TMC2209Stepper &st) {
|
||||
st.TCOOLTHRS(0xFFFFF);
|
||||
return true;
|
||||
}
|
||||
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth) {
|
||||
st.TCOOLTHRS(0);
|
||||
}
|
||||
|
||||
bool tmc_enable_stallguard(TMC2660Stepper) {
|
||||
// TODO
|
||||
return false;
|
||||
|
||||
@@ -92,7 +92,7 @@ class TMCStorage {
|
||||
uint8_t hybrid_thrs = 0;
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
int8_t homing_thrs = 0;
|
||||
int16_t homing_thrs = 0;
|
||||
#endif
|
||||
} stored;
|
||||
};
|
||||
@@ -100,10 +100,10 @@ class TMCStorage {
|
||||
template<class TMC, char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
|
||||
class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
public:
|
||||
TMCMarlin(uint16_t cs_pin, float RS) :
|
||||
TMCMarlin(const uint16_t cs_pin, const float RS) :
|
||||
TMC(cs_pin, RS)
|
||||
{}
|
||||
TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) :
|
||||
TMCMarlin(const uint16_t CS, const float RS, const uint16_t pinMOSI, const uint16_t pinMISO, const uint16_t pinSCK) :
|
||||
TMC(CS, RS, pinMOSI, pinMISO, pinSCK)
|
||||
{}
|
||||
inline uint16_t rms_current() { return TMC::rms_current(); }
|
||||
@@ -111,7 +111,7 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
this->val_mA = mA;
|
||||
TMC::rms_current(mA);
|
||||
}
|
||||
inline void rms_current(uint16_t mA, float mult) {
|
||||
inline void rms_current(const uint16_t mA, const float mult) {
|
||||
this->val_mA = mA;
|
||||
TMC::rms_current(mA, mult);
|
||||
}
|
||||
@@ -132,8 +132,9 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
}
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
inline int8_t sgt() { return TMC::sgt(); }
|
||||
void sgt(const int8_t sgt_val) {
|
||||
inline int16_t homing_threshold() { return TMC::sgt(); }
|
||||
void homing_threshold(int16_t sgt_val) {
|
||||
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
|
||||
TMC::sgt(sgt_val);
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
@@ -148,25 +149,28 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
inline void refresh_homing_thrs() { sgt(this->stored.homing_thrs); }
|
||||
inline void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static constexpr int8_t sgt_min = -64,
|
||||
sgt_max = 63;
|
||||
};
|
||||
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
|
||||
class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC2208Stepper, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
public:
|
||||
TMCMarlin(Stream * SerialPort, float RS, bool has_rx=true) :
|
||||
TMC2208Stepper(SerialPort, RS, has_rx=true)
|
||||
TMCMarlin(Stream * SerialPort, const float RS, const uint8_t) :
|
||||
TMC2208Stepper(SerialPort, RS, /*has_rx=*/true)
|
||||
{}
|
||||
TMCMarlin(uint16_t RX, uint16_t TX, float RS, bool has_rx=true) :
|
||||
TMC2208Stepper(RX, TX, RS, has_rx=true)
|
||||
TMCMarlin(const uint16_t RX, const uint16_t TX, const float RS, const uint8_t, const bool has_rx=true) :
|
||||
TMC2208Stepper(RX, TX, RS, has_rx)
|
||||
{}
|
||||
uint16_t rms_current() { return TMC2208Stepper::rms_current(); }
|
||||
inline void rms_current(uint16_t mA) {
|
||||
inline void rms_current(const uint16_t mA) {
|
||||
this->val_mA = mA;
|
||||
TMC2208Stepper::rms_current(mA);
|
||||
}
|
||||
inline void rms_current(uint16_t mA, float mult) {
|
||||
inline void rms_current(const uint16_t mA, const float mult) {
|
||||
this->val_mA = mA;
|
||||
TMC2208Stepper::rms_current(mA, mult);
|
||||
}
|
||||
@@ -195,24 +199,87 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
|
||||
class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC2209Stepper, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
public:
|
||||
TMCMarlin(Stream * SerialPort, const float RS, const uint8_t addr) :
|
||||
TMC2209Stepper(SerialPort, RS, addr)
|
||||
{}
|
||||
TMCMarlin(const uint16_t RX, const uint16_t TX, const float RS, const uint8_t addr, const bool) :
|
||||
TMC2209Stepper(RX, TX, RS, addr)
|
||||
{}
|
||||
uint8_t get_address() { return slave_address; }
|
||||
uint16_t rms_current() { return TMC2209Stepper::rms_current(); }
|
||||
inline void rms_current(const uint16_t mA) {
|
||||
this->val_mA = mA;
|
||||
TMC2209Stepper::rms_current(mA);
|
||||
}
|
||||
inline void rms_current(const uint16_t mA, const float mult) {
|
||||
this->val_mA = mA;
|
||||
TMC2209Stepper::rms_current(mA, mult);
|
||||
}
|
||||
|
||||
#if HAS_STEALTHCHOP
|
||||
inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); }
|
||||
inline bool get_stealthChop_status() { return !this->en_spreadCycle(); }
|
||||
#endif
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
uint32_t get_pwm_thrs() {
|
||||
return _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
|
||||
}
|
||||
void set_pwm_thrs(const uint32_t thrs) {
|
||||
TMC2209Stepper::TPWMTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.hybrid_thrs = thrs;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
inline int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); }
|
||||
void homing_threshold(int16_t sgt_val) {
|
||||
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
|
||||
TMC2209Stepper::SGTHRS(sgt_val);
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
inline void refresh_stepper_current() { rms_current(this->val_mA); }
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
inline void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static constexpr uint8_t sgt_min = 0,
|
||||
sgt_max = 255;
|
||||
};
|
||||
|
||||
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
|
||||
class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC2660Stepper, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
public:
|
||||
TMCMarlin(uint16_t cs_pin, float RS) :
|
||||
TMCMarlin(const uint16_t cs_pin, const float RS) :
|
||||
TMC2660Stepper(cs_pin, RS)
|
||||
{}
|
||||
TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) :
|
||||
TMCMarlin(const uint16_t CS, const float RS, const uint16_t pinMOSI, const uint16_t pinMISO, const uint16_t pinSCK) :
|
||||
TMC2660Stepper(CS, RS, pinMOSI, pinMISO, pinSCK)
|
||||
{}
|
||||
inline uint16_t rms_current() { return TMC2660Stepper::rms_current(); }
|
||||
inline void rms_current(uint16_t mA) {
|
||||
inline void rms_current(const uint16_t mA) {
|
||||
this->val_mA = mA;
|
||||
TMC2660Stepper::rms_current(mA);
|
||||
}
|
||||
|
||||
#if USE_SENSORLESS
|
||||
inline int8_t sgt() { return TMC2660Stepper::sgt(); }
|
||||
void sgt(const int8_t sgt_val) {
|
||||
inline int16_t homing_threshold() { return TMC2660Stepper::sgt(); }
|
||||
void homing_threshold(int16_t sgt_val) {
|
||||
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
|
||||
TMC2660Stepper::sgt(sgt_val);
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
@@ -224,9 +291,12 @@ class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC266
|
||||
inline void refresh_stepper_current() { rms_current(this->val_mA); }
|
||||
|
||||
#if USE_SENSORLESS
|
||||
inline void refresh_homing_thrs() { sgt(this->stored.homing_thrs); }
|
||||
inline void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static constexpr int8_t sgt_min = -64,
|
||||
sgt_max = 63;
|
||||
};
|
||||
|
||||
template<typename TMC>
|
||||
@@ -262,7 +332,7 @@ void tmc_print_current(TMC &st) {
|
||||
void tmc_print_sgt(TMC &st) {
|
||||
st.printLabel();
|
||||
SERIAL_ECHOPGM(" homing sensitivity: ");
|
||||
SERIAL_PRINTLN(st.sgt(), DEC);
|
||||
SERIAL_PRINTLN(st.homing_threshold(), DEC);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -293,6 +363,9 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
|
||||
bool tmc_enable_stallguard(TMC2130Stepper &st);
|
||||
void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth);
|
||||
|
||||
bool tmc_enable_stallguard(TMC2209Stepper &st);
|
||||
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth);
|
||||
|
||||
bool tmc_enable_stallguard(TMC2660Stepper);
|
||||
void tmc_disable_stallguard(TMC2660Stepper, const bool);
|
||||
#endif
|
||||
|
||||
@@ -966,7 +966,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
#ifdef Z_PROBE_END_SCRIPT
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
|
||||
planner.synchronize();
|
||||
enqueue_and_echo_commands_P(PSTR(Z_PROBE_END_SCRIPT));
|
||||
queue.inject_P(PSTR(Z_PROBE_END_SCRIPT));
|
||||
#endif
|
||||
|
||||
// Auto Bed Leveling is complete! Enable if possible.
|
||||
|
||||
@@ -85,7 +85,7 @@ void GcodeSuite::G29() {
|
||||
mbl.reset();
|
||||
mbl_probe_index = 0;
|
||||
if (!ui.wait_for_bl_move) {
|
||||
enqueue_and_echo_commands_P(PSTR("G28\nG29 S2"));
|
||||
queue.inject_P(PSTR("G28\nG29 S2"));
|
||||
return;
|
||||
}
|
||||
state = MeshNext;
|
||||
@@ -134,7 +134,7 @@ void GcodeSuite::G29() {
|
||||
BUZZ(100, 659);
|
||||
BUZZ(100, 698);
|
||||
|
||||
gcode.home_all_axes();
|
||||
home_all_axes();
|
||||
set_bed_leveling_enabled(true);
|
||||
|
||||
#if ENABLED(MESH_G28_REST_ORIGIN)
|
||||
|
||||
@@ -260,13 +260,9 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
|
||||
#else // NOT DELTA
|
||||
|
||||
const bool homeX = always_home_all || parser.seen('X'),
|
||||
homeY = always_home_all || parser.seen('Y'),
|
||||
homeZ = always_home_all || parser.seen('Z'),
|
||||
home_all = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ),
|
||||
doX = home_all || homeX,
|
||||
doY = home_all || homeY,
|
||||
doZ = home_all || homeZ;
|
||||
const bool homeX = parser.seen('X'), homeY = parser.seen('Y'), homeZ = parser.seen('Z'),
|
||||
home_all = always_home_all || (homeX == homeY && homeX == homeZ),
|
||||
doX = home_all || homeX, doY = home_all || homeY, doZ = home_all || homeZ;
|
||||
|
||||
set_destination_from_current();
|
||||
|
||||
|
||||
@@ -121,14 +121,11 @@ void GcodeSuite::G34() {
|
||||
// Users of G34 might have a badly misaligned bed, so raise Z by the
|
||||
// length of the deployed pin (BLTOUCH stroke < 7mm)
|
||||
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f
|
||||
#else
|
||||
#else
|
||||
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES
|
||||
#endif
|
||||
|
||||
// 0.05 is a 5% incline. On a 300mm bed that would be a misalignment of about 1.5cm.
|
||||
// This angle is the maximum misalignment catered for
|
||||
#define MAX_ANGLE 0.05f
|
||||
float z_probe = Z_BASIC_CLEARANCE + MAX_ANGLE * (
|
||||
float z_probe = Z_BASIC_CLEARANCE + (G34_MAX_GRADE) * 0.01f * (
|
||||
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
|
||||
SQRT(MAX(HYPOT2(z_auto_align_xpos[0] - z_auto_align_ypos[0], z_auto_align_xpos[1] - z_auto_align_ypos[1]),
|
||||
HYPOT2(z_auto_align_xpos[1] - z_auto_align_ypos[1], z_auto_align_xpos[2] - z_auto_align_ypos[2]),
|
||||
@@ -139,7 +136,7 @@ void GcodeSuite::G34() {
|
||||
);
|
||||
|
||||
// Home before the alignment procedure
|
||||
gcode.G28(false);
|
||||
home_all_axes();
|
||||
|
||||
// Move the Z coordinate realm towards the positive - dirty trick
|
||||
current_position[Z_AXIS] -= z_probe * 0.5;
|
||||
@@ -154,14 +151,17 @@ void GcodeSuite::G34() {
|
||||
for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions.");
|
||||
|
||||
SERIAL_ECHOLNPAIR(" \nITERATION: ", int(iteration + 1));
|
||||
SERIAL_ECHOLNPAIR("\nITERATION: ", int(iteration + 1));
|
||||
|
||||
// Initialize minimum value
|
||||
float z_measured_min = 100000.0f;
|
||||
// Probe all positions (one per Z-Stepper)
|
||||
for (uint8_t zstepper = 0; zstepper < Z_STEPPER_COUNT; ++zstepper) {
|
||||
for (uint8_t izstepper = 0; izstepper < Z_STEPPER_COUNT; ++izstepper) {
|
||||
// iteration odd/even --> downward / upward stepper sequence
|
||||
const uint8_t zstepper = (iteration & 1) ? Z_STEPPER_COUNT - 1 - izstepper : izstepper;
|
||||
|
||||
// Safe clearance even on an incline
|
||||
do_blocking_move_to_z(z_probe);
|
||||
if (iteration == 0 || izstepper > 0) do_blocking_move_to_z(z_probe);
|
||||
|
||||
// Probe a Z height for each stepper
|
||||
if (isnan(probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], PROBE_PT_RAISE, 0, true))) {
|
||||
@@ -171,8 +171,8 @@ void GcodeSuite::G34() {
|
||||
}
|
||||
|
||||
// This is not the trigger Z value. It is the position of the probe after raising it.
|
||||
// It is higher than the trigger value by a constant value (not known here). This value
|
||||
// is more useful for determining the desired next iteration Z position for probing. It is
|
||||
// It is higher than the trigger value by a constant value (not known here). This value
|
||||
// is more useful for determining the desired next iteration Z position for probing. It is
|
||||
// equally well suited for determining the misalignment, just like the trigger position would be.
|
||||
z_measured[zstepper] = current_position[Z_AXIS];
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]);
|
||||
@@ -185,22 +185,23 @@ void GcodeSuite::G34() {
|
||||
|
||||
// Adapt the next probe clearance height based on the new measurements.
|
||||
// Safe_height = lowest distance to bed (= highest measurement) plus highest measured misalignment.
|
||||
SERIAL_EOL();
|
||||
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
|
||||
z_maxdiff = MAX(ABS(z_measured[0] - z_measured[1]), ABS(z_measured[1] - z_measured[2]), ABS(z_measured[2] - z_measured[0]));
|
||||
z_maxdiff = MAX(ABS(z_measured[0] - z_measured[1]), ABS(z_measured[1] - z_measured[2]), ABS(z_measured[2] - z_measured[0]));
|
||||
z_probe = Z_BASIC_CLEARANCE + MAX(z_measured[0], z_measured[1], z_measured[2]) + z_maxdiff;
|
||||
SERIAL_ECHOLNPAIR("DIFFERENCE Z1-Z2: ", ABS(z_measured[0] - z_measured[1]),
|
||||
"DIFFERENCE Z2-Z3: ", ABS(z_measured[1] - z_measured[2]),
|
||||
"DIFFERENCE Z3-Z1: ", ABS(z_measured[2] - z_measured[0]));
|
||||
#else
|
||||
z_maxdiff = ABS(z_measured[0] - z_measured[1]);
|
||||
z_probe = Z_BASIC_CLEARANCE + MAX(z_measured[0], z_measured[1]) + z_maxdiff;
|
||||
SERIAL_ECHOLNPAIR("DIFFERENCE Z1-Z2: ", ABS(z_measured[0] - z_measured[1]));
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
|
||||
// Raise to the new next probing height right away
|
||||
do_blocking_move_to_z(z_probe);
|
||||
SERIAL_ECHOPAIR("\n"
|
||||
"DIFFERENCE Z1-Z2=", ABS(z_measured[0] - z_measured[1])
|
||||
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
|
||||
, " Z2-Z3=", ABS(z_measured[1] - z_measured[2])
|
||||
, " Z3-Z1=", ABS(z_measured[2] - z_measured[0])
|
||||
#endif
|
||||
);
|
||||
SERIAL_EOL();
|
||||
SERIAL_EOL();
|
||||
|
||||
// The following correction actions are to be enabled for select Z-steppers only
|
||||
stepper.set_separate_multi_axis(true);
|
||||
@@ -221,7 +222,7 @@ void GcodeSuite::G34() {
|
||||
err_break = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Remember the alignment for the next iteration
|
||||
last_z_align_move[zstepper] = z_align_abs;
|
||||
|
||||
@@ -231,7 +232,7 @@ void GcodeSuite::G34() {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " corrected by ", z_align_move);
|
||||
|
||||
// Lock all steppers except one
|
||||
set_all_z_lock(true);
|
||||
set_all_z_lock(true);
|
||||
switch (zstepper) {
|
||||
case 0: stepper.set_z_lock(false); break;
|
||||
case 1: stepper.set_z2_lock(false); break;
|
||||
@@ -245,7 +246,7 @@ void GcodeSuite::G34() {
|
||||
} // for (zstepper)
|
||||
|
||||
// Back to normal stepper operations
|
||||
set_all_z_lock(false);
|
||||
set_all_z_lock(false);
|
||||
stepper.set_separate_multi_axis(false);
|
||||
|
||||
if (err_break) break;
|
||||
@@ -254,10 +255,10 @@ void GcodeSuite::G34() {
|
||||
|
||||
} // for (iteration)
|
||||
|
||||
if (err_break) { SERIAL_ECHOLNPGM("Aborted due to error."); break; }
|
||||
if (err_break) { SERIAL_ECHOLNPGM("G34 aborted."); break; }
|
||||
|
||||
SERIAL_ECHOLNPAIR("Performed iterations: ", int(iteration + (iteration != z_auto_align_iterations)), " of ", int(z_auto_align_iterations));
|
||||
SERIAL_ECHOLNPAIR_F("Achieved accuracy: ", z_maxdiff);
|
||||
SERIAL_ECHOLNPAIR("Did ", int(iteration + (iteration != z_auto_align_iterations)), " iterations of ", int(z_auto_align_iterations));
|
||||
SERIAL_ECHOLNPAIR_F("Accuracy: ", z_maxdiff);
|
||||
SERIAL_EOL();
|
||||
|
||||
// Restore the active tool after homing
|
||||
@@ -284,8 +285,8 @@ void GcodeSuite::G34() {
|
||||
bltouch._stow();
|
||||
#endif
|
||||
|
||||
// Home after the alignment procedure
|
||||
gcode.G28(false);
|
||||
// Home Z after the alignment procedure
|
||||
process_subcommands_now_P(PSTR("G28 Z"));
|
||||
|
||||
} while(0);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
* Also, there are two support functions that can be called from a developer's C code.
|
||||
*
|
||||
* uint16_t check_for_free_memory_corruption(PGM_P const free_memory_start);
|
||||
* void M100_dump_routine(PGM_P const title, const char *start, const char *end);
|
||||
* void M100_dump_routine(PGM_P const title, char *start, char *end);
|
||||
*
|
||||
* Initial version by Roxy-3D
|
||||
*/
|
||||
@@ -63,43 +63,34 @@
|
||||
#if defined(__AVR__) || IS_32BIT_TEENSY
|
||||
|
||||
extern char __bss_end;
|
||||
char* end_bss = &__bss_end;
|
||||
char* free_memory_start = end_bss;
|
||||
|
||||
|
||||
char* free_memory_end = 0;
|
||||
char* stacklimit = 0;
|
||||
char* heaplimit = 0;
|
||||
char *end_bss = &__bss_end,
|
||||
*free_memory_start = end_bss, *free_memory_end = 0,
|
||||
*stacklimit = 0, *heaplimit = 0;
|
||||
|
||||
#define MEMORY_END_CORRECTION 0
|
||||
|
||||
#elif defined(TARGET_LPC1768)
|
||||
|
||||
extern char __bss_end__;
|
||||
extern char __StackLimit;
|
||||
extern char __HeapLimit;
|
||||
extern char __bss_end__, __StackLimit, __HeapLimit;
|
||||
|
||||
char* end_bss = &__bss_end__;
|
||||
char* stacklimit = &__StackLimit;
|
||||
char* heaplimit = &__HeapLimit ;
|
||||
char *end_bss = &__bss_end__,
|
||||
*stacklimit = &__StackLimit,
|
||||
*heaplimit = &__HeapLimit ;
|
||||
|
||||
#define MEMORY_END_CORRECTION 0x200
|
||||
|
||||
char* free_memory_start = heaplimit;
|
||||
char* free_memory_end = stacklimit - MEMORY_END_CORRECTION;
|
||||
|
||||
char *free_memory_start = heaplimit,
|
||||
*free_memory_end = stacklimit - MEMORY_END_CORRECTION;
|
||||
|
||||
#elif defined(__SAM3X8E__)
|
||||
|
||||
extern char _ebss;
|
||||
extern char _ebss;
|
||||
|
||||
char* end_bss = &_ebss;
|
||||
|
||||
char* free_memory_start = end_bss;
|
||||
|
||||
char* free_memory_end = 0;
|
||||
char* stacklimit = 0;
|
||||
char* heaplimit = 0;
|
||||
char *end_bss = &_ebss,
|
||||
*free_memory_start = end_bss,
|
||||
*free_memory_end = 0,
|
||||
*stacklimit = 0,
|
||||
*heaplimit = 0;
|
||||
|
||||
#define MEMORY_END_CORRECTION 0x10000 // need to stay well below 0x20080000 or M100 F crashes
|
||||
|
||||
@@ -141,7 +132,7 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
|
||||
* the block. If so, it may indicate memory corruption due to a bad pointer.
|
||||
* Unexpected bytes are flagged in the right column.
|
||||
*/
|
||||
inline void dump_free_memory(const char *start_free_memory, const char *end_free_memory) {
|
||||
inline void dump_free_memory(char *start_free_memory, char *end_free_memory) {
|
||||
//
|
||||
// Start and end the dump on a nice 16 byte boundary
|
||||
// (even though the values are not 16-byte aligned).
|
||||
@@ -162,7 +153,7 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
|
||||
SERIAL_CHAR('|'); // Point out non test bytes
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
char ccc = (char)start_free_memory[i]; // cast to char before automatically casting to char on assignment, in case the compiler is broken
|
||||
if (&start_free_memory[i] >= (const char*)command_queue && &start_free_memory[i] < (const char*)(command_queue + sizeof(command_queue))) { // Print out ASCII in the command buffer area
|
||||
if (&start_free_memory[i] >= (char*)queue.buffer && &start_free_memory[i] < (char*)queue.buffer + sizeof(queue.buffer)) { // Print out ASCII in the command buffer area
|
||||
if (!WITHIN(ccc, ' ', 0x7E)) ccc = ' ';
|
||||
}
|
||||
else { // If not in the command buffer area, flag bytes that don't match the test byte
|
||||
@@ -177,7 +168,7 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
|
||||
}
|
||||
}
|
||||
|
||||
void M100_dump_routine(PGM_P const title, const char *start, const char *end) {
|
||||
void M100_dump_routine(PGM_P const title, char *start, char *end) {
|
||||
serialprintPGM(title);
|
||||
SERIAL_EOL();
|
||||
//
|
||||
@@ -198,7 +189,7 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
|
||||
|
||||
SERIAL_ECHOPAIR("\nfmc() n=", n);
|
||||
SERIAL_ECHOPAIR("\nfree_memory_start=", hex_address(free_memory_start));
|
||||
SERIAL_ECHOLNPAIR(" end_free_memory=", hex_address(end_free_memory));
|
||||
SERIAL_ECHOLNPAIR(" end_free_memory=", hex_address(end_free_memory));
|
||||
|
||||
if (end_free_memory < start_free_memory) {
|
||||
SERIAL_ECHOPGM(" end_free_memory < Heap ");
|
||||
@@ -340,11 +331,11 @@ void GcodeSuite::M100() {
|
||||
char *sp = top_of_stack();
|
||||
if (!free_memory_end) free_memory_end = sp - MEMORY_END_CORRECTION;
|
||||
SERIAL_ECHOPAIR("\nbss_end : ", hex_address(end_bss));
|
||||
if (heaplimit) SERIAL_ECHOPAIR("\n__heaplimit : ", hex_address(heaplimit ));
|
||||
if (heaplimit) SERIAL_ECHOPAIR("\n__heaplimit : ", hex_address(heaplimit));
|
||||
SERIAL_ECHOPAIR("\nfree_memory_start : ", hex_address(free_memory_start));
|
||||
if (stacklimit) SERIAL_ECHOPAIR("\n__stacklimit : ", hex_address(stacklimit));
|
||||
SERIAL_ECHOPAIR("\nfree_memory_end : ", hex_address(free_memory_end ));
|
||||
if (MEMORY_END_CORRECTION) SERIAL_ECHOPAIR("\nMEMORY_END_CORRECTION: ", MEMORY_END_CORRECTION );
|
||||
SERIAL_ECHOPAIR("\nfree_memory_end : ", hex_address(free_memory_end));
|
||||
if (MEMORY_END_CORRECTION) SERIAL_ECHOPAIR("\nMEMORY_END_CORRECTION: ", MEMORY_END_CORRECTION);
|
||||
SERIAL_ECHOLNPAIR("\nStack Pointer : ", hex_address(sp));
|
||||
|
||||
// Always init on the first invocation of M100
|
||||
|
||||
@@ -61,7 +61,7 @@ void GcodeSuite::M201() {
|
||||
|
||||
LOOP_XYZE(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
const uint8_t a = (i == E_AXIS ? E_AXIS_N(target_extruder) : i);
|
||||
const uint8_t a = (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i);
|
||||
planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void GcodeSuite::M203() {
|
||||
|
||||
LOOP_XYZE(i)
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
const uint8_t a = (i == E_AXIS ? E_AXIS_N(target_extruder) : i);
|
||||
const uint8_t a = (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i);
|
||||
planner.settings.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ inline void servo_probe_test() {
|
||||
", stow angle: ", servo_angles[probe_index][1]
|
||||
);
|
||||
|
||||
bool deploy_state, stow_state;
|
||||
bool deploy_state = false, stow_state;
|
||||
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
|
||||
@@ -141,7 +141,7 @@ inline void servo_probe_test() {
|
||||
|
||||
// First, check for a probe that recognizes an advanced BLTouch sequence.
|
||||
// In addition to STOW and DEPLOY, it uses SW MODE (and RESET in the beginning)
|
||||
// to see if this is one of the following: BLTOUCH Classic 1.2, 1.3, or
|
||||
// to see if this is one of the following: BLTOUCH Classic 1.2, 1.3, or
|
||||
// BLTouch Smart 1.0, 2.0, 2.2, 3.0, 3.1. But only if the user has actually
|
||||
// configured a BLTouch as being present. If the user has not configured this,
|
||||
// the BLTouch will be detected in the last phase of these tests (see further on).
|
||||
@@ -218,17 +218,18 @@ inline void servo_probe_test() {
|
||||
if (deploy_state != READ(PROBE_TEST_PIN)) { // probe triggered
|
||||
for (probe_counter = 0; probe_counter < 15 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter) safe_delay(2);
|
||||
|
||||
SERIAL_ECHOPGM(". Pulse width");
|
||||
if (probe_counter == 15)
|
||||
SERIAL_ECHOLNPGM(". Pulse width: 30ms or more");
|
||||
else
|
||||
SERIAL_ECHOLNPAIR(". Pulse width (+/- 4ms): ", probe_counter * 2);
|
||||
|
||||
SERIAL_ECHOLNPGM(": 30ms or more");
|
||||
else
|
||||
SERIAL_ECHOLNPAIR(" (+/- 4ms): ", probe_counter * 2);
|
||||
|
||||
if (probe_counter >= 4) {
|
||||
if (probe_counter == 15) {
|
||||
if (blt) SERIAL_ECHOPGM("= BLTouch V3.1");
|
||||
else SERIAL_ECHOPGM("= Z Servo Probe");
|
||||
}
|
||||
else SERIAL_ECHOPGM("= BLTouch pre V3.1 or compatible probe");
|
||||
else SERIAL_ECHOPGM("= BLTouch pre V3.1 (or compatible)");
|
||||
SERIAL_ECHOLNPGM(" detected.");
|
||||
}
|
||||
else SERIAL_ECHOLNPGM("FAIL: Noise detected - please re-run test");
|
||||
@@ -238,7 +239,7 @@ inline void servo_probe_test() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!probe_counter) SERIAL_ECHOLNPGM("FAIL: Trigger not detected");
|
||||
if (!probe_counter) SERIAL_ECHOLNPGM("FAIL: No trigger detected");
|
||||
|
||||
#endif // HAS_Z_SERVO_PROBE
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/stepper.h"
|
||||
@@ -37,4 +37,4 @@ void GcodeSuite::M540() {
|
||||
|
||||
}
|
||||
|
||||
#endif // ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
#endif // SD_ABORT_ON_ENDSTOP_HIT
|
||||
|
||||
@@ -40,6 +40,8 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
|
||||
SERIAL_ECHOPAIR(" M92 T", (int)i);
|
||||
SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
|
||||
}
|
||||
#else
|
||||
UNUSED(e);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
DEBUG_ECHOPAIR("\nX2 Home X: ", x_home_pos(1), "\nX2_MIN_POS=", int(X2_MIN_POS), "\nX2_MAX_POS=", int(X2_MAX_POS));
|
||||
DEBUG_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR), "\nX2_HOME_POS=", int(X2_HOME_POS));
|
||||
DEBUG_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE));
|
||||
DEBUG_ECHOPAIR("\nTOOLCHANGE_ZRAISE=", float(TOOLCHANGE_ZRAISE));
|
||||
DEBUG_ECHOPAIR("\toolchange_settings.z_raise=", toolchange_settings.z_raise);
|
||||
DEBUG_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET));
|
||||
DEBUG_EOL();
|
||||
|
||||
@@ -158,11 +158,12 @@
|
||||
* A value of 0 disables duplication.
|
||||
*/
|
||||
void GcodeSuite::M605() {
|
||||
bool ena = false;
|
||||
if (parser.seen("EPS")) {
|
||||
planner.synchronize();
|
||||
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
|
||||
else if (parser.seenval('E')) duplication_e_mask = pow(2, e + 1) - 1; // Set the mask by E index
|
||||
const bool ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
|
||||
else if (parser.seenval('E')) duplication_e_mask = pow(2, parser.value_int() + 1) - 1; // Set the mask by E index
|
||||
ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
|
||||
extruder_duplication_enabled = ena && (duplication_e_mask >= 3);
|
||||
}
|
||||
SERIAL_ECHO_START();
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 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/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(COOLANT_CONTROL)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
#if ENABLED(COOLANT_MIST)
|
||||
/**
|
||||
* M7: Mist Coolant On
|
||||
*/
|
||||
void GcodeSuite::M7() {
|
||||
planner.synchronize(); // Wait for move to arrive
|
||||
WRITE(COOLANT_MIST_PIN, !(COOLANT_MIST_INVERT)); // Turn on Mist coolant
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(COOLANT_FLOOD)
|
||||
/**
|
||||
* M8: Flood Coolant On
|
||||
*/
|
||||
void GcodeSuite::M8() {
|
||||
planner.synchronize(); // Wait for move to arrive
|
||||
WRITE(COOLANT_FLOOD_PIN, !(COOLANT_FLOOD_INVERT)); // Turn on Flood coolant
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M9: Coolant OFF
|
||||
*/
|
||||
void GcodeSuite::M9() {
|
||||
planner.synchronize(); // Wait for move to arrive
|
||||
#if ENABLED(COOLANT_MIST)
|
||||
WRITE(COOLANT_MIST_PIN, COOLANT_MIST_INVERT); // Turn off Mist coolant
|
||||
#endif
|
||||
#if ENABLED(COOLANT_FLOOD)
|
||||
WRITE(COOLANT_FLOOD_PIN, COOLANT_FLOOD_INVERT); // Turn off Flood coolant
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // COOLANT_CONTROL
|
||||
@@ -42,6 +42,5 @@ void GcodeSuite::M999() {
|
||||
|
||||
if (parser.boolval('S')) return;
|
||||
|
||||
// gcode_LastN = Stopped_gcode_LastN;
|
||||
flush_and_request_resend();
|
||||
queue.flush_and_request_resend();
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ void GcodeSuite::M916() {
|
||||
|
||||
// turn the motor(s) both directions
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
// get the status after the motors have stopped
|
||||
planner.synchronize();
|
||||
@@ -226,10 +226,10 @@ void GcodeSuite::M917() {
|
||||
DEBUG_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
|
||||
@@ -263,7 +263,7 @@ void GcodeSuite::M917() {
|
||||
L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
}
|
||||
DEBUG_ECHOLNPGM(".");
|
||||
gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
|
||||
reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
|
||||
watchdog_reset(); // beat the dog
|
||||
safe_delay(5000);
|
||||
status_composite_temp = 0;
|
||||
@@ -518,10 +518,10 @@ void GcodeSuite::M918() {
|
||||
DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, current_feedrate);
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, current_feedrate);
|
||||
gcode.process_subcommands_now_P(gcode_string);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
|
||||
|
||||
@@ -85,16 +85,10 @@ void GcodeSuite::M907() {
|
||||
*/
|
||||
void GcodeSuite::M908() {
|
||||
#if HAS_DIGIPOTSS
|
||||
stepper.digitalPotWrite(
|
||||
parser.intval('P'),
|
||||
parser.intval('S')
|
||||
);
|
||||
stepper.digitalPotWrite(parser.intval('P'), parser.intval('S'));
|
||||
#endif
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
dac_current_raw(
|
||||
parser.byteval('P', -1),
|
||||
parser.ushortval('S', 0)
|
||||
);
|
||||
dac_current_raw(parser.byteval('P', -1), parser.ushortval('S', 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void GcodeSuite::M600() {
|
||||
|
||||
#if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)
|
||||
// Don't allow filament change without homing first
|
||||
if (axis_unhomed_error()) gcode.home_all_axes();
|
||||
if (axis_unhomed_error()) home_all_axes();
|
||||
#endif
|
||||
|
||||
#if EXTRUDERS > 1
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
|
||||
#define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
|
||||
#define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2209) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
|
||||
#define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N))
|
||||
|
||||
#define M91x_SOME_X (M91x_USE(X) || M91x_USE(X2))
|
||||
@@ -41,7 +41,7 @@
|
||||
#define M91x_SOME_E (M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5))
|
||||
|
||||
#if !M91x_SOME_X && !M91x_SOME_Y && !M91x_SOME_Z && !M91x_SOME_E
|
||||
#error "MONITOR_DRIVER_STATUS requires at least one TMC2130, TMC2208, or TMC2660."
|
||||
#error "MONITOR_DRIVER_STATUS requires at least one TMC2130, 2160, 2208, 2209, 2660, 5130, or 5160."
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -313,39 +313,39 @@
|
||||
bool report = true;
|
||||
const uint8_t index = parser.byteval('I');
|
||||
LOOP_XYZ(i) if (parser.seen(axis_codes[i])) {
|
||||
const int8_t value = (int8_t)constrain(parser.value_int(), -64, 63);
|
||||
const int16_t value = parser.value_int();
|
||||
report = false;
|
||||
switch (i) {
|
||||
#if X_SENSORLESS
|
||||
case X_AXIS:
|
||||
#if AXIS_HAS_STALLGUARD(X)
|
||||
if (index < 2) stepperX.sgt(value);
|
||||
if (index < 2) stepperX.homing_threshold(value);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(X2)
|
||||
if (!(index & 1)) stepperX2.sgt(value);
|
||||
if (!(index & 1)) stepperX2.homing_threshold(value);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if Y_SENSORLESS
|
||||
case Y_AXIS:
|
||||
#if AXIS_HAS_STALLGUARD(Y)
|
||||
if (index < 2) stepperY.sgt(value);
|
||||
if (index < 2) stepperY.homing_threshold(value);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Y2)
|
||||
if (!(index & 1)) stepperY2.sgt(value);
|
||||
if (!(index & 1)) stepperY2.homing_threshold(value);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if Z_SENSORLESS
|
||||
case Z_AXIS:
|
||||
#if AXIS_HAS_STALLGUARD(Z)
|
||||
if (index < 2) stepperZ.sgt(value);
|
||||
if (index < 2) stepperZ.homing_threshold(value);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Z2)
|
||||
if (index == 0 || index == 2) stepperZ2.sgt(value);
|
||||
if (index == 0 || index == 2) stepperZ2.homing_threshold(value);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Z3)
|
||||
if (index == 0 || index == 3) stepperZ3.sgt(value);
|
||||
if (index == 0 || index == 3) stepperZ3.homing_threshold(value);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
+55
-55
@@ -120,7 +120,8 @@ void GcodeSuite::get_destination_from_command() {
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Only update power loss recovery on moves with E
|
||||
if (seen[E_AXIS] && (seen[X_AXIS] || seen[Y_AXIS]) && IS_SD_PRINTING()) recovery.save();
|
||||
if (recovery.enabled && IS_SD_PRINTING() && seen[E_AXIS] && (seen[X_AXIS] || seen[Y_AXIS]))
|
||||
recovery.save();
|
||||
#endif
|
||||
|
||||
if (parser.linearval('F') > 0)
|
||||
@@ -180,17 +181,13 @@ void GcodeSuite::dwell(millis_t time) {
|
||||
// Placeholders for non-migrated codes
|
||||
//
|
||||
#if ENABLED(M100_FREE_MEMORY_WATCHER)
|
||||
extern void M100_dump_routine(PGM_P const title, const char *start, const char *end);
|
||||
extern void M100_dump_routine(PGM_P const title, char *start, char *end);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Process the parsed command and dispatch it to its handler
|
||||
*/
|
||||
void GcodeSuite::process_parsed_command(
|
||||
#if USE_EXECUTE_COMMANDS_IMMEDIATE
|
||||
const bool no_ok
|
||||
#endif
|
||||
) {
|
||||
void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
|
||||
// Handle a known G, M, or T
|
||||
@@ -326,9 +323,19 @@ void GcodeSuite::process_parsed_command(
|
||||
#endif
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_ENABLE)
|
||||
case 3: M3_M4(false); break; // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW
|
||||
case 4: M3_M4(true ); break; // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW
|
||||
case 5: M5(); break; // M5 - turn spindle/laser off
|
||||
case 3: M3_M4(false); break; // M3: Turn ON Laser | Spindle (clockwise), set Power | Speed
|
||||
case 4: M3_M4(true ); break; // M4: Turn ON Laser | Spindle (counter-clockwise), set Power | Speed
|
||||
case 5: M5(); break; // M5: Turn OFF Laser | Spindle
|
||||
#endif
|
||||
|
||||
#if ENABLED(COOLANT_CONTROL)
|
||||
#if ENABLED(COOLANT_MIST)
|
||||
case 7: M7(); break; // M7: Mist coolant ON
|
||||
#endif
|
||||
#if ENABLED(COOLANT_FLOOD)
|
||||
case 8: M8(); break; // M8: Flood coolant ON
|
||||
#endif
|
||||
case 9: M9(); break; // M9: Coolant OFF
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||
@@ -338,9 +345,9 @@ void GcodeSuite::process_parsed_command(
|
||||
case 17: M17(); break; // M17: Enable all stepper motors
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
case 20: M20(); break; // M20: list SD card
|
||||
case 21: M21(); break; // M21: init SD card
|
||||
case 22: M22(); break; // M22: release SD card
|
||||
case 20: M20(); break; // M20: List SD card
|
||||
case 21: M21(); break; // M21: Init SD card
|
||||
case 22: M22(); break; // M22: Release SD card
|
||||
case 23: M23(); break; // M23: Select file
|
||||
case 24: M24(); break; // M24: Start SD print
|
||||
case 25: M25(); break; // M25: Pause SD print
|
||||
@@ -658,7 +665,7 @@ void GcodeSuite::process_parsed_command(
|
||||
case 524: M524(); break; // M524: Abort the current SD print job
|
||||
#endif
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
|
||||
case 540: M540(); break; // M540: Set abort on endstop hit for SD printing
|
||||
#endif
|
||||
|
||||
@@ -791,10 +798,7 @@ void GcodeSuite::process_parsed_command(
|
||||
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
|
||||
#if USE_EXECUTE_COMMANDS_IMMEDIATE
|
||||
if (!no_ok)
|
||||
#endif
|
||||
ok_to_send();
|
||||
if (!no_ok) queue.ok_to_send();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -802,16 +806,16 @@ void GcodeSuite::process_parsed_command(
|
||||
* This is called from the main loop()
|
||||
*/
|
||||
void GcodeSuite::process_next_command() {
|
||||
char * const current_command = command_queue[cmd_queue_index_r];
|
||||
char * const current_command = queue.buffer[queue.index_r];
|
||||
|
||||
PORT_REDIRECT(command_queue_port[cmd_queue_index_r]);
|
||||
PORT_REDIRECT(queue.port[queue.index_r]);
|
||||
|
||||
if (DEBUGGING(ECHO)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLN(current_command);
|
||||
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
||||
SERIAL_ECHOPAIR("slot:", cmd_queue_index_r);
|
||||
M100_dump_routine(PSTR(" Command Queue:"), (const char*)command_queue, (const char*)(command_queue) + sizeof(command_queue));
|
||||
SERIAL_ECHOPAIR("slot:", queue.index_r);
|
||||
M100_dump_routine(PSTR(" Command Queue:"), queue.buffer, queue.buffer + sizeof(queue.buffer));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -820,43 +824,39 @@ void GcodeSuite::process_next_command() {
|
||||
process_parsed_command();
|
||||
}
|
||||
|
||||
#if USE_EXECUTE_COMMANDS_IMMEDIATE
|
||||
/**
|
||||
* Run a series of commands, bypassing the command queue to allow
|
||||
* G-code "macros" to be called from within other G-code handlers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Run a series of commands, bypassing the command queue to allow
|
||||
* G-code "macros" to be called from within other G-code handlers.
|
||||
*/
|
||||
|
||||
void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) {
|
||||
char * const saved_cmd = parser.command_ptr; // Save the parser state
|
||||
for (;;) {
|
||||
PGM_P const delim = strchr_P(pgcode, '\n'); // Get address of next newline
|
||||
const size_t len = delim ? delim - pgcode : strlen_P(pgcode); // Get the command length
|
||||
char cmd[len + 1]; // Allocate a stack buffer
|
||||
strncpy_P(cmd, pgcode, len); // Copy the command to the stack
|
||||
cmd[len] = '\0'; // End with a nul
|
||||
parser.parse(cmd); // Parse the command
|
||||
process_parsed_command(true); // Process it
|
||||
if (!delim) break; // Last command?
|
||||
pgcode = delim + 1; // Get the next command
|
||||
}
|
||||
parser.parse(saved_cmd); // Restore the parser state
|
||||
void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) {
|
||||
char * const saved_cmd = parser.command_ptr; // Save the parser state
|
||||
for (;;) {
|
||||
PGM_P const delim = strchr_P(pgcode, '\n'); // Get address of next newline
|
||||
const size_t len = delim ? delim - pgcode : strlen_P(pgcode); // Get the command length
|
||||
char cmd[len + 1]; // Allocate a stack buffer
|
||||
strncpy_P(cmd, pgcode, len); // Copy the command to the stack
|
||||
cmd[len] = '\0'; // End with a nul
|
||||
parser.parse(cmd); // Parse the command
|
||||
process_parsed_command(true); // Process it
|
||||
if (!delim) break; // Last command?
|
||||
pgcode = delim + 1; // Get the next command
|
||||
}
|
||||
parser.parse(saved_cmd); // Restore the parser state
|
||||
}
|
||||
|
||||
void GcodeSuite::process_subcommands_now(char * gcode) {
|
||||
char * const saved_cmd = parser.command_ptr; // Save the parser state
|
||||
for (;;) {
|
||||
char * const delim = strchr(gcode, '\n'); // Get address of next newline
|
||||
if (delim) *delim = '\0'; // Replace with nul
|
||||
parser.parse(gcode); // Parse the current command
|
||||
process_parsed_command(true); // Process it
|
||||
if (!delim) break; // Last command?
|
||||
gcode = delim + 1; // Get the next command
|
||||
}
|
||||
parser.parse(saved_cmd); // Restore the parser state
|
||||
void GcodeSuite::process_subcommands_now(char * gcode) {
|
||||
char * const saved_cmd = parser.command_ptr; // Save the parser state
|
||||
for (;;) {
|
||||
char * const delim = strchr(gcode, '\n'); // Get address of next newline
|
||||
if (delim) *delim = '\0'; // Replace with nul
|
||||
parser.parse(gcode); // Parse the current command
|
||||
process_parsed_command(true); // Process it
|
||||
if (!delim) break; // Last command?
|
||||
gcode = delim + 1; // Get the next command
|
||||
}
|
||||
|
||||
#endif // USE_EXECUTE_COMMANDS_IMMEDIATE
|
||||
parser.parse(saved_cmd); // Restore the parser state
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
|
||||
|
||||
+32
-24
@@ -30,11 +30,11 @@
|
||||
* -----------------
|
||||
*
|
||||
* Helpful G-code references:
|
||||
* - http://linuxcnc.org/handbook/gcode/g-code.html
|
||||
* - http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
|
||||
* - http://marlinfw.org/meta/gcode
|
||||
* - https://reprap.org/wiki/G-code
|
||||
* - http://linuxcnc.org/docs/html/gcode.html
|
||||
*
|
||||
* Help to document Marlin's G-codes online:
|
||||
* - http://reprap.org/wiki/G-code
|
||||
* - https://github.com/MarlinFirmware/MarlinDocumentation
|
||||
*
|
||||
* -----------------
|
||||
@@ -75,9 +75,12 @@
|
||||
*
|
||||
* M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
|
||||
* M1 -> M0
|
||||
* M3 - Turn laser/spindle on, set spindle/laser speed/power, set rotation to clockwise
|
||||
* M4 - Turn laser/spindle on, set spindle/laser speed/power, set rotation to counter-clockwise
|
||||
* M5 - Turn laser/spindle off
|
||||
* M3 - Turn ON Laser | Spindle (clockwise), set Power | Speed. (Requires SPINDLE_LASER_ENABLE)
|
||||
* M4 - Turn ON Laser | Spindle (counter-clockwise), set Power | Speed. (Requires SPINDLE_LASER_ENABLE)
|
||||
* M5 - Turn OFF Laser | Spindle. (Requires SPINDLE_LASER_ENABLE)
|
||||
* M7 - Turn mist coolant ON. (Requires COOLANT_CONTROL)
|
||||
* M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL)
|
||||
* M9 - Turn coolant OFF. (Requires COOLANT_CONTROL)
|
||||
* M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||
* M17 - Enable/Power all stepper motors
|
||||
* M18 - Disable all stepper motors; same as M84
|
||||
@@ -136,7 +139,7 @@
|
||||
* M119 - Report endstops status.
|
||||
* M120 - Enable endstops detection.
|
||||
* M121 - Disable endstops detection.
|
||||
* M122 - Debug stepper (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660 or L6470)
|
||||
* M122 - Debug stepper (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470)
|
||||
* M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
|
||||
* M126 - Solenoid Air Valve Open. (Requires BARICUDA)
|
||||
* M127 - Solenoid Air Valve Closed. (Requires BARICUDA)
|
||||
@@ -213,9 +216,9 @@
|
||||
* M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! **
|
||||
* M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output.
|
||||
* M504 - Validate EEPROM contents. (Requires EEPROM_SETTINGS)
|
||||
* M524 - Abort the current SD print job (started with M24)
|
||||
* M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
* M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130 or TMC2208)
|
||||
* M524 - Abort the current SD print job started with M24. (Requires SDSUPPORT)
|
||||
* M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires SD_ABORT_ON_ENDSTOP_HIT)
|
||||
* M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160)
|
||||
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
* M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
|
||||
@@ -238,13 +241,13 @@
|
||||
* M869 - Report position encoder module error.
|
||||
* 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/TMC2208/TMC2660 or L6470)
|
||||
* 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)
|
||||
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
|
||||
* M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
|
||||
* M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
|
||||
* M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
|
||||
* M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
|
||||
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
|
||||
* M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
|
||||
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
|
||||
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
|
||||
* M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
|
||||
* M916 - L6470 tuning: Increase KVAL_HOLD until thermal warning. (Requires at least one _DRIVER_TYPE L6470)
|
||||
@@ -309,19 +312,14 @@ public:
|
||||
static int8_t get_target_e_stepper_from_command();
|
||||
static void get_destination_from_command();
|
||||
|
||||
static void process_parsed_command(
|
||||
#if USE_EXECUTE_COMMANDS_IMMEDIATE
|
||||
const bool no_ok = false
|
||||
#endif
|
||||
);
|
||||
static void process_parsed_command(const bool no_ok=false);
|
||||
static void process_next_command();
|
||||
|
||||
#if USE_EXECUTE_COMMANDS_IMMEDIATE
|
||||
static void process_subcommands_now_P(PGM_P pgcode);
|
||||
static void process_subcommands_now(char * gcode);
|
||||
#endif
|
||||
// Execute G-code in-place, preserving current G-code parameters
|
||||
static void process_subcommands_now_P(PGM_P pgcode);
|
||||
static void process_subcommands_now(char * gcode);
|
||||
|
||||
FORCE_INLINE static void home_all_axes() { G28(true); }
|
||||
static inline void home_all_axes() { process_subcommands_now_P(PSTR("G28")); }
|
||||
|
||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
/**
|
||||
@@ -460,6 +458,16 @@ private:
|
||||
static void M5();
|
||||
#endif
|
||||
|
||||
#if ENABLED(COOLANT_CONTROL)
|
||||
#if ENABLED(COOLANT_MIST)
|
||||
static void M7();
|
||||
#endif
|
||||
#if ENABLED(COOLANT_FLOOD)
|
||||
static void M8();
|
||||
#endif
|
||||
static void M9();
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||
static void M12();
|
||||
#endif
|
||||
@@ -769,7 +777,7 @@ private:
|
||||
static void M524();
|
||||
#endif
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
|
||||
static void M540();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
*/
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../queue.h" // for gcode_LastN
|
||||
#include "../queue.h" // for last_N
|
||||
|
||||
/**
|
||||
* M110: Set Current Line Number
|
||||
*/
|
||||
void GcodeSuite::M110() {
|
||||
if (parser.seenval('N')) gcode_LastN = parser.value_long();
|
||||
if (parser.seenval('N')) queue.last_N = parser.value_long();
|
||||
}
|
||||
|
||||
@@ -59,6 +59,14 @@
|
||||
|
||||
/**
|
||||
* M290: Babystepping
|
||||
*
|
||||
* X<linear> - Distance to step X
|
||||
* Y<linear> - Distance to step Y
|
||||
* Z<linear> - Distance to step Z
|
||||
* S<linear> - Distance to step Z (alias for Z)
|
||||
*
|
||||
* With BABYSTEP_ZPROBE_OFFSET:
|
||||
* P0 - Don't adjust the Z probe offset.
|
||||
*/
|
||||
void GcodeSuite::M290() {
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
|
||||
@@ -42,7 +42,7 @@ bool GCodeParser::volumetric_enabled;
|
||||
#endif
|
||||
|
||||
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
||||
TempUnit GCodeParser::input_temp_units;
|
||||
TempUnit GCodeParser::input_temp_units = TEMPUNIT_C;
|
||||
#endif
|
||||
|
||||
char *GCodeParser::command_ptr,
|
||||
|
||||
+122
-107
@@ -25,6 +25,8 @@
|
||||
*/
|
||||
|
||||
#include "queue.h"
|
||||
GCodeQueue queue;
|
||||
|
||||
#include "gcode.h"
|
||||
|
||||
#include "../lcd/ultralcd.h"
|
||||
@@ -42,7 +44,7 @@
|
||||
* sending commands to Marlin, and lines will be checked for sequentiality.
|
||||
* M110 N<int> sets the current line number.
|
||||
*/
|
||||
long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
|
||||
long gcode_N, GCodeQueue::last_N, GCodeQueue::stopped_N = 0;
|
||||
|
||||
/**
|
||||
* GCode Command Queue
|
||||
@@ -53,17 +55,17 @@ long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
|
||||
* the main loop. The gcode.process_next_command method parses the next
|
||||
* command and hands off execution to individual handler functions.
|
||||
*/
|
||||
uint8_t commands_in_queue = 0, // Count of commands in the queue
|
||||
cmd_queue_index_r = 0, // Ring buffer read position
|
||||
cmd_queue_index_w = 0; // Ring buffer write position
|
||||
uint8_t GCodeQueue::length = 0, // Count of commands in the queue
|
||||
GCodeQueue::index_r = 0, // Ring buffer read position
|
||||
GCodeQueue::index_w = 0; // Ring buffer write position
|
||||
|
||||
char command_queue[BUFSIZE][MAX_CMD_SIZE];
|
||||
char GCodeQueue::buffer[BUFSIZE][MAX_CMD_SIZE];
|
||||
|
||||
/*
|
||||
* The port that the command was received on
|
||||
*/
|
||||
#if NUM_SERIAL > 1
|
||||
int16_t command_queue_port[BUFSIZE];
|
||||
int16_t GCodeQueue::port[BUFSIZE];
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -82,7 +84,7 @@ bool send_ok[BUFSIZE];
|
||||
*/
|
||||
static PGM_P injected_commands_P = nullptr;
|
||||
|
||||
void queue_setup() {
|
||||
GCodeQueue::GCodeQueue() {
|
||||
// Send "ok" after commands by default
|
||||
for (uint8_t i = 0; i < COUNT(send_ok); i++) send_ok[i] = true;
|
||||
}
|
||||
@@ -90,24 +92,24 @@ void queue_setup() {
|
||||
/**
|
||||
* Clear the Marlin command queue
|
||||
*/
|
||||
void clear_command_queue() {
|
||||
cmd_queue_index_r = cmd_queue_index_w = commands_in_queue = 0;
|
||||
void GCodeQueue::clear() {
|
||||
index_r = index_w = length = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Once a new command is in the ring buffer, call this to commit it
|
||||
*/
|
||||
inline void _commit_command(bool say_ok
|
||||
void GCodeQueue::_commit_command(bool say_ok
|
||||
#if NUM_SERIAL > 1
|
||||
, int16_t port = -1
|
||||
, int16_t p/*=-1*/
|
||||
#endif
|
||||
) {
|
||||
send_ok[cmd_queue_index_w] = say_ok;
|
||||
send_ok[index_w] = say_ok;
|
||||
#if NUM_SERIAL > 1
|
||||
command_queue_port[cmd_queue_index_w] = port;
|
||||
port[index_w] = p;
|
||||
#endif
|
||||
if (++cmd_queue_index_w >= BUFSIZE) cmd_queue_index_w = 0;
|
||||
commands_in_queue++;
|
||||
if (++index_w >= BUFSIZE) index_w = 0;
|
||||
length++;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,16 +117,16 @@ inline void _commit_command(bool say_ok
|
||||
* Return true if the command was successfully added.
|
||||
* Return false for a full buffer, or if the 'command' is a comment.
|
||||
*/
|
||||
inline bool _enqueuecommand(const char* cmd, bool say_ok=false
|
||||
bool GCodeQueue::_enqueue(const char* cmd, bool say_ok/*=false*/
|
||||
#if NUM_SERIAL > 1
|
||||
, int16_t port = -1
|
||||
, int16_t pn/*=-1*/
|
||||
#endif
|
||||
) {
|
||||
if (*cmd == ';' || commands_in_queue >= BUFSIZE) return false;
|
||||
strcpy(command_queue[cmd_queue_index_w], cmd);
|
||||
if (*cmd == ';' || length >= BUFSIZE) return false;
|
||||
strcpy(buffer[index_w], cmd);
|
||||
_commit_command(say_ok
|
||||
#if NUM_SERIAL > 1
|
||||
, port
|
||||
, pn
|
||||
#endif
|
||||
);
|
||||
return true;
|
||||
@@ -132,19 +134,17 @@ inline bool _enqueuecommand(const char* cmd, bool say_ok=false
|
||||
|
||||
/**
|
||||
* Enqueue with Serial Echo
|
||||
* Return true if the command was consumed
|
||||
*/
|
||||
bool enqueue_and_echo_command(const char* cmd) {
|
||||
bool GCodeQueue::enqueue_one(const char* cmd) {
|
||||
|
||||
//SERIAL_ECHOPGM("enqueue_and_echo_command(\"");
|
||||
//SERIAL_ECHOPGM("enqueue_one(\"");
|
||||
//SERIAL_ECHO(cmd);
|
||||
//SERIAL_ECHOPGM("\") \n");
|
||||
|
||||
if (*cmd == 0 || *cmd == '\n' || *cmd == '\r') {
|
||||
//SERIAL_ECHOLNPGM("Null command found... Did not queue!");
|
||||
return true;
|
||||
}
|
||||
if (*cmd == 0 || *cmd == '\n' || *cmd == '\r') return true;
|
||||
|
||||
if (_enqueuecommand(cmd)) {
|
||||
if (_enqueue(cmd)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(MSG_ENQUEUEING, cmd, "\"");
|
||||
return true;
|
||||
@@ -153,52 +153,66 @@ bool enqueue_and_echo_command(const char* cmd) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject the next "immediate" command, when possible, onto the front of the queue.
|
||||
* Return true if any immediate commands remain to inject.
|
||||
* Process the next "immediate" command.
|
||||
*/
|
||||
static bool drain_injected_commands_P() {
|
||||
if (injected_commands_P != nullptr) {
|
||||
size_t i = 0;
|
||||
char c, cmd[60];
|
||||
strncpy_P(cmd, injected_commands_P, sizeof(cmd) - 1);
|
||||
cmd[sizeof(cmd) - 1] = '\0';
|
||||
while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
|
||||
cmd[i] = '\0';
|
||||
if (enqueue_and_echo_command(cmd)) // success?
|
||||
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr; // next command or done
|
||||
}
|
||||
return (injected_commands_P != nullptr); // return whether any more remain
|
||||
bool GCodeQueue::process_injected_command() {
|
||||
if (injected_commands_P == nullptr) return false;
|
||||
|
||||
char c;
|
||||
size_t i = 0;
|
||||
while ((c = pgm_read_byte(&injected_commands_P[i])) && c != '\n') i++;
|
||||
if (!i) return false;
|
||||
|
||||
char cmd[i + 1];
|
||||
memcpy_P(cmd, injected_commands_P, i);
|
||||
cmd[i] = '\0';
|
||||
|
||||
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr;
|
||||
|
||||
parser.parse(cmd);
|
||||
PORT_REDIRECT(SERIAL_PORT);
|
||||
gcode.process_parsed_command();
|
||||
PORT_RESTORE();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record one or many commands to run from program memory.
|
||||
* Enqueue one or many commands to run from program memory.
|
||||
* Do not inject a comment or use leading spaces!
|
||||
* Aborts the current queue, if any.
|
||||
* Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards
|
||||
* Note: process_injected_command() will be called to drain any commands afterwards
|
||||
*/
|
||||
void enqueue_and_echo_commands_P(PGM_P const pgcode) {
|
||||
void GCodeQueue::inject_P(PGM_P const pgcode) {
|
||||
injected_commands_P = pgcode;
|
||||
(void)drain_injected_commands_P(); // first command executed asap (when possible)
|
||||
}
|
||||
|
||||
#if HAS_QUEUE_NOW
|
||||
/**
|
||||
* Enqueue and return only when commands are actually enqueued.
|
||||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void enqueue_and_echo_command_now(const char* cmd) {
|
||||
while (!enqueue_and_echo_command(cmd)) idle();
|
||||
/**
|
||||
* Enqueue and return only when commands are actually enqueued.
|
||||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void GCodeQueue::enqueue_one_now(const char* cmd) {
|
||||
while (!enqueue_one(cmd)) idle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue from program memory and return only when commands are actually enqueued
|
||||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void GCodeQueue::enqueue_now_P(PGM_P const pgcode) {
|
||||
size_t i = 0;
|
||||
PGM_P p = pgcode;
|
||||
for (;;) {
|
||||
char c;
|
||||
while ((c = p[i]) && c != '\n') i++;
|
||||
char cmd[i + 1];
|
||||
memcpy_P(cmd, p, i);
|
||||
cmd[i] = '\0';
|
||||
enqueue_one_now(cmd);
|
||||
if (!c) break;
|
||||
p += i + 1;
|
||||
}
|
||||
#if HAS_LCD_QUEUE_NOW
|
||||
/**
|
||||
* Enqueue from program memory and return only when commands are actually enqueued
|
||||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void enqueue_and_echo_commands_now_P(PGM_P const pgcode) {
|
||||
enqueue_and_echo_commands_P(pgcode);
|
||||
while (drain_injected_commands_P()) idle();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "ok" message to the host, indicating
|
||||
@@ -209,16 +223,16 @@ void enqueue_and_echo_commands_P(PGM_P const pgcode) {
|
||||
* P<int> Planner space remaining
|
||||
* B<int> Block queue space remaining
|
||||
*/
|
||||
void ok_to_send() {
|
||||
void GCodeQueue::ok_to_send() {
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
if (port < 0) return;
|
||||
PORT_REDIRECT(port);
|
||||
const int16_t pn = port[index_r];
|
||||
if (pn < 0) return;
|
||||
PORT_REDIRECT(pn);
|
||||
#endif
|
||||
if (!send_ok[cmd_queue_index_r]) return;
|
||||
if (!send_ok[index_r]) return;
|
||||
SERIAL_ECHOPGM(MSG_OK);
|
||||
#if ENABLED(ADVANCED_OK)
|
||||
char* p = command_queue[cmd_queue_index_r];
|
||||
char* p = buffer[index_r];
|
||||
if (*p == 'N') {
|
||||
SERIAL_ECHO(' ');
|
||||
SERIAL_ECHO(*p++);
|
||||
@@ -226,7 +240,7 @@ void ok_to_send() {
|
||||
SERIAL_ECHO(*p++);
|
||||
}
|
||||
SERIAL_ECHOPGM(" P"); SERIAL_ECHO(int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
|
||||
SERIAL_ECHOPGM(" B"); SERIAL_ECHO(BUFSIZE - commands_in_queue);
|
||||
SERIAL_ECHOPGM(" B"); SERIAL_ECHO(BUFSIZE - length);
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@@ -235,15 +249,15 @@ void ok_to_send() {
|
||||
* Send a "Resend: nnn" message to the host to
|
||||
* indicate that a command needs to be re-sent.
|
||||
*/
|
||||
void flush_and_request_resend() {
|
||||
void GCodeQueue::flush_and_request_resend() {
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
if (port < 0) return;
|
||||
PORT_REDIRECT(port);
|
||||
const int16_t p = port[index_r];
|
||||
if (p < 0) return;
|
||||
PORT_REDIRECT(p);
|
||||
#endif
|
||||
SERIAL_FLUSH();
|
||||
SERIAL_ECHOPGM(MSG_RESEND);
|
||||
SERIAL_ECHOLN(gcode_LastN + 1);
|
||||
SERIAL_ECHOLN(last_N + 1);
|
||||
ok_to_send();
|
||||
}
|
||||
|
||||
@@ -266,16 +280,6 @@ inline int read_serial(const uint8_t index) {
|
||||
}
|
||||
}
|
||||
|
||||
void gcode_line_error(PGM_P const err, const int8_t port) {
|
||||
PORT_REDIRECT(port);
|
||||
SERIAL_ERROR_START();
|
||||
serialprintPGM(err);
|
||||
SERIAL_ECHOLN(gcode_LastN);
|
||||
while (read_serial(port) != -1); // clear out the RX buffer
|
||||
flush_and_request_resend();
|
||||
serial_count[port] = 0;
|
||||
}
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
|
||||
inline bool serial_data_available(const uint8_t index) {
|
||||
@@ -526,6 +530,16 @@ void gcode_line_error(PGM_P const err, const int8_t port) {
|
||||
|
||||
#endif // BINARY_FILE_TRANSFER
|
||||
|
||||
void GCodeQueue::gcode_line_error(PGM_P const err, const int8_t port) {
|
||||
PORT_REDIRECT(port);
|
||||
SERIAL_ERROR_START();
|
||||
serialprintPGM(err);
|
||||
SERIAL_ECHOLN(last_N);
|
||||
while (read_serial(port) != -1); // clear out the RX buffer
|
||||
flush_and_request_resend();
|
||||
serial_count[port] = 0;
|
||||
}
|
||||
|
||||
FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", but not "M290", etc
|
||||
const char * const m29 = strstr_P(cmd, PSTR("M29"));
|
||||
return m29 && !NUMERIC(m29[3]);
|
||||
@@ -536,7 +550,7 @@ FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", b
|
||||
* Exit when the buffer is full or when no more characters are
|
||||
* left on the serial port.
|
||||
*/
|
||||
inline void get_serial_commands() {
|
||||
void GCodeQueue::get_serial_commands() {
|
||||
static char serial_line_buffer[NUM_SERIAL][MAX_CMD_SIZE];
|
||||
static bool serial_comment_mode[NUM_SERIAL] = { false }
|
||||
#if ENABLED(PAREN_COMMENTS)
|
||||
@@ -561,7 +575,7 @@ inline void get_serial_commands() {
|
||||
#if NO_TIMEOUTS > 0
|
||||
static millis_t last_command_time = 0;
|
||||
const millis_t ms = millis();
|
||||
if (commands_in_queue == 0 && !serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
|
||||
if (length == 0 && !serial_data_available() && ELAPSED(ms, last_command_time + NO_TIMEOUTS)) {
|
||||
SERIAL_ECHOLNPGM(MSG_WAIT);
|
||||
last_command_time = ms;
|
||||
}
|
||||
@@ -570,7 +584,7 @@ inline void get_serial_commands() {
|
||||
/**
|
||||
* Loop while serial characters are incoming and the queue is not full
|
||||
*/
|
||||
while (commands_in_queue < BUFSIZE && serial_data_available()) {
|
||||
while (length < BUFSIZE && serial_data_available()) {
|
||||
for (uint8_t i = 0; i < NUM_SERIAL; ++i) {
|
||||
int c;
|
||||
if ((c = read_serial(i)) < 0) continue;
|
||||
@@ -610,7 +624,7 @@ inline void get_serial_commands() {
|
||||
|
||||
gcode_N = strtol(npos + 1, nullptr, 10);
|
||||
|
||||
if (gcode_N != gcode_LastN + 1 && !M110)
|
||||
if (gcode_N != last_N + 1 && !M110)
|
||||
return gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
|
||||
|
||||
char *apos = strrchr(command, '*');
|
||||
@@ -623,7 +637,7 @@ inline void get_serial_commands() {
|
||||
else
|
||||
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
||||
|
||||
gcode_LastN = gcode_N;
|
||||
last_N = gcode_N;
|
||||
}
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Pronterface "M29" and "M29 " has no line number
|
||||
@@ -669,7 +683,7 @@ inline void get_serial_commands() {
|
||||
#endif
|
||||
|
||||
// Add the command to the queue
|
||||
_enqueuecommand(serial_line_buffer[i], true
|
||||
_enqueue(serial_line_buffer[i], true
|
||||
#if NUM_SERIAL > 1
|
||||
, i
|
||||
#endif
|
||||
@@ -711,7 +725,7 @@ inline void get_serial_commands() {
|
||||
* or until the end of the file is reached. The special character '#'
|
||||
* can also interrupt buffering.
|
||||
*/
|
||||
inline void get_sdcard_commands() {
|
||||
inline void GCodeQueue::get_sdcard_commands() {
|
||||
static bool stop_buffering = false,
|
||||
sd_comment_mode = false
|
||||
#if ENABLED(PAREN_COMMENTS)
|
||||
@@ -728,11 +742,11 @@ inline void get_serial_commands() {
|
||||
* due to checksums, however, no checksums are used in SD printing.
|
||||
*/
|
||||
|
||||
if (commands_in_queue == 0) stop_buffering = false;
|
||||
if (length == 0) stop_buffering = false;
|
||||
|
||||
uint16_t sd_count = 0;
|
||||
bool card_eof = card.eof();
|
||||
while (commands_in_queue < BUFSIZE && !card_eof && !stop_buffering) {
|
||||
while (length < BUFSIZE && !card_eof && !stop_buffering) {
|
||||
const int16_t n = card.get();
|
||||
char sd_char = (char)n;
|
||||
card_eof = card.eof();
|
||||
@@ -755,7 +769,7 @@ inline void get_serial_commands() {
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onPrintCompleted();
|
||||
#if HAS_RESUME_CONTINUE
|
||||
enqueue_and_echo_commands_P(PSTR("M0 S"
|
||||
inject_P(PSTR("M0 S"
|
||||
#if HAS_LCD_MENU
|
||||
"1800"
|
||||
#else
|
||||
@@ -779,7 +793,7 @@ inline void get_serial_commands() {
|
||||
// Skip empty lines and comments
|
||||
if (!sd_count) { thermalManager.manage_heater(); continue; }
|
||||
|
||||
command_queue[cmd_queue_index_w][sd_count] = '\0'; // terminate string
|
||||
buffer[index_w][sd_count] = '\0'; // terminate string
|
||||
sd_count = 0; // clear sd line buffer
|
||||
|
||||
_commit_command(false);
|
||||
@@ -800,7 +814,7 @@ inline void get_serial_commands() {
|
||||
#if ENABLED(PAREN_COMMENTS)
|
||||
&& ! sd_comment_paren_mode
|
||||
#endif
|
||||
) command_queue[cmd_queue_index_w][sd_count++] = sd_char;
|
||||
) buffer[index_w][sd_count++] = sd_char;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -813,10 +827,7 @@ inline void get_serial_commands() {
|
||||
* - The active serial input (usually USB)
|
||||
* - The SD card file being actively printed
|
||||
*/
|
||||
void get_available_commands() {
|
||||
|
||||
// if any immediate commands remain, don't get other commands yet
|
||||
if (drain_injected_commands_P()) return;
|
||||
void GCodeQueue::get_available_commands() {
|
||||
|
||||
get_serial_commands();
|
||||
|
||||
@@ -828,14 +839,18 @@ void get_available_commands() {
|
||||
/**
|
||||
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
||||
*/
|
||||
void advance_command_queue() {
|
||||
void GCodeQueue::advance() {
|
||||
|
||||
if (!commands_in_queue) return;
|
||||
// Process immediate commands
|
||||
if (process_injected_command()) return;
|
||||
|
||||
// Return if the G-code buffer is empty
|
||||
if (!length) return;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
if (card.flag.saving) {
|
||||
char* command = command_queue[cmd_queue_index_r];
|
||||
char* command = buffer[index_r];
|
||||
if (is_M29(command)) {
|
||||
// M29 closes the file
|
||||
card.closefile();
|
||||
@@ -872,9 +887,9 @@ void advance_command_queue() {
|
||||
#endif // SDSUPPORT
|
||||
|
||||
// The queue may be reset by a command handler or by code invoked by idle() within a handler
|
||||
if (commands_in_queue) {
|
||||
--commands_in_queue;
|
||||
if (++cmd_queue_index_r >= BUFSIZE) cmd_queue_index_r = 0;
|
||||
if (length) {
|
||||
--length;
|
||||
if (++index_r >= BUFSIZE) index_r = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+108
-81
@@ -28,98 +28,125 @@
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
/**
|
||||
* GCode line number handling. Hosts may include line numbers when sending
|
||||
* commands to Marlin, and lines will be checked for sequentiality.
|
||||
* M110 N<int> sets the current line number.
|
||||
*/
|
||||
extern long gcode_LastN, Stopped_gcode_LastN;
|
||||
class GCodeQueue {
|
||||
public:
|
||||
/**
|
||||
* GCode line number handling. Hosts may include line numbers when sending
|
||||
* commands to Marlin, and lines will be checked for sequentiality.
|
||||
* M110 N<int> sets the current line number.
|
||||
*/
|
||||
static long last_N, stopped_N;
|
||||
|
||||
/**
|
||||
* GCode Command Queue
|
||||
* A simple ring buffer of BUFSIZE command strings.
|
||||
*
|
||||
* Commands are copied into this buffer by the command injectors
|
||||
* (immediate, serial, sd card) and they are processed sequentially by
|
||||
* the main loop. The gcode.process_next_command method parses the next
|
||||
* command and hands off execution to individual handler functions.
|
||||
*/
|
||||
extern uint8_t commands_in_queue, // Count of commands in the queue
|
||||
cmd_queue_index_r; // Ring buffer read position
|
||||
static inline void stop() { stopped_N = last_N; }
|
||||
|
||||
extern char command_queue[BUFSIZE][MAX_CMD_SIZE];
|
||||
/**
|
||||
* GCode Command Queue
|
||||
* A simple ring buffer of BUFSIZE command strings.
|
||||
*
|
||||
* Commands are copied into this buffer by the command injectors
|
||||
* (immediate, serial, sd card) and they are processed sequentially by
|
||||
* the main loop. The gcode.process_next_command method parses the next
|
||||
* command and hands off execution to individual handler functions.
|
||||
*/
|
||||
static uint8_t length, // Count of commands in the queue
|
||||
index_r; // Ring buffer read position
|
||||
|
||||
/*
|
||||
* The port that the command was received on
|
||||
*/
|
||||
#if NUM_SERIAL > 1
|
||||
extern int16_t command_queue_port[BUFSIZE];
|
||||
#endif
|
||||
static char buffer[BUFSIZE][MAX_CMD_SIZE];
|
||||
|
||||
/**
|
||||
* Initialization of queue for setup()
|
||||
*/
|
||||
void queue_setup();
|
||||
/*
|
||||
* The port that the command was received on
|
||||
*/
|
||||
#if NUM_SERIAL > 1
|
||||
static int16_t port[BUFSIZE];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clear the Marlin command queue
|
||||
*/
|
||||
void clear_command_queue();
|
||||
GCodeQueue();
|
||||
|
||||
/**
|
||||
* Clear the serial line and request a resend of
|
||||
* the next expected line number.
|
||||
*/
|
||||
void flush_and_request_resend();
|
||||
/**
|
||||
* Clear the Marlin command queue
|
||||
*/
|
||||
static void clear();
|
||||
|
||||
/**
|
||||
* Send an "ok" message to the host, indicating
|
||||
* that a command was successfully processed.
|
||||
*
|
||||
* If ADVANCED_OK is enabled also include:
|
||||
* N<int> Line number of the command, if any
|
||||
* P<int> Planner space remaining
|
||||
* B<int> Block queue space remaining
|
||||
*/
|
||||
void ok_to_send();
|
||||
/**
|
||||
* Enqueue one or many commands to run from program memory.
|
||||
* Aborts the current queue, if any.
|
||||
* Note: process_injected_command() will process them.
|
||||
*/
|
||||
static void inject_P(PGM_P const pgcode);
|
||||
|
||||
/**
|
||||
* Record one or many commands to run from program memory.
|
||||
* Aborts the current queue, if any.
|
||||
* Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards
|
||||
*/
|
||||
void enqueue_and_echo_commands_P(PGM_P const pgcode);
|
||||
|
||||
/**
|
||||
* Enqueue with Serial Echo
|
||||
*/
|
||||
bool enqueue_and_echo_command(const char* cmd);
|
||||
|
||||
#define HAS_LCD_QUEUE_NOW (ENABLED(MALYAN_LCD) || (HAS_LCD_MENU && ANY(AUTO_BED_LEVELING_UBL, PID_AUTOTUNE_MENU, ADVANCED_PAUSE_FEATURE)))
|
||||
#define HAS_QUEUE_NOW (ENABLED(SDSUPPORT) || HAS_LCD_QUEUE_NOW)
|
||||
|
||||
#if HAS_QUEUE_NOW
|
||||
/**
|
||||
* Enqueue and return only when commands are actually enqueued
|
||||
*/
|
||||
void enqueue_and_echo_command_now(const char* cmd);
|
||||
#if HAS_LCD_QUEUE_NOW
|
||||
/**
|
||||
* Enqueue from program memory and return only when commands are actually enqueued
|
||||
*/
|
||||
void enqueue_and_echo_commands_now_P(PGM_P const cmd);
|
||||
static void enqueue_one_now(const char* cmd);
|
||||
|
||||
/**
|
||||
* Enqueue from program memory and return only when commands are actually enqueued
|
||||
*/
|
||||
static void enqueue_now_P(PGM_P const cmd);
|
||||
|
||||
/**
|
||||
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
||||
*/
|
||||
static void advance();
|
||||
|
||||
/**
|
||||
* Add to the circular command queue the next command from:
|
||||
* - The command-injection queue (injected_commands_P)
|
||||
* - The active serial input (usually USB)
|
||||
* - The SD card file being actively printed
|
||||
*/
|
||||
static void get_available_commands();
|
||||
|
||||
/**
|
||||
* Send an "ok" message to the host, indicating
|
||||
* that a command was successfully processed.
|
||||
*
|
||||
* If ADVANCED_OK is enabled also include:
|
||||
* N<int> Line number of the command, if any
|
||||
* P<int> Planner space remaining
|
||||
* B<int> Block queue space remaining
|
||||
*/
|
||||
static void ok_to_send();
|
||||
|
||||
/**
|
||||
* Clear the serial line and request a resend of
|
||||
* the next expected line number.
|
||||
*/
|
||||
static void flush_and_request_resend();
|
||||
|
||||
private:
|
||||
|
||||
static uint8_t index_w; // Ring buffer write position
|
||||
|
||||
static void get_serial_commands();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void get_sdcard_commands();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Add to the circular command queue the next command from:
|
||||
* - The command-injection queue (injected_commands_P)
|
||||
* - The active serial input (usually USB)
|
||||
* - The SD card file being actively printed
|
||||
*/
|
||||
void get_available_commands();
|
||||
static void _commit_command(bool say_ok
|
||||
#if NUM_SERIAL > 1
|
||||
, int16_t p=-1
|
||||
#endif
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
||||
*/
|
||||
void advance_command_queue();
|
||||
static bool _enqueue(const char* cmd, bool say_ok=false
|
||||
#if NUM_SERIAL > 1
|
||||
, int16_t p=-1
|
||||
#endif
|
||||
);
|
||||
|
||||
// Process the next "immediate" command
|
||||
static bool process_injected_command();
|
||||
|
||||
/**
|
||||
* Enqueue with Serial Echo
|
||||
* Return true on success
|
||||
*/
|
||||
static bool enqueue_one(const char* cmd);
|
||||
|
||||
static void gcode_line_error(PGM_P const err, const int8_t port);
|
||||
|
||||
};
|
||||
|
||||
extern GCodeQueue queue;
|
||||
|
||||
@@ -53,7 +53,7 @@ void GcodeSuite::M28() {
|
||||
SERIAL_ECHOLN(p);
|
||||
card.openFile(p, false);
|
||||
#if NUM_SERIAL > 1
|
||||
card.transfer_port_index = command_queue_port[cmd_queue_index_r];
|
||||
card.transfer_port_index = queue.port[queue.index_r];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#define ADC_KEY_NUM 8
|
||||
#define ULTIPANEL
|
||||
|
||||
// this helps to implement ADC_KEYPAD menus
|
||||
// This helps to implement ADC_KEYPAD menus
|
||||
#define REVERSE_MENU_DIRECTION
|
||||
#define ENCODER_PULSES_PER_STEP 1
|
||||
#define ENCODER_STEPS_PER_MENU_ITEM 1
|
||||
@@ -97,8 +97,6 @@
|
||||
|
||||
#define U8GLIB_SSD1306
|
||||
#define ULTIPANEL
|
||||
#define REVERSE_ENCODER_DIRECTION
|
||||
#define REVERSE_MENU_DIRECTION
|
||||
|
||||
#elif ENABLED(RA_CONTROL_PANEL)
|
||||
|
||||
@@ -141,15 +139,18 @@
|
||||
#define DEFAULT_LCD_CONTRAST 150
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
|
||||
#elif ANY(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)
|
||||
|
||||
#define FYSETC_MINI_12864
|
||||
#define DOGLCD
|
||||
#define ULTIPANEL
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
#define DEFAULT_LCD_CONTRAST 255
|
||||
#define DEFAULT_LCD_CONTRAST 220
|
||||
#define LED_COLORS_REDUCE_GREEN
|
||||
#if POWER_SUPPLY > 0 && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
|
||||
#define LED_BACKLIGHT_TIMEOUT 10000
|
||||
#endif
|
||||
|
||||
// Require LED backlighting enabled
|
||||
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
|
||||
@@ -178,7 +179,6 @@
|
||||
|
||||
#if ENABLED(ULTI_CONTROLLER)
|
||||
#define U8GLIB_SSD1309
|
||||
#define REVERSE_ENCODER_DIRECTION
|
||||
#define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#define LCD_CONTRAST_MAX 254
|
||||
@@ -335,7 +335,7 @@
|
||||
#endif
|
||||
|
||||
// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
|
||||
#if ENABLED(MALYAN_LCD)
|
||||
#if EITHER(DGUS_LCD, MALYAN_LCD)
|
||||
#define EXTENSIBLE_UI
|
||||
#endif
|
||||
|
||||
@@ -405,9 +405,6 @@
|
||||
#define E_MANUAL EXTRUDERS
|
||||
#elif ENABLED(PRUSA_MMU2)
|
||||
#define E_STEPPERS 1
|
||||
#ifndef TOOLCHANGE_ZRAISE
|
||||
#define TOOLCHANGE_ZRAISE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// No inactive extruders with MK2_MULTIPLEXER or SWITCHING_NOZZLE
|
||||
@@ -502,24 +499,30 @@
|
||||
/**
|
||||
* Set flags for enabled probes
|
||||
*/
|
||||
#define HAS_BED_PROBE (HAS_Z_SERVO_PROBE || ANY(FIX_MOUNTED_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE))
|
||||
#define HAS_BED_PROBE (HAS_Z_SERVO_PROBE || ANY(FIX_MOUNTED_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE))
|
||||
#define PROBE_SELECTED (HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#define USES_Z_MIN_PROBE_ENDSTOP DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
#define HOMING_Z_WITH_PROBE (Z_HOME_DIR < 0 && !USES_Z_MIN_PROBE_ENDSTOP)
|
||||
#ifndef Z_PROBE_LOW_POINT
|
||||
#define Z_PROBE_LOW_POINT -5
|
||||
#endif
|
||||
#if ENABLED(Z_PROBE_ALLEN_KEY)
|
||||
#define PROBE_TRIGGERED_WHEN_STOWED_TEST // Extra test for Allen Key Probe
|
||||
#endif
|
||||
#ifdef MULTIPLE_PROBING
|
||||
#if EXTRA_PROBING
|
||||
#define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
|
||||
#else
|
||||
#define TOTAL_PROBING MULTIPLE_PROBING
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
// Clear probe pin settings when no probe is selected
|
||||
#undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
|
||||
#endif
|
||||
|
||||
#define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
|
||||
|
||||
#ifdef GRID_MAX_POINTS_X
|
||||
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
|
||||
#endif
|
||||
|
||||
@@ -493,7 +493,7 @@
|
||||
* Preserve this ordering when adding new drivers.
|
||||
*/
|
||||
|
||||
#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) || HAS_DRIVER(TMC5130_STANDALONE) || HAS_DRIVER(TMC5160_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE))
|
||||
#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC2209_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) || HAS_DRIVER(TMC5130_STANDALONE) || HAS_DRIVER(TMC5160_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE))
|
||||
|
||||
#ifndef MINIMUM_STEPPER_DIR_DELAY
|
||||
#if HAS_DRIVER(TB6560)
|
||||
@@ -905,8 +905,8 @@
|
||||
#if HAS_TRINAMIC
|
||||
#define HAS_TMCX1X0 (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160))
|
||||
#define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
|
||||
#define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
|
||||
#define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208))
|
||||
#define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2209) || HAS_DRIVER(TMC2660))
|
||||
#define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209))
|
||||
|
||||
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
|
||||
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
|
||||
@@ -1700,8 +1700,6 @@
|
||||
// If platform requires early initialization of watchdog to properly boot
|
||||
#define EARLY_WATCHDOG (ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM))
|
||||
|
||||
#define USE_EXECUTE_COMMANDS_IMMEDIATE (ANY(G29_RETRY_AND_RECOVER, GCODE_MACROS, POWER_LOSS_RECOVERY) || HAS_DRIVER(L6470))
|
||||
|
||||
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
|
||||
#define Z_STEPPER_COUNT 3
|
||||
#elif ENABLED(Z_DUAL_STEPPER_DRIVERS)
|
||||
|
||||
+178
-86
@@ -48,6 +48,7 @@
|
||||
#if !defined(CONFIGURATION_ADV_H_VERSION) || HEXIFY(CONFIGURATION_ADV_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_ADV_H_VERSION)
|
||||
#error "You are using an old Configuration_adv.h file, update it before building Marlin."
|
||||
#endif
|
||||
#undef HEXIFY
|
||||
|
||||
/**
|
||||
* Warnings for old configurations
|
||||
@@ -274,6 +275,8 @@
|
||||
#error "HAVE_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
|
||||
#elif defined(HAVE_TMC2130)
|
||||
#error "HAVE_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130. Please update your Configuration.h."
|
||||
#elif defined(HAVE_TMC2208)
|
||||
#error "HAVE_TMC2208 is now [AXIS]_DRIVER_TYPE TMC2208. Please update your Configuration.h."
|
||||
#elif defined(HAVE_L6470DRIVER)
|
||||
#error "HAVE_L6470DRIVER is now [AXIS]_DRIVER_TYPE L6470. Please update your Configuration.h."
|
||||
#elif defined(X_IS_TMC) || defined(X2_IS_TMC) || defined(Y_IS_TMC) || defined(Y2_IS_TMC) || defined(Z_IS_TMC) || defined(Z2_IS_TMC) || defined(Z3_IS_TMC) \
|
||||
@@ -355,6 +358,10 @@
|
||||
#error "Z_MIN_PROBE_ENDSTOP is no longer required. Please remove it from Configuration.h."
|
||||
#elif defined(DUAL_NOZZLE_DUPLICATION_MODE)
|
||||
#error "DUAL_NOZZLE_DUPLICATION_MODE is now MULTI_NOZZLE_DUPLICATION. Please update your configuration."
|
||||
#elif defined(MENU_ITEM_CASE_LIGHT)
|
||||
#error "MENU_ITEM_CASE_LIGHT is now CASE_LIGHT_MENU. Please update your configuration."
|
||||
#elif defined(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
#error "ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED is now SD_ABORT_ON_ENDSTOP_HIT. Please update your Configuration_adv.h."
|
||||
#endif
|
||||
|
||||
#define BOARD_MKS_13 -47
|
||||
@@ -370,6 +377,10 @@
|
||||
#elif MB(FORMBOT_TREX2)
|
||||
#error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration."
|
||||
#endif
|
||||
#undef BOARD_MKS_13
|
||||
#undef BOARD_TRIGORILLA
|
||||
#undef BOARD_RURAMPS4D
|
||||
#undef BOARD_FORMBOT_TREX2
|
||||
|
||||
/**
|
||||
* Marlin release, version and default string
|
||||
@@ -694,7 +705,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
|
||||
#ifndef TOOLCHANGE_ZRAISE
|
||||
#error "TOOLCHANGE_ZRAISE required for EXTRUDERS > 1. Please update your Configuration."
|
||||
#error "TOOLCHANGE_ZRAISE required for EXTRUDERS > 1. Please update your Configuration_adv.h."
|
||||
#endif
|
||||
|
||||
#elif ENABLED(MK2_MULTIPLEXER)
|
||||
@@ -976,11 +987,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ ENABLED(FIX_MOUNTED_PROBE) \
|
||||
+ (HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH)) \
|
||||
+ ENABLED(BLTOUCH) \
|
||||
+ ENABLED(TOUCH_MI_PROBE) \
|
||||
+ ENABLED(SOLENOID_PROBE) \
|
||||
+ ENABLED(Z_PROBE_ALLEN_KEY) \
|
||||
+ ENABLED(Z_PROBE_SLED) \
|
||||
+ ENABLED(RACK_AND_PINION_PROBE)
|
||||
#error "Please enable only one probe option: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
|
||||
#error "Please enable only one probe option: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
@@ -1037,14 +1049,33 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "RACK_AND_PINION_PROBE requires Z_PROBE_DEPLOY_X and Z_PROBE_RETRACT_X."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Touch-MI probe requirements
|
||||
*/
|
||||
#if ENABLED(TOUCH_MI_PROBE)
|
||||
#if DISABLED(Z_SAFE_HOMING)
|
||||
#error "TOUCH_MI_PROBE requires Z_SAFE_HOMING."
|
||||
#elif !defined(TOUCH_MI_RETRACT_Z)
|
||||
#error "TOUCH_MI_PROBE requires TOUCH_MI_RETRACT_Z."
|
||||
#elif defined(Z_AFTER_PROBING)
|
||||
#error "TOUCH_MI_PROBE requires Z_AFTER_PROBING to be disabled."
|
||||
#elif Z_HOMING_HEIGHT < 10
|
||||
#error "TOUCH_MI_PROBE requires Z_HOMING_HEIGHT >= 10."
|
||||
#elif Z_MIN_PROBE_ENDSTOP_INVERTING
|
||||
#error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_INVERTING to be set to false."
|
||||
#elif DISABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
#error "TOUCH_MI_PROBE requires BABYSTEPPING with BABYSTEP_ZPROBE_OFFSET."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Require pin options and pins to be defined
|
||||
*/
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
#if ENABLED(DELTA) && (!AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130))
|
||||
#error "SENSORLESS_PROBING requires TMC2130 drivers on X, Y, and Z."
|
||||
#elif !AXIS_DRIVER_TYPE_Z(TMC2130)
|
||||
#error "SENSORLESS_PROBING requires a TMC2130 driver on Z."
|
||||
#if ENABLED(DELTA) && !(AXIS_HAS_STALLGUARD(X) && AXIS_HAS_STALLGUARD(Y) && AXIS_HAS_STALLGUARD(Z))
|
||||
#error "SENSORLESS_PROBING requires TMC2130/2160/2209/5130/5160 drivers on X, Y, and Z."
|
||||
#elif !AXIS_HAS_STALLGUARD(Z)
|
||||
#error "SENSORLESS_PROBING requires a TMC2130/2160/2209/5130/5160 driver on Z."
|
||||
#endif
|
||||
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
#if DISABLED(USE_ZMIN_PLUG)
|
||||
@@ -1073,8 +1104,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "Probes need Z_AFTER_PROBING >= 0."
|
||||
#endif
|
||||
|
||||
#if MULTIPLE_PROBING && MULTIPLE_PROBING < 2
|
||||
#error "MULTIPLE_PROBING must be >= 2."
|
||||
#if MULTIPLE_PROBING || EXTRA_PROBING
|
||||
#if !MULTIPLE_PROBING
|
||||
#error "EXTRA_PROBING requires MULTIPLE_PROBING."
|
||||
#elif MULTIPLE_PROBING < 2
|
||||
#error "MULTIPLE_PROBING must be 2 or more."
|
||||
#elif MULTIPLE_PROBING <= EXTRA_PROBING
|
||||
#error "EXTRA_PROBING must be less than MULTIPLE_PROBING."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if Z_PROBE_LOW_POINT > 0
|
||||
@@ -1369,9 +1406,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "TEMP_SENSOR_4 1000 requires HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS and HOTEND4_BETA in Configuration_adv.h."
|
||||
#elif ENABLED(HEATER_5_USER_THERMISTOR) && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA))
|
||||
#error "TEMP_SENSOR_5 1000 requires HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS and HOTEND5_BETA in Configuration_adv.h."
|
||||
#elif ENABLED(BED_USER_THERMISTOR) && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA))
|
||||
#elif ENABLED(HEATER_BED_USER_THERMISTOR) && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA))
|
||||
#error "TEMP_SENSOR_BED 1000 requires BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS and BED_BETA in Configuration_adv.h."
|
||||
#elif ENABLED(CHAMBER_USER_THERMISTOR) && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA))
|
||||
#elif ENABLED(HEATER_CHAMBER_USER_THERMISTOR) && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA))
|
||||
#error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
|
||||
#endif
|
||||
|
||||
@@ -1491,6 +1528,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "LED_CONTROL_MENU requires BLINKM, RGB_LED, RGBW_LED, PCA9533, PCA9632, or NEOPIXEL_LED."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LED Backlight Timeout
|
||||
*/
|
||||
#if defined(LED_BACKLIGHT_TIMEOUT) && !(EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && POWER_SUPPLY > 0)
|
||||
#error "LED_BACKLIGHT_TIMEOUT requires a Fysetc Mini Panel and a Power Switch."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Basic multi hotend duplication mode
|
||||
*/
|
||||
@@ -1739,6 +1783,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "NEOPIXEL_LED requires NEOPIXEL_PIN and NEOPIXEL_PIXELS."
|
||||
#endif
|
||||
#endif
|
||||
#undef _RGB_TEST
|
||||
|
||||
/**
|
||||
* Auto Fan check for PWM pins
|
||||
@@ -1804,6 +1849,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ ENABLED(G3D_PANEL) \
|
||||
+ (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864)) \
|
||||
+ ENABLED(MKS_MINI_12864) \
|
||||
+ ENABLED(FYSETC_MINI_12864_X_X) \
|
||||
+ ENABLED(FYSETC_MINI_12864_1_2) \
|
||||
+ ENABLED(FYSETC_MINI_12864_2_0) \
|
||||
+ ENABLED(FYSETC_MINI_12864_2_1) \
|
||||
@@ -1838,73 +1884,106 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
/**
|
||||
* Check existing CS pins against enabled TMC SPI drivers.
|
||||
*/
|
||||
#define INVALID_TMC2130(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) && !PIN_EXISTS(ST##_CS))
|
||||
#if INVALID_TMC2130(X)
|
||||
#error "TMC2130 on X requires X_CS_PIN."
|
||||
#elif INVALID_TMC2130(X2)
|
||||
#error "TMC2130 on X2 requires X2_CS_PIN."
|
||||
#elif INVALID_TMC2130(Y)
|
||||
#error "TMC2130 on Y requires Y_CS_PIN."
|
||||
#elif INVALID_TMC2130(Y2)
|
||||
#error "TMC2130 on Y2 requires Y2_CS_PIN."
|
||||
#elif INVALID_TMC2130(Z)
|
||||
#error "TMC2130 on Z requires Z_CS_PIN."
|
||||
#elif INVALID_TMC2130(Z2)
|
||||
#error "TMC2130 on Z2 requires Z2_CS_PIN."
|
||||
#elif INVALID_TMC2130(Z3)
|
||||
#error "TMC2130 on Z3 requires Z3_CS_PIN."
|
||||
#elif INVALID_TMC2130(E0)
|
||||
#error "TMC2130 on E0 requires E0_CS_PIN."
|
||||
#elif INVALID_TMC2130(E1)
|
||||
#error "TMC2130 on E1 requires E1_CS_PIN."
|
||||
#elif INVALID_TMC2130(E2)
|
||||
#error "TMC2130 on E2 requires E2_CS_PIN."
|
||||
#elif INVALID_TMC2130(E3)
|
||||
#error "TMC2130 on E3 requires E3_CS_PIN."
|
||||
#elif INVALID_TMC2130(E4)
|
||||
#error "TMC2130 on E4 requires E4_CS_PIN."
|
||||
#elif INVALID_TMC2130(E5)
|
||||
#error "TMC2130 on E5 requires E5_CS_PIN."
|
||||
#define INVALID_TMC_SPI(ST) (AXIS_HAS_SPI && !PIN_EXISTS(ST##_CS))
|
||||
#if INVALID_TMC_SPI(X)
|
||||
#error "An SPI driven TMC driver on X requires X_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(X2)
|
||||
#error "An SPI driven TMC driver on X2 requires X2_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(Y)
|
||||
#error "An SPI driven TMC driver on Y requires Y_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(Y2)
|
||||
#error "An SPI driven TMC driver on Y2 requires Y2_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(Z)
|
||||
#error "An SPI driven TMC driver on Z requires Z_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(Z2)
|
||||
#error "An SPI driven TMC driver on Z2 requires Z2_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(Z3)
|
||||
#error "An SPI driven TMC driver on Z3 requires Z3_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(E0)
|
||||
#error "An SPI driven TMC driver on E0 requires E0_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(E1)
|
||||
#error "An SPI driven TMC driver on E1 requires E1_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(E2)
|
||||
#error "An SPI driven TMC driver on E2 requires E2_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(E3)
|
||||
#error "An SPI driven TMC driver on E3 requires E3_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(E4)
|
||||
#error "An SPI driven TMC driver on E4 requires E4_CS_PIN."
|
||||
#elif INVALID_TMC_SPI(E5)
|
||||
#error "An SPI driven TMC driver on E5 requires E5_CS_PIN."
|
||||
#endif
|
||||
#undef INVALID_TMC2130
|
||||
#undef INVALID_TMC_SPI
|
||||
|
||||
/**
|
||||
* Check existing RX/TX pins against enable TMC UART drivers.
|
||||
*/
|
||||
#define INVALID_TMC2208(ST) (AXIS_DRIVER_TYPE(ST, TMC2208) && !(defined(ST##_HARDWARE_SERIAL) || (PIN_EXISTS(ST##_SERIAL_RX, ST##_SERIAL_TX))))
|
||||
#if INVALID_TMC2208(X)
|
||||
#error "TMC2208 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(X2)
|
||||
#error "TMC2208 on X2 requires X2_HARDWARE_SERIAL or X2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(Y)
|
||||
#error "TMC2208 on Y requires Y_HARDWARE_SERIAL or Y_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(Y2)
|
||||
#error "TMC2208 on Y2 requires Y2_HARDWARE_SERIAL or Y2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(Z)
|
||||
#error "TMC2208 on Z requires Z_HARDWARE_SERIAL or Z_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(Z2)
|
||||
#error "TMC2208 on Z2 requires Z2_HARDWARE_SERIAL or Z2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(Z3)
|
||||
#error "TMC2208 on Z3 requires Z3_HARDWARE_SERIAL or Z3_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(E0)
|
||||
#error "TMC2208 on E0 requires E0_HARDWARE_SERIAL or E0_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(E1)
|
||||
#error "TMC2208 on E1 requires E1_HARDWARE_SERIAL or E1_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(E2)
|
||||
#error "TMC2208 on E2 requires E2_HARDWARE_SERIAL or E2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(E3)
|
||||
#error "TMC2208 on E3 requires E3_HARDWARE_SERIAL or E3_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(E4)
|
||||
#error "TMC2208 on E4 requires E4_HARDWARE_SERIAL or E4_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC2208(E5)
|
||||
#error "TMC2208 on E5 requires E5_HARDWARE_SERIAL or E5_SERIAL_(RX|TX)_PIN."
|
||||
#define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PIN_EXISTS(ST##_SERIAL_RX, ST##_SERIAL_TX))))
|
||||
#if INVALID_TMC_UART(X)
|
||||
#error "TMC2208 or TMC2209 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(X2)
|
||||
#error "TMC2208 or TMC2209 on X2 requires X2_HARDWARE_SERIAL or X2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(Y)
|
||||
#error "TMC2208 or TMC2209 on Y requires Y_HARDWARE_SERIAL or Y_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(Y2)
|
||||
#error "TMC2208 or TMC2209 on Y2 requires Y2_HARDWARE_SERIAL or Y2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(Z)
|
||||
#error "TMC2208 or TMC2209 on Z requires Z_HARDWARE_SERIAL or Z_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(Z2)
|
||||
#error "TMC2208 or TMC2209 on Z2 requires Z2_HARDWARE_SERIAL or Z2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(Z3)
|
||||
#error "TMC2208 or TMC2209 on Z3 requires Z3_HARDWARE_SERIAL or Z3_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(E0)
|
||||
#error "TMC2208 or TMC2209 on E0 requires E0_HARDWARE_SERIAL or E0_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(E1)
|
||||
#error "TMC2208 or TMC2209 on E1 requires E1_HARDWARE_SERIAL or E1_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(E2)
|
||||
#error "TMC2208 or TMC2209 on E2 requires E2_HARDWARE_SERIAL or E2_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(E3)
|
||||
#error "TMC2208 or TMC2209 on E3 requires E3_HARDWARE_SERIAL or E3_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(E4)
|
||||
#error "TMC2208 or TMC2209 on E4 requires E4_HARDWARE_SERIAL or E4_SERIAL_(RX|TX)_PIN."
|
||||
#elif INVALID_TMC_UART(E5)
|
||||
#error "TMC2208 or TMC2209 on E5 requires E5_HARDWARE_SERIAL or E5_SERIAL_(RX|TX)_PIN."
|
||||
#endif
|
||||
#undef INVALID_TMC2208
|
||||
#undef INVALID_TMC_UART
|
||||
|
||||
/**
|
||||
* TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
|
||||
* TMC2209 slave address values
|
||||
*/
|
||||
#if HAS_DRIVER(TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
|
||||
#define INVALID_TMC_ADDRESS(ST) static_assert(0 <= ST##_SLAVE_ADDRESS && ST##_SLAVE_ADDRESS <= 3, "TMC2209 slave address must be 0, 1, 2 or 3")
|
||||
#if AXIS_DRIVER_TYPE_X(TMC2209)
|
||||
INVALID_TMC_ADDRESS(X);
|
||||
#elif AXIS_DRIVER_TYPE_X2(TMC2209)
|
||||
INVALID_TMC_ADDRESS(X2);
|
||||
#elif AXIS_DRIVER_TYPE_Y(TMC2209)
|
||||
INVALID_TMC_ADDRESS(Y);
|
||||
#elif AXIS_DRIVER_TYPE_Y2(TMC2209)
|
||||
INVALID_TMC_ADDRESS(Y2);
|
||||
#elif AXIS_DRIVER_TYPE_Z(TMC2209)
|
||||
INVALID_TMC_ADDRESS(Z);
|
||||
#elif AXIS_DRIVER_TYPE_Z2(TMC2209)
|
||||
INVALID_TMC_ADDRESS(Z2);
|
||||
#elif AXIS_DRIVER_TYPE_Z3(TMC2209)
|
||||
INVALID_TMC_ADDRESS(Z3);
|
||||
#elif AXIS_DRIVER_TYPE_E0(TMC2209)
|
||||
INVALID_TMC_ADDRESS(E0);
|
||||
#elif AXIS_DRIVER_TYPE_E1(TMC2209)
|
||||
INVALID_TMC_ADDRESS(E1);
|
||||
#elif AXIS_DRIVER_TYPE_E2(TMC2209)
|
||||
INVALID_TMC_ADDRESS(E2);
|
||||
#elif AXIS_DRIVER_TYPE_E3(TMC2209)
|
||||
INVALID_TMC_ADDRESS(E3);
|
||||
#elif AXIS_DRIVER_TYPE_E4(TMC2209)
|
||||
INVALID_TMC_ADDRESS(E4);
|
||||
#elif AXIS_DRIVER_TYPE_E5(TMC2209)
|
||||
INVALID_TMC_ADDRESS(E5);
|
||||
#endif
|
||||
#undef INVALID_TMC_ADDRESS
|
||||
|
||||
/**
|
||||
* TMC2208/2209 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
|
||||
*/
|
||||
#if (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
|
||||
defined(X_HARDWARE_SERIAL ) \
|
||||
|| defined(X2_HARDWARE_SERIAL) \
|
||||
|| defined(Y_HARDWARE_SERIAL ) \
|
||||
@@ -1922,9 +2001,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TMC2208 software UART is only supported on AVR
|
||||
* TMC2208/2209 software UART is only supported on AVR and LPC
|
||||
*/
|
||||
#if HAS_DRIVER(TMC2208) && !defined(__AVR__) && !defined(TARGET_LPC1768) && !( \
|
||||
#if (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) && !defined(__AVR__) && !defined(TARGET_LPC1768) && !( \
|
||||
defined(X_HARDWARE_SERIAL ) \
|
||||
|| defined(X2_HARDWARE_SERIAL) \
|
||||
|| defined(Y_HARDWARE_SERIAL ) \
|
||||
@@ -1945,32 +2024,45 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
// is necessary in order to reset the stallGuard indication between the initial movement of all three
|
||||
// towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
|
||||
// clearing the stallGuard activated status is found.
|
||||
|
||||
// Stall detection DIAG = HIGH : TMC2209
|
||||
// Stall detection DIAG = LOW : TMC2130/TMC2160/TMC2660/TMC5130/TMC5160
|
||||
#define X_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(X,TMC2209)
|
||||
#define Y_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Y,TMC2209)
|
||||
#define Z_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Z,TMC2209)
|
||||
|
||||
#if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z)
|
||||
#error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z."
|
||||
#elif X_SENSORLESS && X_HOME_DIR == -1 && (!X_MIN_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN))
|
||||
#elif X_SENSORLESS && X_HOME_DIR == -1 && (X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN))
|
||||
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
|
||||
#elif X_SENSORLESS && X_HOME_DIR == 1 && (!X_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX))
|
||||
#elif X_SENSORLESS && X_HOME_DIR == 1 && (X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX))
|
||||
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
|
||||
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (!Y_MIN_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN))
|
||||
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN))
|
||||
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
|
||||
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (!Y_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX))
|
||||
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX))
|
||||
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
|
||||
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (!Z_MIN_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN))
|
||||
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN))
|
||||
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
|
||||
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (!Z_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX))
|
||||
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX))
|
||||
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
|
||||
#elif ENDSTOP_NOISE_THRESHOLD
|
||||
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD."
|
||||
#elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
|
||||
#error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
|
||||
#endif
|
||||
|
||||
#undef X_ENDSTOP_INVERTING
|
||||
#undef Y_ENDSTOP_INVERTING
|
||||
#undef Z_ENDSTOP_INVERTING
|
||||
#endif
|
||||
|
||||
// Sensorless homing/probing requirements
|
||||
#if ENABLED(SENSORLESS_HOMING) && !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
|
||||
#error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
|
||||
#elif BOTH(SENSORLESS_PROBING, DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
|
||||
#error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes."
|
||||
#elif ENABLED(SENSORLESS_PROBING) && !Z_SENSORLESS
|
||||
#error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z."
|
||||
// Sensorless probing requirements
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
#if ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
|
||||
#error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes."
|
||||
#elif !Z_SENSORLESS
|
||||
#error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Sensorless homing is required for both combined steppers in an H-bot
|
||||
@@ -1986,11 +2078,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#if ENABLED(HYBRID_THRESHOLD) && !STEALTHCHOP_ENABLED
|
||||
#error "Enable STEALTHCHOP_(XY|Z|E) to use HYBRID_THRESHOLD."
|
||||
#elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
|
||||
#error "SENSORLESS_HOMING requires TMC2130 or TMC2160 or TMC5160 stepper drivers."
|
||||
#error "SENSORLESS_HOMING requires TMC2130, TMC2160, TMC2209, TMC2660, or TMC5160 stepper drivers."
|
||||
#elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD
|
||||
#error "SENSORLESS_PROBING requires TMC2130 stepper drivers."
|
||||
#error "SENSORLESS_PROBING requires TMC2130, TMC2160, TMC2209, TMC2660, or TMC5160 stepper drivers."
|
||||
#elif STEALTHCHOP_ENABLED && !HAS_STEALTHCHOP
|
||||
#error "STEALTHCHOP requires TMC2130 or TMC2160 or TMC2208 or TMC5160 stepper drivers."
|
||||
#error "STEALTHCHOP requires TMC2130, TMC2160, TMC2208, TMC2209, or TMC5160 stepper drivers."
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA) && (ENABLED(STEALTHCHOP_XY) != ENABLED(STEALTHCHOP_Z))
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
#define SHORT_BUILD_VERSION "2.0.x_TR16"
|
||||
#define SHORT_BUILD_VERSION "2.0.x_TR17"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
@@ -52,7 +52,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2019-05-26"
|
||||
#define STRING_DISTRIBUTION_DATE "2019-06-23"
|
||||
|
||||
/**
|
||||
* Required minimum Configuration.h and Configuration_adv.h file versions.
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "ultralcd_HD44780.h"
|
||||
#include "../ultralcd.h"
|
||||
#include "../../libs/numtostr.h"
|
||||
|
||||
#include "../../sd/cardreader.h"
|
||||
#include "../../module/temperature.h"
|
||||
|
||||
@@ -90,7 +90,6 @@
|
||||
//https://github.com/mikeshub/SailfishLCD
|
||||
//uses the code directly from Sailfish
|
||||
|
||||
#include <LCD.h>
|
||||
#include <SailfishLCD.h>
|
||||
#define LCD_CLASS LiquidCrystalSerial
|
||||
|
||||
|
||||
@@ -28,19 +28,22 @@
|
||||
#ifdef __SAM3X8E__
|
||||
uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_DUE_sw_spi_fn
|
||||
|
||||
uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_DUE_shared_hw_spi_fn
|
||||
|
||||
uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn
|
||||
#else
|
||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn
|
||||
|
||||
#elif defined(__STM32F1__)
|
||||
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn
|
||||
uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
|
||||
uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||
#else
|
||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn // AVR ?
|
||||
uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||
#endif
|
||||
@@ -51,7 +54,7 @@
|
||||
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
|
||||
|
||||
#ifdef ARDUINO_ARCH_STM32F1
|
||||
#if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS)
|
||||
uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
|
||||
#else
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user