Bump to head
This commit is contained in:
+74
-41
@@ -27,22 +27,31 @@
|
||||
// If you have a trex 3 that was upgraded from a 2+ with the kit, modifies home position and offsets.
|
||||
//#define TREX3_UPGRADE
|
||||
|
||||
//Stock 2+ X is a 4988, all options off defaults to this
|
||||
//#define X_2208
|
||||
//#define X_Spreadcycle
|
||||
//#define X_S109
|
||||
|
||||
// Y all options off defaults to 2+ 8825 / 3 2208
|
||||
//#define Y_2208 // Highly recommended as large prints with high mass can cause layer shifts with stealthchop at high speed
|
||||
//#define Y_Spreadcycle
|
||||
//#define Y_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical
|
||||
//#define Y_S109
|
||||
|
||||
//Stock 2+ Z is a 8825, all options off defaults to this
|
||||
//#define Z_2208 // NOT Recommended! Dual stepper current draw is above the recommended limit for this driver
|
||||
//#define Z_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical
|
||||
//#define Y_Spreadcycle
|
||||
//#define Z_Spreadcycle
|
||||
//#define Z_S109
|
||||
|
||||
//Stock 2+ Z is a 4988, all options off defaults to this
|
||||
//#define E_2208 // Not Recommended! Stealthchop mode faults with linear advance
|
||||
//#define E_Spreadcycle
|
||||
//#define E_S109
|
||||
|
||||
#define BedAC
|
||||
|
||||
//#define tallVersion
|
||||
#define tallVersion
|
||||
|
||||
/*
|
||||
* Enables a filament sensor plugged into the laser pin. Disables the laser
|
||||
@@ -310,13 +319,27 @@
|
||||
* the E3D Tool Changer. Toolheads are locked with a servo.
|
||||
*/
|
||||
//#define SWITCHING_TOOLHEAD
|
||||
#if ENABLED(SWITCHING_TOOLHEAD)
|
||||
#define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector
|
||||
#define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock
|
||||
#define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock
|
||||
#define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis
|
||||
#define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis
|
||||
#define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders
|
||||
|
||||
/**
|
||||
* Magnetic Switching Toolhead
|
||||
*
|
||||
* Support swappable and dockable toolheads with a magnetic
|
||||
* docking mechanism using movement and no servo.
|
||||
*/
|
||||
//#define MAGNETIC_SWITCHING_TOOLHEAD
|
||||
|
||||
#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD)
|
||||
#define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock
|
||||
#define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis
|
||||
#define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis
|
||||
#define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders
|
||||
#if ENABLED(SWITCHING_TOOLHEAD)
|
||||
#define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector
|
||||
#define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock
|
||||
#elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
|
||||
#define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis
|
||||
#define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -373,6 +396,7 @@
|
||||
#define AUTO_POWER_FANS // Turn on PSU if fans need power
|
||||
#define AUTO_POWER_E_FANS
|
||||
#define AUTO_POWER_CONTROLLERFAN
|
||||
#define AUTO_POWER_CHAMBER_FAN
|
||||
#define POWER_TIMEOUT 30
|
||||
#endif
|
||||
|
||||
@@ -429,11 +453,13 @@
|
||||
* 147 : Pt100 with 4k7 pullup
|
||||
* 110 : Pt100 with 1k pullup (non standard)
|
||||
*
|
||||
* 1000 : Custom - Specify parameters in Configuration_adv.h
|
||||
*
|
||||
* Use these for Testing or Development purposes. NEVER for production machine.
|
||||
* 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" }
|
||||
* :{ '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" }
|
||||
*/
|
||||
#if ENABLED(TREX3)
|
||||
#define TEMP_SENSOR_0 61
|
||||
@@ -453,7 +479,6 @@
|
||||
#define TEMP_SENSOR_BED 0
|
||||
#endif
|
||||
#define TEMP_SENSOR_CHAMBER 0
|
||||
#define HEATER_CHAMBER_PIN -1 // On/off pin for enclosure heating system
|
||||
|
||||
// Dummy thermistor constant temperature readings, for use with 998 and 999
|
||||
#define DUMMY_THERMISTOR_998_VALUE 25
|
||||
@@ -472,8 +497,6 @@
|
||||
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
||||
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
||||
|
||||
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
||||
|
||||
// Below this temperature the heater will be switched off
|
||||
// because it probably indicates a broken thermistor wire.
|
||||
#define HEATER_0_MINTEMP 5
|
||||
@@ -483,7 +506,6 @@
|
||||
#define HEATER_4_MINTEMP 5
|
||||
#define HEATER_5_MINTEMP 5
|
||||
#define BED_MINTEMP 5
|
||||
#define CHAMBER_MINTEMP 5
|
||||
|
||||
// Above this temperature the heater will be switched off.
|
||||
// This can protect components from overheating, but NOT from shorts and failures.
|
||||
@@ -500,7 +522,6 @@
|
||||
#define HEATER_4_MAXTEMP 275
|
||||
#define HEATER_5_MAXTEMP 275
|
||||
#define BED_MAXTEMP 150
|
||||
#define CHAMBER_MAXTEMP 100
|
||||
|
||||
//===========================================================================
|
||||
//============================= PID Settings ================================
|
||||
@@ -548,7 +569,7 @@
|
||||
#endif // PIDTEMP
|
||||
|
||||
//===========================================================================
|
||||
//============================= PID > Bed Temperature Control ===============
|
||||
//====================== PID > Bed Temperature Control ======================
|
||||
//===========================================================================
|
||||
|
||||
/**
|
||||
@@ -943,18 +964,14 @@
|
||||
*/
|
||||
#define BLTOUCH
|
||||
#if ENABLED(BLTOUCH)
|
||||
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
|
||||
//#define BLTOUCH_DELAY 500 // Minimum Command delay (ms). Enable and increase if needed
|
||||
|
||||
/**
|
||||
* BLTouch V3.0 and newer smart series
|
||||
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
|
||||
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
|
||||
*/
|
||||
#define BLTOUCH_V3
|
||||
#if ENABLED(BLTOUCH_V3)
|
||||
#define BLTOUCH_FORCE_5V_MODE
|
||||
//#define BLTOUCH_FORCE_OPEN_DRAIN_MODE
|
||||
#endif
|
||||
//#define BLTOUCH_FORCE_5V_MODE
|
||||
#endif
|
||||
|
||||
// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN)
|
||||
@@ -1051,6 +1068,9 @@
|
||||
|
||||
// Before deploy/stow pause for user confirmation
|
||||
//#define PAUSE_BEFORE_DEPLOY_STOW
|
||||
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
||||
//#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Enable one or more of the following if probing seems unreliable.
|
||||
@@ -1127,7 +1147,7 @@
|
||||
|
||||
//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off.
|
||||
|
||||
#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
|
||||
#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
|
||||
// Be sure you have this distance over your Z_MAX_POS in case.
|
||||
|
||||
// Direction of endstops when homing; 1=MAX, -1=MIN
|
||||
@@ -1146,7 +1166,7 @@
|
||||
#if DISABLED(TREX3) || ENABLED(TREX3_UPGRADE)
|
||||
#define X_MIN_POS -42
|
||||
#define Y_MIN_POS 0
|
||||
#define Z_MIN_POS 3
|
||||
#define Z_MIN_POS -3
|
||||
#define X_MAX_POS 450
|
||||
#define Y_MAX_POS Y_BED_SIZE
|
||||
#else
|
||||
@@ -1187,7 +1207,7 @@
|
||||
#define MAX_SOFTWARE_ENDSTOP_Z
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)
|
||||
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
|
||||
#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD
|
||||
#endif
|
||||
|
||||
@@ -1520,17 +1540,21 @@
|
||||
|
||||
// @section extras
|
||||
|
||||
//
|
||||
// EEPROM
|
||||
//
|
||||
// The microcontroller can store settings in the EEPROM, e.g. max velocity...
|
||||
// M500 - stores parameters in EEPROM
|
||||
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
||||
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
||||
//
|
||||
#define EEPROM_SETTINGS // Enable for M500 and M501 commands
|
||||
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
|
||||
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
|
||||
/**
|
||||
* EEPROM
|
||||
*
|
||||
* Persistent storage to preserve configurable settings across reboots.
|
||||
*
|
||||
* M500 - Store settings to EEPROM.
|
||||
* M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes)
|
||||
* M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
|
||||
*/
|
||||
#define EEPROM_SETTINGS // Persistent storage with M500 and M501
|
||||
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
|
||||
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
|
||||
#endif
|
||||
|
||||
//
|
||||
// Host Keepalive
|
||||
@@ -2064,6 +2088,14 @@
|
||||
//
|
||||
//#define MKS_MINI_12864
|
||||
|
||||
//
|
||||
// FYSETC variant of the MINI12864 graphic controller with SD support
|
||||
// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8
|
||||
//
|
||||
//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on)
|
||||
//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight
|
||||
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight
|
||||
|
||||
//
|
||||
// Factory display for Creality CR-10
|
||||
// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html
|
||||
@@ -2167,6 +2199,7 @@
|
||||
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
|
||||
// However, control resolution will be halved for each increment;
|
||||
// at zero value, there are 128 effective control positions.
|
||||
// :[0,1,2,3,4,5,6,7]
|
||||
#define SOFT_PWM_SCALE 0
|
||||
|
||||
// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can
|
||||
@@ -2222,17 +2255,17 @@
|
||||
//#define RGBW_LED
|
||||
|
||||
#if EITHER(RGB_LED, RGBW_LED)
|
||||
#define RGB_LED_R_PIN 34
|
||||
#define RGB_LED_G_PIN 43
|
||||
#define RGB_LED_B_PIN 35
|
||||
#define RGB_LED_W_PIN -1
|
||||
//#define RGB_LED_R_PIN 34
|
||||
//#define RGB_LED_G_PIN 43
|
||||
//#define RGB_LED_B_PIN 35
|
||||
//#define RGB_LED_W_PIN -1
|
||||
#endif
|
||||
|
||||
// Support for Adafruit Neopixel LED driver
|
||||
//#define NEOPIXEL_LED
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
#define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
|
||||
#define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba)
|
||||
#define NEOPIXEL_PIN 4 // LED driving pin
|
||||
#define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip
|
||||
#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)
|
||||
|
||||
+111
-18
@@ -39,6 +39,57 @@
|
||||
//=============================Thermal Settings ============================
|
||||
//===========================================================================
|
||||
|
||||
//
|
||||
// Custom Thermistor 1000 parameters
|
||||
//
|
||||
#if TEMP_SENSOR_0 == 1000
|
||||
#define HOTEND0_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND0_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND0_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_1 == 1000
|
||||
#define HOTEND1_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND1_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND1_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_2 == 1000
|
||||
#define HOTEND2_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND2_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND2_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_3 == 1000
|
||||
#define HOTEND3_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND3_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND3_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_4 == 1000
|
||||
#define HOTEND4_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND4_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND4_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_5 == 1000
|
||||
#define HOTEND5_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND5_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND5_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BED == 1000
|
||||
#define BED_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define BED_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define BED_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_CHAMBER == 1000
|
||||
#define CHAMBER_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define CHAMBER_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define CHAMBER_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
//
|
||||
// Hephestos 2 24V heated bed upgrade kit.
|
||||
// https://store.bq.com/en/heated-bed-kit-hephestos2
|
||||
@@ -50,6 +101,18 @@
|
||||
#define HEATER_BED_INVERTING true
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Heated Chamber settings
|
||||
*/
|
||||
#if TEMP_SENSOR_CHAMBER
|
||||
#define CHAMBER_MINTEMP 5
|
||||
#define CHAMBER_MAXTEMP 60
|
||||
#define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target
|
||||
//#define CHAMBER_LIMIT_SWITCHING
|
||||
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
|
||||
//#define HEATER_CHAMBER_INVERTING false
|
||||
#endif
|
||||
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
|
||||
#if ENABLED(BED_LIMIT_SWITCHING)
|
||||
@@ -127,8 +190,8 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
// this adds an experimental additional term to the heating power, proportional to the extrusion speed.
|
||||
// if Kc is chosen well, the additional required power due to increased melting should be compensated.
|
||||
// Add an experimental additional term to the heater power, proportional to the extrusion speed.
|
||||
// A well-chosen Kc value should add just enough power to melt the increased material volume.
|
||||
//#define PID_EXTRUSION_SCALING
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
|
||||
@@ -314,9 +377,7 @@
|
||||
*/
|
||||
#define CASE_LIGHT_ENABLE
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#if DISABLED(TREX3)
|
||||
#define CASE_LIGHT_PIN 8
|
||||
#endif
|
||||
//#define CASE_LIGHT_PIN 4 // Override the default pin if needed
|
||||
#define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW
|
||||
#define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on
|
||||
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin)
|
||||
@@ -468,6 +529,7 @@
|
||||
#define Z_HOME_BUMP_MM 2
|
||||
#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
|
||||
#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially
|
||||
//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing
|
||||
|
||||
// When G28 is called, this option will make Y home before X
|
||||
//#define HOME_Y_BEFORE_X
|
||||
@@ -785,8 +847,11 @@
|
||||
// Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended.
|
||||
#define SDCARD_RATHERRECENTFIRST
|
||||
|
||||
// Add an option in the menu to run all auto#.g files
|
||||
//#define MENU_ADDAUTOSTART
|
||||
#define SD_MENU_CONFIRM_START // Confirm the selected SD file before printing
|
||||
|
||||
//#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")
|
||||
|
||||
/**
|
||||
* Continue after Power-Loss (Creality3D)
|
||||
@@ -798,8 +863,14 @@
|
||||
*/
|
||||
//#define POWER_LOSS_RECOVERY
|
||||
#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_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.
|
||||
|
||||
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
|
||||
// especially with "vase mode" printing. Set too high and vases cannot be continued.
|
||||
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -902,6 +973,17 @@
|
||||
// Add an optimized binary file transfer mode, initiated with 'M28 B1'
|
||||
//#define BINARY_FILE_TRANSFER
|
||||
|
||||
// LPC-based boards have on-board SD Card options. Override here or defaults apply.
|
||||
#ifdef TARGET_LPC1768
|
||||
//#define LPC_SD_LCD // Use the SD drive in the external LCD controller.
|
||||
//#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.)
|
||||
//#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file).
|
||||
//#define USB_SD_DISABLED // Disable SD Card access over USB (for security).
|
||||
#if ENABLED(LPC_SD_ONBOARD)
|
||||
//#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
/**
|
||||
@@ -974,19 +1056,28 @@
|
||||
//#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
|
||||
//#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
|
||||
//#define STATUS_HEAT_PERCENT // Show heating in a progress bar
|
||||
#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash)
|
||||
|
||||
// Frivolous Game Options
|
||||
//#define MARLIN_BRICKOUT
|
||||
//#define MARLIN_INVADERS
|
||||
//#define MARLIN_SNAKE
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
// @section safety
|
||||
|
||||
// The hardware watchdog should reset the microcontroller disabling all outputs,
|
||||
// in case the firmware gets stuck and doesn't do temperature regulation.
|
||||
/**
|
||||
* The watchdog hardware timer will do a reset and disable all outputs
|
||||
* if the firmware gets too overloaded to read the temperature sensors.
|
||||
*
|
||||
* If you find that watchdog reboot causes your AVR board to hang forever,
|
||||
* enable WATCHDOG_RESET_MANUAL to use a custom timer instead of WDTO.
|
||||
* NOTE: This method is less reliable as it can only catch hangups while
|
||||
* interrupts are enabled.
|
||||
*/
|
||||
#define USE_WATCHDOG
|
||||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
|
||||
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
|
||||
// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
|
||||
//#define WATCHDOG_RESET_MANUAL
|
||||
#endif
|
||||
|
||||
@@ -1017,6 +1108,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28
|
||||
|
||||
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
|
||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
|
||||
@@ -1355,7 +1448,8 @@
|
||||
// Set to 0 for manual extrusion.
|
||||
// Filament can be extruded repeatedly from the Filament Change menu
|
||||
// until extrusion is consistent, and to purge old filament.
|
||||
#define ADVANCED_PAUSE_RESUME_PRIME 1 // (mm) Extra distance to prime nozzle after returning from park.
|
||||
#define ADVANCED_PAUSE_RESUME_PRIME 2 // (mm) Extra distance to prime nozzle after returning from park.
|
||||
#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
|
||||
|
||||
// Filament Unload does a Retract, Delay, and Purge first:
|
||||
#define FILAMENT_UNLOAD_RETRACT_LENGTH 4 // (mm) Unload initial retract length.
|
||||
@@ -1705,8 +1799,7 @@
|
||||
/**
|
||||
* You can set your own advanced settings by filling in predefined functions.
|
||||
* A list of available functions can be found on the library github page
|
||||
* https://github.com/teemuatlut/TMC2130Stepper
|
||||
* https://github.com/teemuatlut/TMC2208Stepper
|
||||
* https://github.com/teemuatlut/TMCStepper
|
||||
*
|
||||
* Example:
|
||||
* #define TMC_ADV() { \
|
||||
|
||||
@@ -24,14 +24,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <util/delay.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio_AVR.h"
|
||||
#include "watchdog_AVR.h"
|
||||
@@ -43,6 +36,12 @@
|
||||
#include "MarlinSerial.h"
|
||||
#endif
|
||||
|
||||
#include <util/delay.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Defines
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,7 @@ void spiBegin (void) {
|
||||
}
|
||||
|
||||
|
||||
#if DISABLED(SOFTWARE_SPI)
|
||||
#if DISABLED(SOFTWARE_SPI, FORCE_SOFT_SPI)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Hardware SPI
|
||||
@@ -264,6 +264,6 @@ void spiBegin (void) {
|
||||
spiSend(buf[i]);
|
||||
}
|
||||
|
||||
#endif // SOFTWARE_SPI
|
||||
#endif // SOFTWARE_SPI, FORCE_SOFT_SPI
|
||||
|
||||
#endif // __AVR__
|
||||
|
||||
@@ -54,7 +54,7 @@ void endstop_ISR(void) { endstops.update(); }
|
||||
#undef digitalPinToPCICR
|
||||
#define digitalPinToPCICR(p) ( WITHIN(p, 10, 15) || \
|
||||
WITHIN(p, 50, 53) || \
|
||||
WITHIN(p, 62, 69) ? &PCICR : (uint8_t*)0 )
|
||||
WITHIN(p, 62, 69) ? &PCICR : nullptr )
|
||||
#undef digitalPinToPCICRbit
|
||||
#define digitalPinToPCICRbit(p) ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? 0 : \
|
||||
WITHIN(p, 14, 15) ? 1 : \
|
||||
@@ -64,7 +64,7 @@ void endstop_ISR(void) { endstops.update(); }
|
||||
#define digitalPinToPCMSK(p) ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? &PCMSK0 : \
|
||||
WITHIN(p, 14, 15) ? &PCMSK1 : \
|
||||
WITHIN(p, 62, 69) ? &PCMSK2 : \
|
||||
(uint8_t *)0 )
|
||||
nullptr )
|
||||
#undef digitalPinToPCMSKbit
|
||||
#define digitalPinToPCMSKbit(p) ( WITHIN(p, 10, 13) ? ((p) - 6) : \
|
||||
(p) == 14 || (p) == 51 ? 2 : \
|
||||
@@ -78,9 +78,11 @@ void endstop_ISR(void) { endstops.update(); }
|
||||
|
||||
// Install Pin change interrupt for a pin. Can be called multiple times.
|
||||
void pciSetup(const int8_t pin) {
|
||||
SBI(*digitalPinToPCMSK(pin), digitalPinToPCMSKbit(pin)); // enable pin
|
||||
SBI(PCIFR, digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
|
||||
SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group
|
||||
if (digitalPinToPCMSK(pin) != nullptr) {
|
||||
SBI(*digitalPinToPCMSK(pin), digitalPinToPCMSKbit(pin)); // enable pin
|
||||
SBI(PCIFR, digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
|
||||
SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group
|
||||
}
|
||||
}
|
||||
|
||||
// Handlers for pin change interrupts
|
||||
@@ -107,7 +109,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(X_MAX_PIN), endstop_ISR, CHANGE); // assign it
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(X_MAX_PIN) != NULL, "X_MAX_PIN is not interrupt-capable"); // if pin has no pin change interrupt - error
|
||||
static_assert(digitalPinToPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable"); // if pin has no pin change interrupt - error
|
||||
pciSetup(X_MAX_PIN); // assign it
|
||||
#endif
|
||||
#endif
|
||||
@@ -117,7 +119,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(X_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(X_MIN_PIN) != NULL, "X_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(X_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -127,7 +129,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Y_MAX_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Y_MAX_PIN) != NULL, "Y_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Y_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -137,7 +139,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Y_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Y_MIN_PIN) != NULL, "Y_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Y_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -147,7 +149,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z_MAX_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z_MAX_PIN) != NULL, "Z_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -157,7 +159,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z_MIN_PIN) != NULL, "Z_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -167,7 +169,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(X2_MAX_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(X2_MAX_PIN) != NULL, "X2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(X2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -177,7 +179,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(X2_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(X2_MIN_PIN) != NULL, "X2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(X2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -187,7 +189,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Y2_MAX_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Y2_MAX_PIN) != NULL, "Y2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Y2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -197,7 +199,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Y2_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Y2_MIN_PIN) != NULL, "Y2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Y2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -207,7 +209,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z2_MAX_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z2_MAX_PIN) != NULL, "Z2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -217,7 +219,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z2_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z2_MIN_PIN) != NULL, "Z2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -227,7 +229,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z3_MAX_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z3_MAX_PIN) != NULL, "Z3_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z3_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -237,7 +239,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z3_MIN_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z3_MIN_PIN) != NULL, "Z3_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z3_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -247,7 +249,7 @@ void setup_endstop_interrupts( void ) {
|
||||
attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE);
|
||||
#else
|
||||
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
||||
static_assert(digitalPinToPCICR(Z_MIN_PROBE_PIN) != NULL, "Z_MIN_PROBE_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable");
|
||||
pciSetup(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
#ifdef TCCR2
|
||||
case TIMER2: {
|
||||
Timer timer = {
|
||||
/*TCCRnQ*/ { &TCCR2, NULL, NULL},
|
||||
/*OCRnQ*/ { (uint16_t*)&OCR2, NULL, NULL},
|
||||
/*ICRn*/ NULL,
|
||||
/*TCCRnQ*/ { &TCCR2, nullptr, nullptr},
|
||||
/*OCRnQ*/ { (uint16_t*)&OCR2, nullptr, nullptr},
|
||||
/*ICRn*/ nullptr,
|
||||
/*n, q*/ 2, 0
|
||||
};
|
||||
}
|
||||
@@ -49,9 +49,9 @@
|
||||
case TIMER2A: break; // protect TIMER2A
|
||||
case TIMER2B: {
|
||||
Timer timer = {
|
||||
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
|
||||
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
|
||||
/*ICRn*/ NULL,
|
||||
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, nullptr},
|
||||
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, nullptr},
|
||||
/*ICRn*/ nullptr,
|
||||
/*n, q*/ 2, 1
|
||||
};
|
||||
return timer;
|
||||
@@ -60,9 +60,9 @@
|
||||
case TIMER2B: ++q;
|
||||
case TIMER2A: {
|
||||
Timer timer = {
|
||||
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
|
||||
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
|
||||
/*ICRn*/ NULL,
|
||||
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, nullptr},
|
||||
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, nullptr},
|
||||
/*ICRn*/ nullptr,
|
||||
2, q
|
||||
};
|
||||
return timer;
|
||||
@@ -111,9 +111,9 @@
|
||||
#endif
|
||||
}
|
||||
Timer timer = {
|
||||
/*TCCRnQ*/ { NULL, NULL, NULL},
|
||||
/*OCRnQ*/ { NULL, NULL, NULL},
|
||||
/*ICRn*/ NULL,
|
||||
/*TCCRnQ*/ { nullptr, nullptr, nullptr},
|
||||
/*OCRnQ*/ { nullptr, nullptr, nullptr},
|
||||
/*ICRn*/ nullptr,
|
||||
0, 0
|
||||
};
|
||||
return timer;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,13 +63,13 @@
|
||||
#define DIO0_RPORT PINE
|
||||
#define DIO0_WPORT PORTE
|
||||
#define DIO0_DDR DDRE
|
||||
#define DIO0_PWM NULL
|
||||
#define DIO0_PWM nullptr
|
||||
|
||||
#define DIO1_PIN PINE1
|
||||
#define DIO1_RPORT PINE
|
||||
#define DIO1_WPORT PORTE
|
||||
#define DIO1_DDR DDRE
|
||||
#define DIO1_PWM NULL
|
||||
#define DIO1_PWM nullptr
|
||||
|
||||
#define DIO2_PIN PINE4
|
||||
#define DIO2_RPORT PINE
|
||||
@@ -123,339 +123,339 @@
|
||||
#define DIO10_RPORT PINB
|
||||
#define DIO10_WPORT PORTB
|
||||
#define DIO10_DDR DDRB
|
||||
#define DIO10_PWM NULL
|
||||
#define DIO10_PWM nullptr
|
||||
|
||||
#define DIO11_PIN PINB2
|
||||
#define DIO11_RPORT PINB
|
||||
#define DIO11_WPORT PORTB
|
||||
#define DIO11_DDR DDRB
|
||||
#define DIO11_PWM NULL
|
||||
#define DIO11_PWM nullptr
|
||||
|
||||
#define DIO12_PIN PINB3
|
||||
#define DIO12_RPORT PINB
|
||||
#define DIO12_WPORT PORTB
|
||||
#define DIO12_DDR DDRB
|
||||
#define DIO12_PWM NULL
|
||||
#define DIO12_PWM nullptr
|
||||
|
||||
#define DIO13_PIN PINE2
|
||||
#define DIO13_RPORT PINE
|
||||
#define DIO13_WPORT PORTE
|
||||
#define DIO13_DDR DDRE
|
||||
#define DIO13_PWM NULL
|
||||
#define DIO13_PWM nullptr
|
||||
|
||||
#define DIO14_PIN PINE6
|
||||
#define DIO14_RPORT PINE
|
||||
#define DIO14_WPORT PORTE
|
||||
#define DIO14_DDR DDRE
|
||||
#define DIO14_PWM NULL
|
||||
#define DIO14_PWM nullptr
|
||||
|
||||
#define DIO15_PIN PINE7
|
||||
#define DIO15_RPORT PINE
|
||||
#define DIO15_WPORT PORTE
|
||||
#define DIO15_DDR DDRE
|
||||
#define DIO15_PWM NULL
|
||||
#define DIO15_PWM nullptr
|
||||
|
||||
#define DIO16_PIN PINB0
|
||||
#define DIO16_RPORT PINB
|
||||
#define DIO16_WPORT PORTB
|
||||
#define DIO16_DDR DDRB
|
||||
#define DIO16_PWM NULL
|
||||
#define DIO16_PWM nullptr
|
||||
|
||||
#define DIO17_PIN PIND0
|
||||
#define DIO17_RPORT PIND
|
||||
#define DIO17_WPORT PORTD
|
||||
#define DIO17_DDR DDRD
|
||||
#define DIO17_PWM NULL
|
||||
#define DIO17_PWM nullptr
|
||||
|
||||
#define DIO18_PIN PIND1
|
||||
#define DIO18_RPORT PIND
|
||||
#define DIO18_WPORT PORTD
|
||||
#define DIO18_DDR DDRD
|
||||
#define DIO18_PWM NULL
|
||||
#define DIO18_PWM nullptr
|
||||
|
||||
#define DIO19_PIN PIND2
|
||||
#define DIO19_RPORT PIND
|
||||
#define DIO19_WPORT PORTD
|
||||
#define DIO19_DDR DDRD
|
||||
#define DIO19_PWM NULL
|
||||
#define DIO19_PWM nullptr
|
||||
|
||||
#define DIO20_PIN PIND3
|
||||
#define DIO20_RPORT PIND
|
||||
#define DIO20_WPORT PORTD
|
||||
#define DIO20_DDR DDRD
|
||||
#define DIO20_PWM NULL
|
||||
#define DIO20_PWM nullptr
|
||||
|
||||
#define DIO21_PIN PIND4
|
||||
#define DIO21_RPORT PIND
|
||||
#define DIO21_WPORT PORTD
|
||||
#define DIO21_DDR DDRD
|
||||
#define DIO21_PWM NULL
|
||||
#define DIO21_PWM nullptr
|
||||
|
||||
#define DIO22_PIN PIND5
|
||||
#define DIO22_RPORT PIND
|
||||
#define DIO22_WPORT PORTD
|
||||
#define DIO22_DDR DDRD
|
||||
#define DIO22_PWM NULL
|
||||
#define DIO22_PWM nullptr
|
||||
|
||||
#define DIO23_PIN PIND6
|
||||
#define DIO23_RPORT PIND
|
||||
#define DIO23_WPORT PORTD
|
||||
#define DIO23_DDR DDRD
|
||||
#define DIO23_PWM NULL
|
||||
#define DIO23_PWM nullptr
|
||||
|
||||
#define DIO24_PIN PIND7
|
||||
#define DIO24_RPORT PIND
|
||||
#define DIO24_WPORT PORTD
|
||||
#define DIO24_DDR DDRD
|
||||
#define DIO24_PWM NULL
|
||||
#define DIO24_PWM nullptr
|
||||
|
||||
#define DIO25_PIN PING0
|
||||
#define DIO25_RPORT PING
|
||||
#define DIO25_WPORT PORTG
|
||||
#define DIO25_DDR DDRG
|
||||
#define DIO25_PWM NULL
|
||||
#define DIO25_PWM nullptr
|
||||
|
||||
#define DIO26_PIN PING1
|
||||
#define DIO26_RPORT PING
|
||||
#define DIO26_WPORT PORTG
|
||||
#define DIO26_DDR DDRG
|
||||
#define DIO26_PWM NULL
|
||||
#define DIO26_PWM nullptr
|
||||
|
||||
#define DIO27_PIN PING2
|
||||
#define DIO27_RPORT PING
|
||||
#define DIO27_WPORT PORTG
|
||||
#define DIO27_DDR DDRG
|
||||
#define DIO27_PWM NULL
|
||||
#define DIO27_PWM nullptr
|
||||
|
||||
#define DIO28_PIN PING3
|
||||
#define DIO28_RPORT PING
|
||||
#define DIO28_WPORT PORTG
|
||||
#define DIO28_DDR DDRG
|
||||
#define DIO28_PWM NULL
|
||||
#define DIO28_PWM nullptr
|
||||
|
||||
#define DIO29_PIN PING4
|
||||
#define DIO29_RPORT PING
|
||||
#define DIO29_WPORT PORTG
|
||||
#define DIO29_DDR DDRG
|
||||
#define DIO29_PWM NULL
|
||||
#define DIO29_PWM nullptr
|
||||
|
||||
#define DIO30_PIN PINC0
|
||||
#define DIO30_RPORT PINC
|
||||
#define DIO30_WPORT PORTC
|
||||
#define DIO30_DDR DDRC
|
||||
#define DIO30_PWM NULL
|
||||
#define DIO30_PWM nullptr
|
||||
|
||||
#define DIO31_PIN PINC1
|
||||
#define DIO31_RPORT PINC
|
||||
#define DIO31_WPORT PORTC
|
||||
#define DIO31_DDR DDRC
|
||||
#define DIO31_PWM NULL
|
||||
#define DIO31_PWM nullptr
|
||||
|
||||
#define DIO32_PIN PINC2
|
||||
#define DIO32_RPORT PINC
|
||||
#define DIO32_WPORT PORTC
|
||||
#define DIO32_DDR DDRC
|
||||
#define DIO32_PWM NULL
|
||||
#define DIO32_PWM nullptr
|
||||
|
||||
#define DIO33_PIN PINC3
|
||||
#define DIO33_RPORT PINC
|
||||
#define DIO33_WPORT PORTC
|
||||
#define DIO33_DDR DDRC
|
||||
#define DIO33_PWM NULL
|
||||
#define DIO33_PWM nullptr
|
||||
|
||||
#define DIO34_PIN PINC4
|
||||
#define DIO34_RPORT PINC
|
||||
#define DIO34_WPORT PORTC
|
||||
#define DIO34_DDR DDRC
|
||||
#define DIO34_PWM NULL
|
||||
#define DIO34_PWM nullptr
|
||||
|
||||
#define DIO35_PIN PINC5
|
||||
#define DIO35_RPORT PINC
|
||||
#define DIO35_WPORT PORTC
|
||||
#define DIO35_DDR DDRC
|
||||
#define DIO35_PWM NULL
|
||||
#define DIO35_PWM nullptr
|
||||
|
||||
#define DIO36_PIN PINC6
|
||||
#define DIO36_RPORT PINC
|
||||
#define DIO36_WPORT PORTC
|
||||
#define DIO36_DDR DDRC
|
||||
#define DIO36_PWM NULL
|
||||
#define DIO36_PWM nullptr
|
||||
|
||||
#define DIO37_PIN PINC7
|
||||
#define DIO37_RPORT PINC
|
||||
#define DIO37_WPORT PORTC
|
||||
#define DIO37_DDR DDRC
|
||||
#define DIO37_PWM NULL
|
||||
#define DIO37_PWM nullptr
|
||||
|
||||
#define DIO38_PIN PINA0
|
||||
#define DIO38_RPORT PINA
|
||||
#define DIO38_WPORT PORTA
|
||||
#define DIO38_DDR DDRA
|
||||
#define DIO38_PWM NULL
|
||||
#define DIO38_PWM nullptr
|
||||
|
||||
#define DIO39_PIN PINA1
|
||||
#define DIO39_RPORT PINA
|
||||
#define DIO39_WPORT PORTA
|
||||
#define DIO39_DDR DDRA
|
||||
#define DIO39_PWM NULL
|
||||
#define DIO39_PWM nullptr
|
||||
|
||||
#define DIO40_PIN PINA2
|
||||
#define DIO40_RPORT PINA
|
||||
#define DIO40_WPORT PORTA
|
||||
#define DIO40_DDR DDRA
|
||||
#define DIO40_PWM NULL
|
||||
#define DIO40_PWM nullptr
|
||||
|
||||
#define DIO41_PIN PINA3
|
||||
#define DIO41_RPORT PINA
|
||||
#define DIO41_WPORT PORTA
|
||||
#define DIO41_DDR DDRA
|
||||
#define DIO41_PWM NULL
|
||||
#define DIO41_PWM nullptr
|
||||
|
||||
#define DIO42_PIN PINA4
|
||||
#define DIO42_RPORT PINA
|
||||
#define DIO42_WPORT PORTA
|
||||
#define DIO42_DDR DDRA
|
||||
#define DIO42_PWM NULL
|
||||
#define DIO42_PWM nullptr
|
||||
|
||||
#define DIO43_PIN PINA5
|
||||
#define DIO43_RPORT PINA
|
||||
#define DIO43_WPORT PORTA
|
||||
#define DIO43_DDR DDRA
|
||||
#define DIO43_PWM NULL
|
||||
#define DIO43_PWM nullptr
|
||||
|
||||
#define DIO44_PIN PINA6
|
||||
#define DIO44_RPORT PINA
|
||||
#define DIO44_WPORT PORTA
|
||||
#define DIO44_DDR DDRA
|
||||
#define DIO44_PWM NULL
|
||||
#define DIO44_PWM nullptr
|
||||
|
||||
#define DIO45_PIN PINA7
|
||||
#define DIO45_RPORT PINA
|
||||
#define DIO45_WPORT PORTA
|
||||
#define DIO45_DDR DDRA
|
||||
#define DIO45_PWM NULL
|
||||
#define DIO45_PWM nullptr
|
||||
|
||||
#define DIO46_PIN PINF0
|
||||
#define DIO46_RPORT PINF
|
||||
#define DIO46_WPORT PORTF
|
||||
#define DIO46_DDR DDRF
|
||||
#define DIO46_PWM NULL
|
||||
#define DIO46_PWM nullptr
|
||||
|
||||
#define DIO47_PIN PINF1
|
||||
#define DIO47_RPORT PINF
|
||||
#define DIO47_WPORT PORTF
|
||||
#define DIO47_DDR DDRF
|
||||
#define DIO47_PWM NULL
|
||||
#define DIO47_PWM nullptr
|
||||
|
||||
#define DIO48_PIN PINF2
|
||||
#define DIO48_RPORT PINF
|
||||
#define DIO48_WPORT PORTF
|
||||
#define DIO48_DDR DDRF
|
||||
#define DIO48_PWM NULL
|
||||
#define DIO48_PWM nullptr
|
||||
|
||||
#define DIO49_PIN PINF3
|
||||
#define DIO49_RPORT PINF
|
||||
#define DIO49_WPORT PORTF
|
||||
#define DIO49_DDR DDRF
|
||||
#define DIO49_PWM NULL
|
||||
#define DIO49_PWM nullptr
|
||||
|
||||
#define DIO50_PIN PINF4
|
||||
#define DIO50_RPORT PINF
|
||||
#define DIO50_WPORT PORTF
|
||||
#define DIO50_DDR DDRF
|
||||
#define DIO50_PWM NULL
|
||||
#define DIO50_PWM nullptr
|
||||
|
||||
#define DIO51_PIN PINF5
|
||||
#define DIO51_RPORT PINF
|
||||
#define DIO51_WPORT PORTF
|
||||
#define DIO51_DDR DDRF
|
||||
#define DIO51_PWM NULL
|
||||
#define DIO51_PWM nullptr
|
||||
|
||||
#define DIO52_PIN PINF6
|
||||
#define DIO52_RPORT PINF
|
||||
#define DIO52_WPORT PORTF
|
||||
#define DIO52_DDR DDRF
|
||||
#define DIO52_PWM NULL
|
||||
#define DIO52_PWM nullptr
|
||||
|
||||
#define DIO53_PIN PINF7
|
||||
#define DIO53_RPORT PINF
|
||||
#define DIO53_WPORT PORTF
|
||||
#define DIO53_DDR DDRF
|
||||
#define DIO53_PWM NULL
|
||||
#define DIO53_PWM nullptr
|
||||
|
||||
#undef PA0
|
||||
#define PA0_PIN PINA0
|
||||
#define PA0_RPORT PINA
|
||||
#define PA0_WPORT PORTA
|
||||
#define PA0_DDR DDRA
|
||||
#define PA0_PWM NULL
|
||||
#define PA0_PWM nullptr
|
||||
#undef PA1
|
||||
#define PA1_PIN PINA1
|
||||
#define PA1_RPORT PINA
|
||||
#define PA1_WPORT PORTA
|
||||
#define PA1_DDR DDRA
|
||||
#define PA1_PWM NULL
|
||||
#define PA1_PWM nullptr
|
||||
#undef PA2
|
||||
#define PA2_PIN PINA2
|
||||
#define PA2_RPORT PINA
|
||||
#define PA2_WPORT PORTA
|
||||
#define PA2_DDR DDRA
|
||||
#define PA2_PWM NULL
|
||||
#define PA2_PWM nullptr
|
||||
#undef PA3
|
||||
#define PA3_PIN PINA3
|
||||
#define PA3_RPORT PINA
|
||||
#define PA3_WPORT PORTA
|
||||
#define PA3_DDR DDRA
|
||||
#define PA3_PWM NULL
|
||||
#define PA3_PWM nullptr
|
||||
#undef PA4
|
||||
#define PA4_PIN PINA4
|
||||
#define PA4_RPORT PINA
|
||||
#define PA4_WPORT PORTA
|
||||
#define PA4_DDR DDRA
|
||||
#define PA4_PWM NULL
|
||||
#define PA4_PWM nullptr
|
||||
#undef PA5
|
||||
#define PA5_PIN PINA5
|
||||
#define PA5_RPORT PINA
|
||||
#define PA5_WPORT PORTA
|
||||
#define PA5_DDR DDRA
|
||||
#define PA5_PWM NULL
|
||||
#define PA5_PWM nullptr
|
||||
#undef PA6
|
||||
#define PA6_PIN PINA6
|
||||
#define PA6_RPORT PINA
|
||||
#define PA6_WPORT PORTA
|
||||
#define PA6_DDR DDRA
|
||||
#define PA6_PWM NULL
|
||||
#define PA6_PWM nullptr
|
||||
#undef PA7
|
||||
#define PA7_PIN PINA7
|
||||
#define PA7_RPORT PINA
|
||||
#define PA7_WPORT PORTA
|
||||
#define PA7_DDR DDRA
|
||||
#define PA7_PWM NULL
|
||||
#define PA7_PWM nullptr
|
||||
|
||||
#undef PB0
|
||||
#define PB0_PIN PINB0
|
||||
#define PB0_RPORT PINB
|
||||
#define PB0_WPORT PORTB
|
||||
#define PB0_DDR DDRB
|
||||
#define PB0_PWM NULL
|
||||
#define PB0_PWM nullptr
|
||||
#undef PB1
|
||||
#define PB1_PIN PINB1
|
||||
#define PB1_RPORT PINB
|
||||
#define PB1_WPORT PORTB
|
||||
#define PB1_DDR DDRB
|
||||
#define PB1_PWM NULL
|
||||
#define PB1_PWM nullptr
|
||||
#undef PB2
|
||||
#define PB2_PIN PINB2
|
||||
#define PB2_RPORT PINB
|
||||
#define PB2_WPORT PORTB
|
||||
#define PB2_DDR DDRB
|
||||
#define PB2_PWM NULL
|
||||
#define PB2_PWM nullptr
|
||||
#undef PB3
|
||||
#define PB3_PIN PINB3
|
||||
#define PB3_RPORT PINB
|
||||
#define PB3_WPORT PORTB
|
||||
#define PB3_DDR DDRB
|
||||
#define PB3_PWM NULL
|
||||
#define PB3_PWM nullptr
|
||||
#undef PB4
|
||||
#define PB4_PIN PINB4
|
||||
#define PB4_RPORT PINB
|
||||
@@ -467,13 +467,13 @@
|
||||
#define PB5_RPORT PINB
|
||||
#define PB5_WPORT PORTB
|
||||
#define PB5_DDR DDRB
|
||||
#define PB5_PWM NULL
|
||||
#define PB5_PWM nullptr
|
||||
#undef PB6
|
||||
#define PB6_PIN PINB6
|
||||
#define PB6_RPORT PINB
|
||||
#define PB6_WPORT PORTB
|
||||
#define PB6_DDR DDRB
|
||||
#define PB6_PWM NULL
|
||||
#define PB6_PWM nullptr
|
||||
#undef PB7
|
||||
#define PB7_PIN PINB7
|
||||
#define PB7_RPORT PINB
|
||||
@@ -486,117 +486,117 @@
|
||||
#define PC0_RPORT PINC
|
||||
#define PC0_WPORT PORTC
|
||||
#define PC0_DDR DDRC
|
||||
#define PC0_PWM NULL
|
||||
#define PC0_PWM nullptr
|
||||
#undef PC1
|
||||
#define PC1_PIN PINC1
|
||||
#define PC1_RPORT PINC
|
||||
#define PC1_WPORT PORTC
|
||||
#define PC1_DDR DDRC
|
||||
#define PC1_PWM NULL
|
||||
#define PC1_PWM nullptr
|
||||
#undef PC2
|
||||
#define PC2_PIN PINC2
|
||||
#define PC2_RPORT PINC
|
||||
#define PC2_WPORT PORTC
|
||||
#define PC2_DDR DDRC
|
||||
#define PC2_PWM NULL
|
||||
#define PC2_PWM nullptr
|
||||
#undef PC3
|
||||
#define PC3_PIN PINC3
|
||||
#define PC3_RPORT PINC
|
||||
#define PC3_WPORT PORTC
|
||||
#define PC3_DDR DDRC
|
||||
#define PC3_PWM NULL
|
||||
#define PC3_PWM nullptr
|
||||
#undef PC4
|
||||
#define PC4_PIN PINC4
|
||||
#define PC4_RPORT PINC
|
||||
#define PC4_WPORT PORTC
|
||||
#define PC4_DDR DDRC
|
||||
#define PC4_PWM NULL
|
||||
#define PC4_PWM nullptr
|
||||
#undef PC5
|
||||
#define PC5_PIN PINC5
|
||||
#define PC5_RPORT PINC
|
||||
#define PC5_WPORT PORTC
|
||||
#define PC5_DDR DDRC
|
||||
#define PC5_PWM NULL
|
||||
#define PC5_PWM nullptr
|
||||
#undef PC6
|
||||
#define PC6_PIN PINC6
|
||||
#define PC6_RPORT PINC
|
||||
#define PC6_WPORT PORTC
|
||||
#define PC6_DDR DDRC
|
||||
#define PC6_PWM NULL
|
||||
#define PC6_PWM nullptr
|
||||
#undef PC7
|
||||
#define PC7_PIN PINC7
|
||||
#define PC7_RPORT PINC
|
||||
#define PC7_WPORT PORTC
|
||||
#define PC7_DDR DDRC
|
||||
#define PC7_PWM NULL
|
||||
#define PC7_PWM nullptr
|
||||
|
||||
#undef PD0
|
||||
#define PD0_PIN PIND0
|
||||
#define PD0_RPORT PIND
|
||||
#define PD0_WPORT PORTD
|
||||
#define PD0_DDR DDRD
|
||||
#define PD0_PWM NULL
|
||||
#define PD0_PWM nullptr
|
||||
#undef PD1
|
||||
#define PD1_PIN PIND1
|
||||
#define PD1_RPORT PIND
|
||||
#define PD1_WPORT PORTD
|
||||
#define PD1_DDR DDRD
|
||||
#define PD1_PWM NULL
|
||||
#define PD1_PWM nullptr
|
||||
#undef PD2
|
||||
#define PD2_PIN PIND2
|
||||
#define PD2_RPORT PIND
|
||||
#define PD2_WPORT PORTD
|
||||
#define PD2_DDR DDRD
|
||||
#define PD2_PWM NULL
|
||||
#define PD2_PWM nullptr
|
||||
#undef PD3
|
||||
#define PD3_PIN PIND3
|
||||
#define PD3_RPORT PIND
|
||||
#define PD3_WPORT PORTD
|
||||
#define PD3_DDR DDRD
|
||||
#define PD3_PWM NULL
|
||||
#define PD3_PWM nullptr
|
||||
#undef PD4
|
||||
#define PD4_PIN PIND4
|
||||
#define PD4_RPORT PIND
|
||||
#define PD4_WPORT PORTD
|
||||
#define PD4_DDR DDRD
|
||||
#define PD4_PWM NULL
|
||||
#define PD4_PWM nullptr
|
||||
#undef PD5
|
||||
#define PD5_PIN PIND5
|
||||
#define PD5_RPORT PIND
|
||||
#define PD5_WPORT PORTD
|
||||
#define PD5_DDR DDRD
|
||||
#define PD5_PWM NULL
|
||||
#define PD5_PWM nullptr
|
||||
#undef PD6
|
||||
#define PD6_PIN PIND6
|
||||
#define PD6_RPORT PIND
|
||||
#define PD6_WPORT PORTD
|
||||
#define PD6_DDR DDRD
|
||||
#define PD6_PWM NULL
|
||||
#define PD6_PWM nullptr
|
||||
#undef PD7
|
||||
#define PD7_PIN PIND7
|
||||
#define PD7_RPORT PIND
|
||||
#define PD7_WPORT PORTD
|
||||
#define PD7_DDR DDRD
|
||||
#define PD7_PWM NULL
|
||||
#define PD7_PWM nullptr
|
||||
|
||||
#undef PE0
|
||||
#define PE0_PIN PINE0
|
||||
#define PE0_RPORT PINE
|
||||
#define PE0_WPORT PORTE
|
||||
#define PE0_DDR DDRE
|
||||
#define PE0_PWM NULL
|
||||
#define PE0_PWM nullptr
|
||||
#undef PE1
|
||||
#define PE1_PIN PINE1
|
||||
#define PE1_RPORT PINE
|
||||
#define PE1_WPORT PORTE
|
||||
#define PE1_DDR DDRE
|
||||
#define PE1_PWM NULL
|
||||
#define PE1_PWM nullptr
|
||||
#undef PE2
|
||||
#define PE2_PIN PINE2
|
||||
#define PE2_RPORT PINE
|
||||
#define PE2_WPORT PORTE
|
||||
#define PE2_DDR DDRE
|
||||
#define PE2_PWM NULL
|
||||
#define PE2_PWM nullptr
|
||||
#undef PE3
|
||||
#define PE3_PIN PINE3
|
||||
#define PE3_RPORT PINE
|
||||
@@ -620,93 +620,93 @@
|
||||
#define PE6_RPORT PINE
|
||||
#define PE6_WPORT PORTE
|
||||
#define PE6_DDR DDRE
|
||||
#define PE6_PWM NULL
|
||||
#define PE6_PWM nullptr
|
||||
#undef PE7
|
||||
#define PE7_PIN PINE7
|
||||
#define PE7_RPORT PINE
|
||||
#define PE7_WPORT PORTE
|
||||
#define PE7_DDR DDRE
|
||||
#define PE7_PWM NULL
|
||||
#define PE7_PWM nullptr
|
||||
|
||||
#undef PF0
|
||||
#define PF0_PIN PINF0
|
||||
#define PF0_RPORT PINF
|
||||
#define PF0_WPORT PORTF
|
||||
#define PF0_DDR DDRF
|
||||
#define PF0_PWM NULL
|
||||
#define PF0_PWM nullptr
|
||||
#undef PF1
|
||||
#define PF1_PIN PINF1
|
||||
#define PF1_RPORT PINF
|
||||
#define PF1_WPORT PORTF
|
||||
#define PF1_DDR DDRF
|
||||
#define PF1_PWM NULL
|
||||
#define PF1_PWM nullptr
|
||||
#undef PF2
|
||||
#define PF2_PIN PINF2
|
||||
#define PF2_RPORT PINF
|
||||
#define PF2_WPORT PORTF
|
||||
#define PF2_DDR DDRF
|
||||
#define PF2_PWM NULL
|
||||
#define PF2_PWM nullptr
|
||||
#undef PF3
|
||||
#define PF3_PIN PINF3
|
||||
#define PF3_RPORT PINF
|
||||
#define PF3_WPORT PORTF
|
||||
#define PF3_DDR DDRF
|
||||
#define PF3_PWM NULL
|
||||
#define PF3_PWM nullptr
|
||||
#undef PF4
|
||||
#define PF4_PIN PINF4
|
||||
#define PF4_RPORT PINF
|
||||
#define PF4_WPORT PORTF
|
||||
#define PF4_DDR DDRF
|
||||
#define PF4_PWM NULL
|
||||
#define PF4_PWM nullptr
|
||||
#undef PF5
|
||||
#define PF5_PIN PINF5
|
||||
#define PF5_RPORT PINF
|
||||
#define PF5_WPORT PORTF
|
||||
#define PF5_DDR DDRF
|
||||
#define PF5_PWM NULL
|
||||
#define PF5_PWM nullptr
|
||||
#undef PF6
|
||||
#define PF6_PIN PINF6
|
||||
#define PF6_RPORT PINF
|
||||
#define PF6_WPORT PORTF
|
||||
#define PF6_DDR DDRF
|
||||
#define PF6_PWM NULL
|
||||
#define PF6_PWM nullptr
|
||||
#undef PF7
|
||||
#define PF7_PIN PINF7
|
||||
#define PF7_RPORT PINF
|
||||
#define PF7_WPORT PORTF
|
||||
#define PF7_DDR DDRF
|
||||
#define PF7_PWM NULL
|
||||
#define PF7_PWM nullptr
|
||||
|
||||
#undef PG0
|
||||
#define PG0_PIN PING0
|
||||
#define PG0_RPORT PING
|
||||
#define PG0_WPORT PORTG
|
||||
#define PG0_DDR DDRG
|
||||
#define PG0_PWM NULL
|
||||
#define PG0_PWM nullptr
|
||||
#undef PG1
|
||||
#define PG1_PIN PING1
|
||||
#define PG1_RPORT PING
|
||||
#define PG1_WPORT PORTG
|
||||
#define PG1_DDR DDRG
|
||||
#define PG1_PWM NULL
|
||||
#define PG1_PWM nullptr
|
||||
#undef PG2
|
||||
#define PG2_PIN PING2
|
||||
#define PG2_RPORT PING
|
||||
#define PG2_WPORT PORTG
|
||||
#define PG2_DDR DDRG
|
||||
#define PG2_PWM NULL
|
||||
#define PG2_PWM nullptr
|
||||
#undef PG3
|
||||
#define PG3_PIN PING3
|
||||
#define PG3_RPORT PING
|
||||
#define PG3_WPORT PORTG
|
||||
#define PG3_DDR DDRG
|
||||
#define PG3_PWM NULL
|
||||
#define PG3_PWM nullptr
|
||||
#undef PG4
|
||||
#define PG4_PIN PING4
|
||||
#define PG4_RPORT PING
|
||||
#define PG4_WPORT PORTG
|
||||
#define PG4_DDR DDRG
|
||||
#define PG4_PWM NULL
|
||||
#define PG4_PWM nullptr
|
||||
#undef PG5
|
||||
#define PG5_PIN PING5
|
||||
#define PG5_RPORT PING
|
||||
|
||||
@@ -60,19 +60,19 @@
|
||||
#define DIO0_RPORT PIND
|
||||
#define DIO0_WPORT PORTD
|
||||
#define DIO0_DDR DDRD
|
||||
#define DIO0_PWM NULL
|
||||
#define DIO0_PWM nullptr
|
||||
|
||||
#define DIO1_PIN PIND1
|
||||
#define DIO1_RPORT PIND
|
||||
#define DIO1_WPORT PORTD
|
||||
#define DIO1_DDR DDRD
|
||||
#define DIO1_PWM NULL
|
||||
#define DIO1_PWM nullptr
|
||||
|
||||
#define DIO2_PIN PIND2
|
||||
#define DIO2_RPORT PIND
|
||||
#define DIO2_WPORT PORTD
|
||||
#define DIO2_DDR DDRD
|
||||
#define DIO2_PWM NULL
|
||||
#define DIO2_PWM nullptr
|
||||
|
||||
#define DIO3_PIN PIND3
|
||||
#define DIO3_RPORT PIND
|
||||
@@ -84,7 +84,7 @@
|
||||
#define DIO4_RPORT PIND
|
||||
#define DIO4_WPORT PORTD
|
||||
#define DIO4_DDR DDRD
|
||||
#define DIO4_PWM NULL
|
||||
#define DIO4_PWM nullptr
|
||||
|
||||
#define DIO5_PIN PIND5
|
||||
#define DIO5_RPORT PIND
|
||||
@@ -102,25 +102,25 @@
|
||||
#define DIO7_RPORT PIND
|
||||
#define DIO7_WPORT PORTD
|
||||
#define DIO7_DDR DDRD
|
||||
#define DIO7_PWM NULL
|
||||
#define DIO7_PWM nullptr
|
||||
|
||||
#define DIO8_PIN PINB0
|
||||
#define DIO8_RPORT PINB
|
||||
#define DIO8_WPORT PORTB
|
||||
#define DIO8_DDR DDRB
|
||||
#define DIO8_PWM NULL
|
||||
#define DIO8_PWM nullptr
|
||||
|
||||
#define DIO9_PIN PINB1
|
||||
#define DIO9_RPORT PINB
|
||||
#define DIO9_WPORT PORTB
|
||||
#define DIO9_DDR DDRB
|
||||
#define DIO9_PWM NULL
|
||||
#define DIO9_PWM nullptr
|
||||
|
||||
#define DIO10_PIN PINB2
|
||||
#define DIO10_RPORT PINB
|
||||
#define DIO10_WPORT PORTB
|
||||
#define DIO10_DDR DDRB
|
||||
#define DIO10_PWM NULL
|
||||
#define DIO10_PWM nullptr
|
||||
|
||||
#define DIO11_PIN PINB3
|
||||
#define DIO11_RPORT PINB
|
||||
@@ -132,82 +132,82 @@
|
||||
#define DIO12_RPORT PINB
|
||||
#define DIO12_WPORT PORTB
|
||||
#define DIO12_DDR DDRB
|
||||
#define DIO12_PWM NULL
|
||||
#define DIO12_PWM nullptr
|
||||
|
||||
#define DIO13_PIN PINB5
|
||||
#define DIO13_RPORT PINB
|
||||
#define DIO13_WPORT PORTB
|
||||
#define DIO13_DDR DDRB
|
||||
#define DIO13_PWM NULL
|
||||
#define DIO13_PWM nullptr
|
||||
|
||||
#define DIO14_PIN PINC0
|
||||
#define DIO14_RPORT PINC
|
||||
#define DIO14_WPORT PORTC
|
||||
#define DIO14_DDR DDRC
|
||||
#define DIO14_PWM NULL
|
||||
#define DIO14_PWM nullptr
|
||||
|
||||
#define DIO15_PIN PINC1
|
||||
#define DIO15_RPORT PINC
|
||||
#define DIO15_WPORT PORTC
|
||||
#define DIO15_DDR DDRC
|
||||
#define DIO15_PWM NULL
|
||||
#define DIO15_PWM nullptr
|
||||
|
||||
#define DIO16_PIN PINC2
|
||||
#define DIO16_RPORT PINC
|
||||
#define DIO16_WPORT PORTC
|
||||
#define DIO16_DDR DDRC
|
||||
#define DIO16_PWM NULL
|
||||
#define DIO16_PWM nullptr
|
||||
|
||||
#define DIO17_PIN PINC3
|
||||
#define DIO17_RPORT PINC
|
||||
#define DIO17_WPORT PORTC
|
||||
#define DIO17_DDR DDRC
|
||||
#define DIO17_PWM NULL
|
||||
#define DIO17_PWM nullptr
|
||||
|
||||
#define DIO18_PIN PINC4
|
||||
#define DIO18_RPORT PINC
|
||||
#define DIO18_WPORT PORTC
|
||||
#define DIO18_DDR DDRC
|
||||
#define DIO18_PWM NULL
|
||||
#define DIO18_PWM nullptr
|
||||
|
||||
#define DIO19_PIN PINC5
|
||||
#define DIO19_RPORT PINC
|
||||
#define DIO19_WPORT PORTC
|
||||
#define DIO19_DDR DDRC
|
||||
#define DIO19_PWM NULL
|
||||
#define DIO19_PWM nullptr
|
||||
|
||||
#define DIO20_PIN PINC6
|
||||
#define DIO20_RPORT PINC
|
||||
#define DIO20_WPORT PORTC
|
||||
#define DIO20_DDR DDRC
|
||||
#define DIO20_PWM NULL
|
||||
#define DIO20_PWM nullptr
|
||||
|
||||
#define DIO21_PIN PINC7
|
||||
#define DIO21_RPORT PINC
|
||||
#define DIO21_WPORT PORTC
|
||||
#define DIO21_DDR DDRC
|
||||
#define DIO21_PWM NULL
|
||||
#define DIO21_PWM nullptr
|
||||
|
||||
#undef PB0
|
||||
#define PB0_PIN PINB0
|
||||
#define PB0_RPORT PINB
|
||||
#define PB0_WPORT PORTB
|
||||
#define PB0_DDR DDRB
|
||||
#define PB0_PWM NULL
|
||||
#define PB0_PWM nullptr
|
||||
|
||||
#undef PB1
|
||||
#define PB1_PIN PINB1
|
||||
#define PB1_RPORT PINB
|
||||
#define PB1_WPORT PORTB
|
||||
#define PB1_DDR DDRB
|
||||
#define PB1_PWM NULL
|
||||
#define PB1_PWM nullptr
|
||||
|
||||
#undef PB2
|
||||
#define PB2_PIN PINB2
|
||||
#define PB2_RPORT PINB
|
||||
#define PB2_WPORT PORTB
|
||||
#define PB2_DDR DDRB
|
||||
#define PB2_PWM NULL
|
||||
#define PB2_PWM nullptr
|
||||
|
||||
#undef PB3
|
||||
#define PB3_PIN PINB3
|
||||
@@ -221,105 +221,105 @@
|
||||
#define PB4_RPORT PINB
|
||||
#define PB4_WPORT PORTB
|
||||
#define PB4_DDR DDRB
|
||||
#define PB4_PWM NULL
|
||||
#define PB4_PWM nullptr
|
||||
|
||||
#undef PB5
|
||||
#define PB5_PIN PINB5
|
||||
#define PB5_RPORT PINB
|
||||
#define PB5_WPORT PORTB
|
||||
#define PB5_DDR DDRB
|
||||
#define PB5_PWM NULL
|
||||
#define PB5_PWM nullptr
|
||||
|
||||
#undef PB6
|
||||
#define PB6_PIN PINB6
|
||||
#define PB6_RPORT PINB
|
||||
#define PB6_WPORT PORTB
|
||||
#define PB6_DDR DDRB
|
||||
#define PB6_PWM NULL
|
||||
#define PB6_PWM nullptr
|
||||
|
||||
#undef PB7
|
||||
#define PB7_PIN PINB7
|
||||
#define PB7_RPORT PINB
|
||||
#define PB7_WPORT PORTB
|
||||
#define PB7_DDR DDRB
|
||||
#define PB7_PWM NULL
|
||||
#define PB7_PWM nullptr
|
||||
|
||||
#undef PC0
|
||||
#define PC0_PIN PINC0
|
||||
#define PC0_RPORT PINC
|
||||
#define PC0_WPORT PORTC
|
||||
#define PC0_DDR DDRC
|
||||
#define PC0_PWM NULL
|
||||
#define PC0_PWM nullptr
|
||||
|
||||
#undef PC1
|
||||
#define PC1_PIN PINC1
|
||||
#define PC1_RPORT PINC
|
||||
#define PC1_WPORT PORTC
|
||||
#define PC1_DDR DDRC
|
||||
#define PC1_PWM NULL
|
||||
#define PC1_PWM nullptr
|
||||
|
||||
#undef PC2
|
||||
#define PC2_PIN PINC2
|
||||
#define PC2_RPORT PINC
|
||||
#define PC2_WPORT PORTC
|
||||
#define PC2_DDR DDRC
|
||||
#define PC2_PWM NULL
|
||||
#define PC2_PWM nullptr
|
||||
|
||||
#undef PC3
|
||||
#define PC3_PIN PINC3
|
||||
#define PC3_RPORT PINC
|
||||
#define PC3_WPORT PORTC
|
||||
#define PC3_DDR DDRC
|
||||
#define PC3_PWM NULL
|
||||
#define PC3_PWM nullptr
|
||||
|
||||
#undef PC4
|
||||
#define PC4_PIN PINC4
|
||||
#define PC4_RPORT PINC
|
||||
#define PC4_WPORT PORTC
|
||||
#define PC4_DDR DDRC
|
||||
#define PC4_PWM NULL
|
||||
#define PC4_PWM nullptr
|
||||
|
||||
#undef PC5
|
||||
#define PC5_PIN PINC5
|
||||
#define PC5_RPORT PINC
|
||||
#define PC5_WPORT PORTC
|
||||
#define PC5_DDR DDRC
|
||||
#define PC5_PWM NULL
|
||||
#define PC5_PWM nullptr
|
||||
|
||||
#undef PC6
|
||||
#define PC6_PIN PINC6
|
||||
#define PC6_RPORT PINC
|
||||
#define PC6_WPORT PORTC
|
||||
#define PC6_DDR DDRC
|
||||
#define PC6_PWM NULL
|
||||
#define PC6_PWM nullptr
|
||||
|
||||
#undef PC7
|
||||
#define PC7_PIN PINC7
|
||||
#define PC7_RPORT PINC
|
||||
#define PC7_WPORT PORTC
|
||||
#define PC7_DDR DDRC
|
||||
#define PC7_PWM NULL
|
||||
#define PC7_PWM nullptr
|
||||
|
||||
#undef PD0
|
||||
#define PD0_PIN PIND0
|
||||
#define PD0_RPORT PIND
|
||||
#define PD0_WPORT PORTD
|
||||
#define PD0_DDR DDRD
|
||||
#define PD0_PWM NULL
|
||||
#define PD0_PWM nullptr
|
||||
|
||||
#undef PD1
|
||||
#define PD1_PIN PIND1
|
||||
#define PD1_RPORT PIND
|
||||
#define PD1_WPORT PORTD
|
||||
#define PD1_DDR DDRD
|
||||
#define PD1_PWM NULL
|
||||
#define PD1_PWM nullptr
|
||||
|
||||
#undef PD2
|
||||
#define PD2_PIN PIND2
|
||||
#define PD2_RPORT PIND
|
||||
#define PD2_WPORT PORTD
|
||||
#define PD2_DDR DDRD
|
||||
#define PD2_PWM NULL
|
||||
#define PD2_PWM nullptr
|
||||
|
||||
#undef PD3
|
||||
#define PD3_PIN PIND3
|
||||
@@ -333,7 +333,7 @@
|
||||
#define PD4_RPORT PIND
|
||||
#define PD4_WPORT PORTD
|
||||
#define PD4_DDR DDRD
|
||||
#define PD4_PWM NULL
|
||||
#define PD4_PWM nullptr
|
||||
|
||||
#undef PD5
|
||||
#define PD5_PIN PIND5
|
||||
@@ -354,4 +354,4 @@
|
||||
#define PD7_RPORT PIND
|
||||
#define PD7_WPORT PORTD
|
||||
#define PD7_DDR DDRD
|
||||
#define PD7_PWM NULL
|
||||
#define PD7_PWM nullptr
|
||||
|
||||
@@ -91,462 +91,462 @@
|
||||
#define DIO0_RPORT PINB
|
||||
#define DIO0_WPORT PORTB
|
||||
#define DIO0_DDR DDRB
|
||||
#define DIO0_PWM NULL
|
||||
#define DIO0_PWM nullptr
|
||||
|
||||
#define DIO1_PIN PINB1
|
||||
#define DIO1_RPORT PINB
|
||||
#define DIO1_WPORT PORTB
|
||||
#define DIO1_DDR DDRB
|
||||
#define DIO1_PWM NULL
|
||||
#define DIO1_PWM nullptr
|
||||
|
||||
#define DIO2_PIN PINB2
|
||||
#define DIO2_RPORT PINB
|
||||
#define DIO2_WPORT PORTB
|
||||
#define DIO2_DDR DDRB
|
||||
#define DIO2_PWM NULL
|
||||
#define DIO2_PWM nullptr
|
||||
|
||||
#define DIO3_PIN PINB3
|
||||
#define DIO3_RPORT PINB
|
||||
#define DIO3_WPORT PORTB
|
||||
#define DIO3_DDR DDRB
|
||||
#define DIO3_PWM OCR0A
|
||||
#define DIO3_PWM &OCR0A
|
||||
|
||||
#define DIO4_PIN PINB4
|
||||
#define DIO4_RPORT PINB
|
||||
#define DIO4_WPORT PORTB
|
||||
#define DIO4_DDR DDRB
|
||||
#define DIO4_PWM OCR0B
|
||||
#define DIO4_PWM &OCR0B
|
||||
|
||||
#define DIO5_PIN PINB5
|
||||
#define DIO5_RPORT PINB
|
||||
#define DIO5_WPORT PORTB
|
||||
#define DIO5_DDR DDRB
|
||||
#define DIO5_PWM NULL
|
||||
#define DIO5_PWM nullptr
|
||||
|
||||
#define DIO6_PIN PINB6
|
||||
#define DIO6_RPORT PINB
|
||||
#define DIO6_WPORT PORTB
|
||||
#define DIO6_DDR DDRB
|
||||
#define DIO6_PWM NULL
|
||||
#define DIO6_PWM nullptr
|
||||
|
||||
#define DIO7_PIN PINB7
|
||||
#define DIO7_RPORT PINB
|
||||
#define DIO7_WPORT PORTB
|
||||
#define DIO7_DDR DDRB
|
||||
#define DIO7_PWM NULL
|
||||
#define DIO7_PWM nullptr
|
||||
|
||||
#define DIO8_PIN PIND0
|
||||
#define DIO8_RPORT PIND
|
||||
#define DIO8_WPORT PORTD
|
||||
#define DIO8_DDR DDRD
|
||||
#define DIO8_PWM NULL
|
||||
#define DIO8_PWM nullptr
|
||||
|
||||
#define DIO9_PIN PIND1
|
||||
#define DIO9_RPORT PIND
|
||||
#define DIO9_WPORT PORTD
|
||||
#define DIO9_DDR DDRD
|
||||
#define DIO9_PWM NULL
|
||||
#define DIO9_PWM nullptr
|
||||
|
||||
#define DIO10_PIN PIND2
|
||||
#define DIO10_RPORT PIND
|
||||
#define DIO10_WPORT PORTD
|
||||
#define DIO10_DDR DDRD
|
||||
#define DIO10_PWM NULL
|
||||
#define DIO10_PWM nullptr
|
||||
|
||||
#define DIO11_PIN PIND3
|
||||
#define DIO11_RPORT PIND
|
||||
#define DIO11_WPORT PORTD
|
||||
#define DIO11_DDR DDRD
|
||||
#define DIO11_PWM NULL
|
||||
#define DIO11_PWM nullptr
|
||||
|
||||
#define DIO12_PIN PIND4
|
||||
#define DIO12_RPORT PIND
|
||||
#define DIO12_WPORT PORTD
|
||||
#define DIO12_DDR DDRD
|
||||
#define DIO12_PWM OCR1B
|
||||
#define DIO12_PWM &OCR1B
|
||||
|
||||
#define DIO13_PIN PIND5
|
||||
#define DIO13_RPORT PIND
|
||||
#define DIO13_WPORT PORTD
|
||||
#define DIO13_DDR DDRD
|
||||
#define DIO13_PWM OCR1A
|
||||
#define DIO13_PWM &OCR1A
|
||||
|
||||
#define DIO14_PIN PIND6
|
||||
#define DIO14_RPORT PIND
|
||||
#define DIO14_WPORT PORTD
|
||||
#define DIO14_DDR DDRD
|
||||
#define DIO14_PWM OCR2B
|
||||
#define DIO14_PWM &OCR2B
|
||||
|
||||
#define DIO15_PIN PIND7
|
||||
#define DIO15_RPORT PIND
|
||||
#define DIO15_WPORT PORTD
|
||||
#define DIO15_DDR DDRD
|
||||
#define DIO15_PWM OCR2A
|
||||
#define DIO15_PWM &OCR2A
|
||||
|
||||
#define DIO16_PIN PINC0
|
||||
#define DIO16_RPORT PINC
|
||||
#define DIO16_WPORT PORTC
|
||||
#define DIO16_DDR DDRC
|
||||
#define DIO16_PWM NULL
|
||||
#define DIO16_PWM nullptr
|
||||
|
||||
#define DIO17_PIN PINC1
|
||||
#define DIO17_RPORT PINC
|
||||
#define DIO17_WPORT PORTC
|
||||
#define DIO17_DDR DDRC
|
||||
#define DIO17_PWM NULL
|
||||
#define DIO17_PWM nullptr
|
||||
|
||||
#define DIO18_PIN PINC2
|
||||
#define DIO18_RPORT PINC
|
||||
#define DIO18_WPORT PORTC
|
||||
#define DIO18_DDR DDRC
|
||||
#define DIO18_PWM NULL
|
||||
#define DIO18_PWM nullptr
|
||||
|
||||
#define DIO19_PIN PINC3
|
||||
#define DIO19_RPORT PINC
|
||||
#define DIO19_WPORT PORTC
|
||||
#define DIO19_DDR DDRC
|
||||
#define DIO19_PWM NULL
|
||||
#define DIO19_PWM nullptr
|
||||
|
||||
#define DIO20_PIN PINC4
|
||||
#define DIO20_RPORT PINC
|
||||
#define DIO20_WPORT PORTC
|
||||
#define DIO20_DDR DDRC
|
||||
#define DIO20_PWM NULL
|
||||
#define DIO20_PWM nullptr
|
||||
|
||||
#define DIO21_PIN PINC5
|
||||
#define DIO21_RPORT PINC
|
||||
#define DIO21_WPORT PORTC
|
||||
#define DIO21_DDR DDRC
|
||||
#define DIO21_PWM NULL
|
||||
#define DIO21_PWM nullptr
|
||||
|
||||
#define DIO22_PIN PINC6
|
||||
#define DIO22_RPORT PINC
|
||||
#define DIO22_WPORT PORTC
|
||||
#define DIO22_DDR DDRC
|
||||
#define DIO22_PWM NULL
|
||||
#define DIO22_PWM nullptr
|
||||
|
||||
#define DIO23_PIN PINC7
|
||||
#define DIO23_RPORT PINC
|
||||
#define DIO23_WPORT PORTC
|
||||
#define DIO23_DDR DDRC
|
||||
#define DIO23_PWM NULL
|
||||
#define DIO23_PWM nullptr
|
||||
|
||||
#define DIO24_PIN PINA7
|
||||
#define DIO24_RPORT PINA
|
||||
#define DIO24_WPORT PORTA
|
||||
#define DIO24_DDR DDRA
|
||||
#define DIO24_PWM NULL
|
||||
#define DIO24_PWM nullptr
|
||||
|
||||
#define DIO25_PIN PINA6
|
||||
#define DIO25_RPORT PINA
|
||||
#define DIO25_WPORT PORTA
|
||||
#define DIO25_DDR DDRA
|
||||
#define DIO25_PWM NULL
|
||||
#define DIO25_PWM nullptr
|
||||
|
||||
#define DIO26_PIN PINA5
|
||||
#define DIO26_RPORT PINA
|
||||
#define DIO26_WPORT PORTA
|
||||
#define DIO26_DDR DDRA
|
||||
#define DIO26_PWM NULL
|
||||
#define DIO26_PWM nullptr
|
||||
|
||||
#define DIO27_PIN PINA4
|
||||
#define DIO27_RPORT PINA
|
||||
#define DIO27_WPORT PORTA
|
||||
#define DIO27_DDR DDRA
|
||||
#define DIO27_PWM NULL
|
||||
#define DIO27_PWM nullptr
|
||||
|
||||
#define DIO28_PIN PINA3
|
||||
#define DIO28_RPORT PINA
|
||||
#define DIO28_WPORT PORTA
|
||||
#define DIO28_DDR DDRA
|
||||
#define DIO28_PWM NULL
|
||||
#define DIO28_PWM nullptr
|
||||
|
||||
#define DIO29_PIN PINA2
|
||||
#define DIO29_RPORT PINA
|
||||
#define DIO29_WPORT PORTA
|
||||
#define DIO29_DDR DDRA
|
||||
#define DIO29_PWM NULL
|
||||
#define DIO29_PWM nullptr
|
||||
|
||||
#define DIO30_PIN PINA1
|
||||
#define DIO30_RPORT PINA
|
||||
#define DIO30_WPORT PORTA
|
||||
#define DIO30_DDR DDRA
|
||||
#define DIO30_PWM NULL
|
||||
#define DIO30_PWM nullptr
|
||||
|
||||
#define DIO31_PIN PINA0
|
||||
#define DIO31_RPORT PINA
|
||||
#define DIO31_WPORT PORTA
|
||||
#define DIO31_DDR DDRA
|
||||
#define DIO31_PWM NULL
|
||||
#define DIO31_PWM nullptr
|
||||
|
||||
#define AIO0_PIN PINA0
|
||||
#define AIO0_RPORT PINA
|
||||
#define AIO0_WPORT PORTA
|
||||
#define AIO0_DDR DDRA
|
||||
#define AIO0_PWM NULL
|
||||
#define AIO0_PWM nullptr
|
||||
|
||||
#define AIO1_PIN PINA1
|
||||
#define AIO1_RPORT PINA
|
||||
#define AIO1_WPORT PORTA
|
||||
#define AIO1_DDR DDRA
|
||||
#define AIO1_PWM NULL
|
||||
#define AIO1_PWM nullptr
|
||||
|
||||
#define AIO2_PIN PINA2
|
||||
#define AIO2_RPORT PINA
|
||||
#define AIO2_WPORT PORTA
|
||||
#define AIO2_DDR DDRA
|
||||
#define AIO2_PWM NULL
|
||||
#define AIO2_PWM nullptr
|
||||
|
||||
#define AIO3_PIN PINA3
|
||||
#define AIO3_RPORT PINA
|
||||
#define AIO3_WPORT PORTA
|
||||
#define AIO3_DDR DDRA
|
||||
#define AIO3_PWM NULL
|
||||
#define AIO3_PWM nullptr
|
||||
|
||||
#define AIO4_PIN PINA4
|
||||
#define AIO4_RPORT PINA
|
||||
#define AIO4_WPORT PORTA
|
||||
#define AIO4_DDR DDRA
|
||||
#define AIO4_PWM NULL
|
||||
#define AIO4_PWM nullptr
|
||||
|
||||
#define AIO5_PIN PINA5
|
||||
#define AIO5_RPORT PINA
|
||||
#define AIO5_WPORT PORTA
|
||||
#define AIO5_DDR DDRA
|
||||
#define AIO5_PWM NULL
|
||||
#define AIO5_PWM nullptr
|
||||
|
||||
#define AIO6_PIN PINA6
|
||||
#define AIO6_RPORT PINA
|
||||
#define AIO6_WPORT PORTA
|
||||
#define AIO6_DDR DDRA
|
||||
#define AIO6_PWM NULL
|
||||
#define AIO6_PWM nullptr
|
||||
|
||||
#define AIO7_PIN PINA7
|
||||
#define AIO7_RPORT PINA
|
||||
#define AIO7_WPORT PORTA
|
||||
#define AIO7_DDR DDRA
|
||||
#define AIO7_PWM NULL
|
||||
#define AIO7_PWM nullptr
|
||||
|
||||
#undef PA0
|
||||
#define PA0_PIN PINA0
|
||||
#define PA0_RPORT PINA
|
||||
#define PA0_WPORT PORTA
|
||||
#define PA0_DDR DDRA
|
||||
#define PA0_PWM NULL
|
||||
#define PA0_PWM nullptr
|
||||
|
||||
#undef PA1
|
||||
#define PA1_PIN PINA1
|
||||
#define PA1_RPORT PINA
|
||||
#define PA1_WPORT PORTA
|
||||
#define PA1_DDR DDRA
|
||||
#define PA1_PWM NULL
|
||||
#define PA1_PWM nullptr
|
||||
|
||||
#undef PA2
|
||||
#define PA2_PIN PINA2
|
||||
#define PA2_RPORT PINA
|
||||
#define PA2_WPORT PORTA
|
||||
#define PA2_DDR DDRA
|
||||
#define PA2_PWM NULL
|
||||
#define PA2_PWM nullptr
|
||||
|
||||
#undef PA3
|
||||
#define PA3_PIN PINA3
|
||||
#define PA3_RPORT PINA
|
||||
#define PA3_WPORT PORTA
|
||||
#define PA3_DDR DDRA
|
||||
#define PA3_PWM NULL
|
||||
#define PA3_PWM nullptr
|
||||
|
||||
#undef PA4
|
||||
#define PA4_PIN PINA4
|
||||
#define PA4_RPORT PINA
|
||||
#define PA4_WPORT PORTA
|
||||
#define PA4_DDR DDRA
|
||||
#define PA4_PWM NULL
|
||||
#define PA4_PWM nullptr
|
||||
|
||||
#undef PA5
|
||||
#define PA5_PIN PINA5
|
||||
#define PA5_RPORT PINA
|
||||
#define PA5_WPORT PORTA
|
||||
#define PA5_DDR DDRA
|
||||
#define PA5_PWM NULL
|
||||
#define PA5_PWM nullptr
|
||||
|
||||
#undef PA6
|
||||
#define PA6_PIN PINA6
|
||||
#define PA6_RPORT PINA
|
||||
#define PA6_WPORT PORTA
|
||||
#define PA6_DDR DDRA
|
||||
#define PA6_PWM NULL
|
||||
#define PA6_PWM nullptr
|
||||
|
||||
#undef PA7
|
||||
#define PA7_PIN PINA7
|
||||
#define PA7_RPORT PINA
|
||||
#define PA7_WPORT PORTA
|
||||
#define PA7_DDR DDRA
|
||||
#define PA7_PWM NULL
|
||||
#define PA7_PWM nullptr
|
||||
|
||||
#undef PB0
|
||||
#define PB0_PIN PINB0
|
||||
#define PB0_RPORT PINB
|
||||
#define PB0_WPORT PORTB
|
||||
#define PB0_DDR DDRB
|
||||
#define PB0_PWM NULL
|
||||
#define PB0_PWM nullptr
|
||||
|
||||
#undef PB1
|
||||
#define PB1_PIN PINB1
|
||||
#define PB1_RPORT PINB
|
||||
#define PB1_WPORT PORTB
|
||||
#define PB1_DDR DDRB
|
||||
#define PB1_PWM NULL
|
||||
#define PB1_PWM nullptr
|
||||
|
||||
#undef PB2
|
||||
#define PB2_PIN PINB2
|
||||
#define PB2_RPORT PINB
|
||||
#define PB2_WPORT PORTB
|
||||
#define PB2_DDR DDRB
|
||||
#define PB2_PWM NULL
|
||||
#define PB2_PWM nullptr
|
||||
|
||||
#undef PB3
|
||||
#define PB3_PIN PINB3
|
||||
#define PB3_RPORT PINB
|
||||
#define PB3_WPORT PORTB
|
||||
#define PB3_DDR DDRB
|
||||
#define PB3_PWM OCR0A
|
||||
#define PB3_PWM &OCR0A
|
||||
|
||||
#undef PB4
|
||||
#define PB4_PIN PINB4
|
||||
#define PB4_RPORT PINB
|
||||
#define PB4_WPORT PORTB
|
||||
#define PB4_DDR DDRB
|
||||
#define PB4_PWM OCR0B
|
||||
#define PB4_PWM &OCR0B
|
||||
|
||||
#undef PB5
|
||||
#define PB5_PIN PINB5
|
||||
#define PB5_RPORT PINB
|
||||
#define PB5_WPORT PORTB
|
||||
#define PB5_DDR DDRB
|
||||
#define PB5_PWM NULL
|
||||
#define PB5_PWM nullptr
|
||||
|
||||
#undef PB6
|
||||
#define PB6_PIN PINB6
|
||||
#define PB6_RPORT PINB
|
||||
#define PB6_WPORT PORTB
|
||||
#define PB6_DDR DDRB
|
||||
#define PB6_PWM NULL
|
||||
#define PB6_PWM nullptr
|
||||
|
||||
#undef PB7
|
||||
#define PB7_PIN PINB7
|
||||
#define PB7_RPORT PINB
|
||||
#define PB7_WPORT PORTB
|
||||
#define PB7_DDR DDRB
|
||||
#define PB7_PWM NULL
|
||||
#define PB7_PWM nullptr
|
||||
|
||||
#undef PC0
|
||||
#define PC0_PIN PINC0
|
||||
#define PC0_RPORT PINC
|
||||
#define PC0_WPORT PORTC
|
||||
#define PC0_DDR DDRC
|
||||
#define PC0_PWM NULL
|
||||
#define PC0_PWM nullptr
|
||||
|
||||
#undef PC1
|
||||
#define PC1_PIN PINC1
|
||||
#define PC1_RPORT PINC
|
||||
#define PC1_WPORT PORTC
|
||||
#define PC1_DDR DDRC
|
||||
#define PC1_PWM NULL
|
||||
#define PC1_PWM nullptr
|
||||
|
||||
#undef PC2
|
||||
#define PC2_PIN PINC2
|
||||
#define PC2_RPORT PINC
|
||||
#define PC2_WPORT PORTC
|
||||
#define PC2_DDR DDRC
|
||||
#define PC2_PWM NULL
|
||||
#define PC2_PWM nullptr
|
||||
|
||||
#undef PC3
|
||||
#define PC3_PIN PINC3
|
||||
#define PC3_RPORT PINC
|
||||
#define PC3_WPORT PORTC
|
||||
#define PC3_DDR DDRC
|
||||
#define PC3_PWM NULL
|
||||
#define PC3_PWM nullptr
|
||||
|
||||
#undef PC4
|
||||
#define PC4_PIN PINC4
|
||||
#define PC4_RPORT PINC
|
||||
#define PC4_WPORT PORTC
|
||||
#define PC4_DDR DDRC
|
||||
#define PC4_PWM NULL
|
||||
#define PC4_PWM nullptr
|
||||
|
||||
#undef PC5
|
||||
#define PC5_PIN PINC5
|
||||
#define PC5_RPORT PINC
|
||||
#define PC5_WPORT PORTC
|
||||
#define PC5_DDR DDRC
|
||||
#define PC5_PWM NULL
|
||||
#define PC5_PWM nullptr
|
||||
|
||||
#undef PC6
|
||||
#define PC6_PIN PINC6
|
||||
#define PC6_RPORT PINC
|
||||
#define PC6_WPORT PORTC
|
||||
#define PC6_DDR DDRC
|
||||
#define PC6_PWM NULL
|
||||
#define PC6_PWM nullptr
|
||||
|
||||
#undef PC7
|
||||
#define PC7_PIN PINC7
|
||||
#define PC7_RPORT PINC
|
||||
#define PC7_WPORT PORTC
|
||||
#define PC7_DDR DDRC
|
||||
#define PC7_PWM NULL
|
||||
#define PC7_PWM nullptr
|
||||
|
||||
#undef PD0
|
||||
#define PD0_PIN PIND0
|
||||
#define PD0_RPORT PIND
|
||||
#define PD0_WPORT PORTD
|
||||
#define PD0_DDR DDRD
|
||||
#define PD0_PWM NULL
|
||||
#define PD0_PWM nullptr
|
||||
|
||||
#undef PD1
|
||||
#define PD1_PIN PIND1
|
||||
#define PD1_RPORT PIND
|
||||
#define PD1_WPORT PORTD
|
||||
#define PD1_DDR DDRD
|
||||
#define PD1_PWM NULL
|
||||
#define PD1_PWM nullptr
|
||||
|
||||
#undef PD2
|
||||
#define PD2_PIN PIND2
|
||||
#define PD2_RPORT PIND
|
||||
#define PD2_WPORT PORTD
|
||||
#define PD2_DDR DDRD
|
||||
#define PD2_PWM NULL
|
||||
#define PD2_PWM nullptr
|
||||
|
||||
#undef PD3
|
||||
#define PD3_PIN PIND3
|
||||
#define PD3_RPORT PIND
|
||||
#define PD3_WPORT PORTD
|
||||
#define PD3_DDR DDRD
|
||||
#define PD3_PWM NULL
|
||||
#define PD3_PWM nullptr
|
||||
|
||||
#undef PD4
|
||||
#define PD4_PIN PIND4
|
||||
#define PD4_RPORT PIND
|
||||
#define PD4_WPORT PORTD
|
||||
#define PD4_DDR DDRD
|
||||
#define PD4_PWM NULL
|
||||
#define PD4_PWM nullptr
|
||||
|
||||
#undef PD5
|
||||
#define PD5_PIN PIND5
|
||||
#define PD5_RPORT PIND
|
||||
#define PD5_WPORT PORTD
|
||||
#define PD5_DDR DDRD
|
||||
#define PD5_PWM NULL
|
||||
#define PD5_PWM nullptr
|
||||
|
||||
#undef PD6
|
||||
#define PD6_PIN PIND6
|
||||
#define PD6_RPORT PIND
|
||||
#define PD6_WPORT PORTD
|
||||
#define PD6_DDR DDRD
|
||||
#define PD6_PWM OCR2B
|
||||
#define PD6_PWM &OCR2B
|
||||
|
||||
#undef PD7
|
||||
#define PD7_PIN PIND7
|
||||
#define PD7_RPORT PIND
|
||||
#define PD7_WPORT PORTD
|
||||
#define PD7_DDR DDRD
|
||||
#define PD7_PWM OCR2A
|
||||
#define PD7_PWM &OCR2A
|
||||
|
||||
@@ -45,325 +45,325 @@
|
||||
#define DIO0_PIN PIND0
|
||||
#define DIO0_RPORT PIND
|
||||
#define DIO0_WPORT PORTD
|
||||
#define DIO0_PWM NULL
|
||||
#define DIO0_PWM 0
|
||||
#define DIO0_DDR DDRD
|
||||
|
||||
#define DIO1_PIN PIND1
|
||||
#define DIO1_RPORT PIND
|
||||
#define DIO1_WPORT PORTD
|
||||
#define DIO1_PWM NULL
|
||||
#define DIO1_PWM 0
|
||||
#define DIO1_DDR DDRD
|
||||
|
||||
#define DIO2_PIN PIND2
|
||||
#define DIO2_RPORT PIND
|
||||
#define DIO2_WPORT PORTD
|
||||
#define DIO2_PWM NULL
|
||||
#define DIO2_PWM 0
|
||||
#define DIO2_DDR DDRD
|
||||
|
||||
#define DIO3_PIN PIND3
|
||||
#define DIO3_RPORT PIND
|
||||
#define DIO3_WPORT PORTD
|
||||
#define DIO3_PWM NULL
|
||||
#define DIO3_PWM 0
|
||||
#define DIO3_DDR DDRD
|
||||
|
||||
#define DIO4_PIN PIND4
|
||||
#define DIO4_RPORT PIND
|
||||
#define DIO4_WPORT PORTD
|
||||
#define DIO4_PWM NULL
|
||||
#define DIO4_PWM 0
|
||||
#define DIO4_DDR DDRD
|
||||
|
||||
#define DIO5_PIN PIND5
|
||||
#define DIO5_RPORT PIND
|
||||
#define DIO5_WPORT PORTD
|
||||
#define DIO5_PWM NULL
|
||||
#define DIO5_PWM 0
|
||||
#define DIO5_DDR DDRD
|
||||
|
||||
#define DIO6_PIN PIND6
|
||||
#define DIO6_RPORT PIND
|
||||
#define DIO6_WPORT PORTD
|
||||
#define DIO6_PWM NULL
|
||||
#define DIO6_PWM 0
|
||||
#define DIO6_DDR DDRD
|
||||
|
||||
#define DIO7_PIN PIND7
|
||||
#define DIO7_RPORT PIND
|
||||
#define DIO7_WPORT PORTD
|
||||
#define DIO7_PWM NULL
|
||||
#define DIO7_PWM 0
|
||||
#define DIO7_DDR DDRD
|
||||
|
||||
#define DIO8_PIN PINE0
|
||||
#define DIO8_RPORT PINE
|
||||
#define DIO8_WPORT PORTE
|
||||
#define DIO8_PWM NULL
|
||||
#define DIO8_PWM 0
|
||||
#define DIO8_DDR DDRE
|
||||
|
||||
#define DIO9_PIN PINE1
|
||||
#define DIO9_RPORT PINE
|
||||
#define DIO9_WPORT PORTE
|
||||
#define DIO9_PWM NULL
|
||||
#define DIO9_PWM 0
|
||||
#define DIO9_DDR DDRE
|
||||
|
||||
#define DIO10_PIN PINC0
|
||||
#define DIO10_RPORT PINC
|
||||
#define DIO10_WPORT PORTC
|
||||
#define DIO10_PWM NULL
|
||||
#define DIO10_PWM 0
|
||||
#define DIO10_DDR DDRC
|
||||
|
||||
#define DIO11_PIN PINC1
|
||||
#define DIO11_RPORT PINC
|
||||
#define DIO11_WPORT PORTC
|
||||
#define DIO11_PWM NULL
|
||||
#define DIO11_PWM 0
|
||||
#define DIO11_DDR DDRC
|
||||
|
||||
#define DIO12_PIN PINC2
|
||||
#define DIO12_RPORT PINC
|
||||
#define DIO12_WPORT PORTC
|
||||
#define DIO12_PWM NULL
|
||||
#define DIO12_PWM 0
|
||||
#define DIO12_DDR DDRC
|
||||
|
||||
#define DIO13_PIN PINC3
|
||||
#define DIO13_RPORT PINC
|
||||
#define DIO13_WPORT PORTC
|
||||
#define DIO13_PWM NULL
|
||||
#define DIO13_PWM 0
|
||||
#define DIO13_DDR DDRC
|
||||
|
||||
#define DIO14_PIN PINC4
|
||||
#define DIO14_RPORT PINC
|
||||
#define DIO14_WPORT PORTC
|
||||
#define DIO14_PWM NULL
|
||||
#define DIO14_PWM 0 // OC3C
|
||||
#define DIO14_DDR DDRC
|
||||
|
||||
#define DIO15_PIN PINC5
|
||||
#define DIO15_RPORT PINC
|
||||
#define DIO15_WPORT PORTC
|
||||
#define DIO15_PWM NULL
|
||||
#define DIO15_PWM 0 // OC3B
|
||||
#define DIO15_DDR DDRC
|
||||
|
||||
#define DIO16_PIN PINC6
|
||||
#define DIO16_RPORT PINC
|
||||
#define DIO16_WPORT PORTC
|
||||
#define DIO16_PWM NULL
|
||||
#define DIO16_PWM 0 // OC3A
|
||||
#define DIO16_DDR DDRC
|
||||
|
||||
#define DIO17_PIN PINC7
|
||||
#define DIO17_RPORT PINC
|
||||
#define DIO17_WPORT PORTC
|
||||
#define DIO17_PWM NULL
|
||||
#define DIO17_PWM 0
|
||||
#define DIO17_DDR DDRC
|
||||
|
||||
#define DIO18_PIN PINE6
|
||||
#define DIO18_RPORT PINE
|
||||
#define DIO18_WPORT PORTE
|
||||
#define DIO18_PWM NULL
|
||||
#define DIO18_PWM 0
|
||||
#define DIO18_DDR DDRE
|
||||
|
||||
#define DIO19_PIN PINE7
|
||||
#define DIO19_RPORT PINE
|
||||
#define DIO19_WPORT PORTE
|
||||
#define DIO19_PWM NULL
|
||||
#define DIO19_PWM 0
|
||||
#define DIO19_DDR DDRE
|
||||
|
||||
#define DIO20_PIN PINB0
|
||||
#define DIO20_RPORT PINB
|
||||
#define DIO20_WPORT PORTB
|
||||
#define DIO20_PWM NULL
|
||||
#define DIO20_PWM 0
|
||||
#define DIO20_DDR DDRB
|
||||
|
||||
#define DIO21_PIN PINB1
|
||||
#define DIO21_RPORT PINB
|
||||
#define DIO21_WPORT PORTB
|
||||
#define DIO21_PWM NULL
|
||||
#define DIO21_PWM 0
|
||||
#define DIO21_DDR DDRB
|
||||
|
||||
#define DIO22_PIN PINB2
|
||||
#define DIO22_RPORT PINB
|
||||
#define DIO22_WPORT PORTB
|
||||
#define DIO22_PWM NULL
|
||||
#define DIO22_PWM 0
|
||||
#define DIO22_DDR DDRB
|
||||
|
||||
#define DIO23_PIN PINB3
|
||||
#define DIO23_RPORT PINB
|
||||
#define DIO23_WPORT PORTB
|
||||
#define DIO23_PWM NULL
|
||||
#define DIO23_PWM 0
|
||||
#define DIO23_DDR DDRB
|
||||
|
||||
#define DIO24_PIN PINB4
|
||||
#define DIO24_RPORT PINB
|
||||
#define DIO24_WPORT PORTB
|
||||
#define DIO24_PWM NULL
|
||||
#define DIO24_PWM 0 // OC2A
|
||||
#define DIO24_DDR DDRB
|
||||
|
||||
#define DIO25_PIN PINB5
|
||||
#define DIO25_RPORT PINB
|
||||
#define DIO25_WPORT PORTB
|
||||
#define DIO25_PWM NULL
|
||||
#define DIO25_PWM 0 // OC1A
|
||||
#define DIO25_DDR DDRB
|
||||
|
||||
#define DIO26_PIN PINB6
|
||||
#define DIO26_RPORT PINB
|
||||
#define DIO26_WPORT PORTB
|
||||
#define DIO26_PWM NULL
|
||||
#define DIO26_PWM 0 // OC1B
|
||||
#define DIO26_DDR DDRB
|
||||
|
||||
#define DIO27_PIN PINB7
|
||||
#define DIO27_RPORT PINB
|
||||
#define DIO27_WPORT PORTB
|
||||
#define DIO27_PWM NULL
|
||||
#define DIO27_PWM 0 // OC1C
|
||||
#define DIO27_DDR DDRB
|
||||
|
||||
#define DIO28_PIN PINA0
|
||||
#define DIO28_RPORT PINA
|
||||
#define DIO28_WPORT PORTA
|
||||
#define DIO28_PWM NULL
|
||||
#define DIO28_PWM 0
|
||||
#define DIO28_DDR DDRA
|
||||
|
||||
#define DIO29_PIN PINA1
|
||||
#define DIO29_RPORT PINA
|
||||
#define DIO29_WPORT PORTA
|
||||
#define DIO29_PWM NULL
|
||||
#define DIO29_PWM 0
|
||||
#define DIO29_DDR DDRA
|
||||
|
||||
#define DIO30_PIN PINA2
|
||||
#define DIO30_RPORT PINA
|
||||
#define DIO30_WPORT PORTA
|
||||
#define DIO30_PWM NULL
|
||||
#define DIO30_PWM 0
|
||||
#define DIO30_DDR DDRA
|
||||
|
||||
#define DIO31_PIN PINA3
|
||||
#define DIO31_RPORT PINA
|
||||
#define DIO31_WPORT PORTA
|
||||
#define DIO31_PWM NULL
|
||||
#define DIO31_PWM 0
|
||||
#define DIO31_DDR DDRA
|
||||
|
||||
#define DIO32_PIN PINA4
|
||||
#define DIO32_RPORT PINA
|
||||
#define DIO32_WPORT PORTA
|
||||
#define DIO32_PWM NULL
|
||||
#define DIO32_PWM 0
|
||||
#define DIO32_DDR DDRA
|
||||
|
||||
#define DIO33_PIN PINA5
|
||||
#define DIO33_RPORT PINA
|
||||
#define DIO33_WPORT PORTA
|
||||
#define DIO33_PWM NULL
|
||||
#define DIO33_PWM 0
|
||||
#define DIO33_DDR DDRA
|
||||
|
||||
#define DIO34_PIN PINA6
|
||||
#define DIO34_RPORT PINA
|
||||
#define DIO34_WPORT PORTA
|
||||
#define DIO34_PWM NULL
|
||||
#define DIO34_PWM 0
|
||||
#define DIO34_DDR DDRA
|
||||
|
||||
#define DIO35_PIN PINA7
|
||||
#define DIO35_RPORT PINA
|
||||
#define DIO35_WPORT PORTA
|
||||
#define DIO35_PWM NULL
|
||||
#define DIO35_PWM 0
|
||||
#define DIO35_DDR DDRA
|
||||
|
||||
#define DIO36_PIN PINE4
|
||||
#define DIO36_RPORT PINE
|
||||
#define DIO36_WPORT PORTE
|
||||
#define DIO36_PWM NULL
|
||||
#define DIO36_PWM 0
|
||||
#define DIO36_DDR DDRE
|
||||
|
||||
#define DIO37_PIN PINE5
|
||||
#define DIO37_RPORT PINE
|
||||
#define DIO37_WPORT PORTE
|
||||
#define DIO37_PWM NULL
|
||||
#define DIO37_PWM 0
|
||||
#define DIO37_DDR DDRE
|
||||
|
||||
#define DIO38_PIN PINF0
|
||||
#define DIO38_RPORT PINF
|
||||
#define DIO38_WPORT PORTF
|
||||
#define DIO38_PWM NULL
|
||||
#define DIO38_PWM 0
|
||||
#define DIO38_DDR DDRF
|
||||
|
||||
#define DIO39_PIN PINF1
|
||||
#define DIO39_RPORT PINF
|
||||
#define DIO39_WPORT PORTF
|
||||
#define DIO39_PWM NULL
|
||||
#define DIO39_PWM 0
|
||||
#define DIO39_DDR DDRF
|
||||
|
||||
#define DIO40_PIN PINF2
|
||||
#define DIO40_RPORT PINF
|
||||
#define DIO40_WPORT PORTF
|
||||
#define DIO40_PWM NULL
|
||||
#define DIO40_PWM 0
|
||||
#define DIO40_DDR DDRF
|
||||
|
||||
#define DIO41_PIN PINF3
|
||||
#define DIO41_RPORT PINF
|
||||
#define DIO41_WPORT PORTF
|
||||
#define DIO41_PWM NULL
|
||||
#define DIO41_PWM 0
|
||||
#define DIO41_DDR DDRF
|
||||
|
||||
#define DIO42_PIN PINF4
|
||||
#define DIO42_RPORT PINF
|
||||
#define DIO42_WPORT PORTF
|
||||
#define DIO42_PWM NULL
|
||||
#define DIO42_PWM 0
|
||||
#define DIO42_DDR DDRF
|
||||
|
||||
#define DIO43_PIN PINF5
|
||||
#define DIO43_RPORT PINF
|
||||
#define DIO43_WPORT PORTF
|
||||
#define DIO43_PWM NULL
|
||||
#define DIO43_PWM 0
|
||||
#define DIO43_DDR DDRF
|
||||
|
||||
#define DIO44_PIN PINF6
|
||||
#define DIO44_RPORT PINF
|
||||
#define DIO44_WPORT PORTF
|
||||
#define DIO44_PWM NULL
|
||||
#define DIO44_PWM 0
|
||||
#define DIO44_DDR DDRF
|
||||
|
||||
#define DIO45_PIN PINF7
|
||||
#define DIO45_RPORT PINF
|
||||
#define DIO45_WPORT PORTF
|
||||
#define DIO45_PWM NULL
|
||||
#define DIO45_PWM 0
|
||||
#define DIO45_DDR DDRF
|
||||
|
||||
#define AIO0_PIN PINF0
|
||||
#define AIO0_RPORT PINF
|
||||
#define AIO0_WPORT PORTF
|
||||
#define AIO0_PWM NULL
|
||||
#define AIO0_PWM 0
|
||||
#define AIO0_DDR DDRF
|
||||
|
||||
#define AIO1_PIN PINF1
|
||||
#define AIO1_RPORT PINF
|
||||
#define AIO1_WPORT PORTF
|
||||
#define AIO1_PWM NULL
|
||||
#define AIO1_PWM 0
|
||||
#define AIO1_DDR DDRF
|
||||
|
||||
#define AIO2_PIN PINF2
|
||||
#define AIO2_RPORT PINF
|
||||
#define AIO2_WPORT PORTF
|
||||
#define AIO2_PWM NULL
|
||||
#define AIO2_PWM 0
|
||||
#define AIO2_DDR DDRF
|
||||
|
||||
#define AIO3_PIN PINF3
|
||||
#define AIO3_RPORT PINF
|
||||
#define AIO3_WPORT PORTF
|
||||
#define AIO3_PWM NULL
|
||||
#define AIO3_PWM 0
|
||||
#define AIO3_DDR DDRF
|
||||
|
||||
#define AIO4_PIN PINF4
|
||||
#define AIO4_RPORT PINF
|
||||
#define AIO4_WPORT PORTF
|
||||
#define AIO4_PWM NULL
|
||||
#define AIO4_PWM 0
|
||||
#define AIO4_DDR DDRF
|
||||
|
||||
#define AIO5_PIN PINF5
|
||||
#define AIO5_RPORT PINF
|
||||
#define AIO5_WPORT PORTF
|
||||
#define AIO5_PWM NULL
|
||||
#define AIO5_PWM 0
|
||||
#define AIO5_DDR DDRF
|
||||
|
||||
#define AIO6_PIN PINF6
|
||||
#define AIO6_RPORT PINF
|
||||
#define AIO6_WPORT PORTF
|
||||
#define AIO6_PWM NULL
|
||||
#define AIO6_PWM 0
|
||||
#define AIO6_DDR DDRF
|
||||
|
||||
#define AIO7_PIN PINF7
|
||||
#define AIO7_RPORT PINF
|
||||
#define AIO7_WPORT PORTF
|
||||
#define AIO7_PWM NULL
|
||||
#define AIO7_PWM 0
|
||||
#define AIO7_DDR DDRF
|
||||
|
||||
//-- Begin not supported by Teensyduino
|
||||
@@ -371,13 +371,13 @@
|
||||
#define DIO46_PIN PINE2
|
||||
#define DIO46_RPORT PINE
|
||||
#define DIO46_WPORT PORTE
|
||||
#define DIO46_PWM NULL
|
||||
#define DIO46_PWM 0
|
||||
#define DIO46_DDR DDRE
|
||||
|
||||
#define DIO47_PIN PINE3
|
||||
#define DIO47_RPORT PINE
|
||||
#define DIO47_WPORT PORTE
|
||||
#define DIO47_PWM NULL
|
||||
#define DIO47_PWM 0
|
||||
#define DIO47_DDR DDRE
|
||||
|
||||
#define TEENSY_E2 46
|
||||
@@ -389,300 +389,300 @@
|
||||
#define PA0_PIN PINA0
|
||||
#define PA0_RPORT PINA
|
||||
#define PA0_WPORT PORTA
|
||||
#define PA0_PWM NULL
|
||||
#define PA0_PWM 0
|
||||
#define PA0_DDR DDRA
|
||||
#undef PA1
|
||||
#define PA1_PIN PINA1
|
||||
#define PA1_RPORT PINA
|
||||
#define PA1_WPORT PORTA
|
||||
#define PA1_PWM NULL
|
||||
#define PA1_PWM 0
|
||||
#define PA1_DDR DDRA
|
||||
#undef PA2
|
||||
#define PA2_PIN PINA2
|
||||
#define PA2_RPORT PINA
|
||||
#define PA2_WPORT PORTA
|
||||
#define PA2_PWM NULL
|
||||
#define PA2_PWM 0
|
||||
#define PA2_DDR DDRA
|
||||
#undef PA3
|
||||
#define PA3_PIN PINA3
|
||||
#define PA3_RPORT PINA
|
||||
#define PA3_WPORT PORTA
|
||||
#define PA3_PWM NULL
|
||||
#define PA3_PWM 0
|
||||
#define PA3_DDR DDRA
|
||||
#undef PA4
|
||||
#define PA4_PIN PINA4
|
||||
#define PA4_RPORT PINA
|
||||
#define PA4_WPORT PORTA
|
||||
#define PA4_PWM NULL
|
||||
#define PA4_PWM 0
|
||||
#define PA4_DDR DDRA
|
||||
#undef PA5
|
||||
#define PA5_PIN PINA5
|
||||
#define PA5_RPORT PINA
|
||||
#define PA5_WPORT PORTA
|
||||
#define PA5_PWM NULL
|
||||
#define PA5_PWM 0
|
||||
#define PA5_DDR DDRA
|
||||
#undef PA6
|
||||
#define PA6_PIN PINA6
|
||||
#define PA6_RPORT PINA
|
||||
#define PA6_WPORT PORTA
|
||||
#define PA6_PWM NULL
|
||||
#define PA6_PWM 0
|
||||
#define PA6_DDR DDRA
|
||||
#undef PA7
|
||||
#define PA7_PIN PINA7
|
||||
#define PA7_RPORT PINA
|
||||
#define PA7_WPORT PORTA
|
||||
#define PA7_PWM NULL
|
||||
#define PA7_PWM 0
|
||||
#define PA7_DDR DDRA
|
||||
|
||||
#undef PB0
|
||||
#define PB0_PIN PINB0
|
||||
#define PB0_RPORT PINB
|
||||
#define PB0_WPORT PORTB
|
||||
#define PB0_PWM NULL
|
||||
#define PB0_PWM 0
|
||||
#define PB0_DDR DDRB
|
||||
#undef PB1
|
||||
#define PB1_PIN PINB1
|
||||
#define PB1_RPORT PINB
|
||||
#define PB1_WPORT PORTB
|
||||
#define PB1_PWM NULL
|
||||
#define PB1_PWM 0
|
||||
#define PB1_DDR DDRB
|
||||
#undef PB2
|
||||
#define PB2_PIN PINB2
|
||||
#define PB2_RPORT PINB
|
||||
#define PB2_WPORT PORTB
|
||||
#define PB2_PWM NULL
|
||||
#define PB2_PWM 0
|
||||
#define PB2_DDR DDRB
|
||||
#undef PB3
|
||||
#define PB3_PIN PINB3
|
||||
#define PB3_RPORT PINB
|
||||
#define PB3_WPORT PORTB
|
||||
#define PB3_PWM NULL
|
||||
#define PB3_PWM 0
|
||||
#define PB3_DDR DDRB
|
||||
#undef PB4
|
||||
#define PB4_PIN PINB4
|
||||
#define PB4_RPORT PINB
|
||||
#define PB4_WPORT PORTB
|
||||
#define PB4_PWM NULL
|
||||
#define PB4_PWM 0
|
||||
#define PB4_DDR DDRB
|
||||
#undef PB5
|
||||
#define PB5_PIN PINB5
|
||||
#define PB5_RPORT PINB
|
||||
#define PB5_WPORT PORTB
|
||||
#define PB5_PWM NULL
|
||||
#define PB5_PWM 0
|
||||
#define PB5_DDR DDRB
|
||||
#undef PB6
|
||||
#define PB6_PIN PINB6
|
||||
#define PB6_RPORT PINB
|
||||
#define PB6_WPORT PORTB
|
||||
#define PB6_PWM NULL
|
||||
#define PB6_PWM 0
|
||||
#define PB6_DDR DDRB
|
||||
#undef PB7
|
||||
#define PB7_PIN PINB7
|
||||
#define PB7_RPORT PINB
|
||||
#define PB7_WPORT PORTB
|
||||
#define PB7_PWM NULL
|
||||
#define PB7_PWM 0
|
||||
#define PB7_DDR DDRB
|
||||
|
||||
#undef PC0
|
||||
#define PC0_PIN PINC0
|
||||
#define PC0_RPORT PINC
|
||||
#define PC0_WPORT PORTC
|
||||
#define PC0_PWM NULL
|
||||
#define PC0_PWM 0
|
||||
#define PC0_DDR DDRC
|
||||
#undef PC1
|
||||
#define PC1_PIN PINC1
|
||||
#define PC1_RPORT PINC
|
||||
#define PC1_WPORT PORTC
|
||||
#define PC1_PWM NULL
|
||||
#define PC1_PWM 0
|
||||
#define PC1_DDR DDRC
|
||||
#undef PC2
|
||||
#define PC2_PIN PINC2
|
||||
#define PC2_RPORT PINC
|
||||
#define PC2_WPORT PORTC
|
||||
#define PC2_PWM NULL
|
||||
#define PC2_PWM 0
|
||||
#define PC2_DDR DDRC
|
||||
#undef PC3
|
||||
#define PC3_PIN PINC3
|
||||
#define PC3_RPORT PINC
|
||||
#define PC3_WPORT PORTC
|
||||
#define PC3_PWM NULL
|
||||
#define PC3_PWM 0
|
||||
#define PC3_DDR DDRC
|
||||
#undef PC4
|
||||
#define PC4_PIN PINC4
|
||||
#define PC4_RPORT PINC
|
||||
#define PC4_WPORT PORTC
|
||||
#define PC4_PWM NULL
|
||||
#define PC4_PWM 0
|
||||
#define PC4_DDR DDRC
|
||||
#undef PC5
|
||||
#define PC5_PIN PINC5
|
||||
#define PC5_RPORT PINC
|
||||
#define PC5_WPORT PORTC
|
||||
#define PC5_PWM NULL
|
||||
#define PC5_PWM 0
|
||||
#define PC5_DDR DDRC
|
||||
#undef PC6
|
||||
#define PC6_PIN PINC6
|
||||
#define PC6_RPORT PINC
|
||||
#define PC6_WPORT PORTC
|
||||
#define PC6_PWM NULL
|
||||
#define PC6_PWM 0
|
||||
#define PC6_DDR DDRC
|
||||
#undef PC7
|
||||
#define PC7_PIN PINC7
|
||||
#define PC7_RPORT PINC
|
||||
#define PC7_WPORT PORTC
|
||||
#define PC7_PWM NULL
|
||||
#define PC7_PWM 0
|
||||
#define PC7_DDR DDRC
|
||||
|
||||
#undef PD0
|
||||
#define PD0_PIN PIND0
|
||||
#define PD0_RPORT PIND
|
||||
#define PD0_WPORT PORTD
|
||||
#define PD0_PWM NULL
|
||||
#define PD0_PWM 0 // OC0B
|
||||
#define PD0_DDR DDRD
|
||||
#undef PD1
|
||||
#define PD1_PIN PIND1
|
||||
#define PD1_RPORT PIND
|
||||
#define PD1_WPORT PORTD
|
||||
#define PD1_PWM NULL
|
||||
#define PD1_PWM 0 // OC2B
|
||||
#define PD1_DDR DDRD
|
||||
#undef PD2
|
||||
#define PD2_PIN PIND2
|
||||
#define PD2_RPORT PIND
|
||||
#define PD2_WPORT PORTD
|
||||
#define PD2_PWM NULL
|
||||
#define PD2_PWM 0
|
||||
#define PD2_DDR DDRD
|
||||
#undef PD3
|
||||
#define PD3_PIN PIND3
|
||||
#define PD3_RPORT PIND
|
||||
#define PD3_WPORT PORTD
|
||||
#define PD3_PWM NULL
|
||||
#define PD3_PWM 0
|
||||
#define PD3_DDR DDRD
|
||||
#undef PD4
|
||||
#define PD4_PIN PIND4
|
||||
#define PD4_RPORT PIND
|
||||
#define PD4_WPORT PORTD
|
||||
#define PD4_PWM NULL
|
||||
#define PD4_PWM 0
|
||||
#define PD4_DDR DDRD
|
||||
#undef PD5
|
||||
#define PD5_PIN PIND5
|
||||
#define PD5_RPORT PIND
|
||||
#define PD5_WPORT PORTD
|
||||
#define PD5_PWM NULL
|
||||
#define PD5_PWM 0
|
||||
#define PD5_DDR DDRD
|
||||
#undef PD6
|
||||
#define PD6_PIN PIND6
|
||||
#define PD6_RPORT PIND
|
||||
#define PD6_WPORT PORTD
|
||||
#define PD6_PWM NULL
|
||||
#define PD6_PWM 0
|
||||
#define PD6_DDR DDRD
|
||||
#undef PD7
|
||||
#define PD7_PIN PIND7
|
||||
#define PD7_RPORT PIND
|
||||
#define PD7_WPORT PORTD
|
||||
#define PD7_PWM NULL
|
||||
#define PD7_PWM 0
|
||||
#define PD7_DDR DDRD
|
||||
|
||||
#undef PE0
|
||||
#define PE0_PIN PINE0
|
||||
#define PE0_RPORT PINE
|
||||
#define PE0_WPORT PORTE
|
||||
#define PE0_PWM NULL
|
||||
#define PE0_PWM 0
|
||||
#define PE0_DDR DDRE
|
||||
#undef PE1
|
||||
#define PE1_PIN PINE1
|
||||
#define PE1_RPORT PINE
|
||||
#define PE1_WPORT PORTE
|
||||
#define PE1_PWM NULL
|
||||
#define PE1_PWM 0
|
||||
#define PE1_DDR DDRE
|
||||
#undef PE2
|
||||
#define PE2_PIN PINE2
|
||||
#define PE2_RPORT PINE
|
||||
#define PE2_WPORT PORTE
|
||||
#define PE2_PWM NULL
|
||||
#define PE2_PWM 0
|
||||
#define PE2_DDR DDRE
|
||||
#undef PE3
|
||||
#define PE3_PIN PINE3
|
||||
#define PE3_RPORT PINE
|
||||
#define PE3_WPORT PORTE
|
||||
#define PE3_PWM NULL
|
||||
#define PE3_PWM 0
|
||||
#define PE3_DDR DDRE
|
||||
#undef PE4
|
||||
#define PE4_PIN PINE4
|
||||
#define PE4_RPORT PINE
|
||||
#define PE4_WPORT PORTE
|
||||
#define PE4_PWM NULL
|
||||
#define PE4_PWM 0
|
||||
#define PE4_DDR DDRE
|
||||
#undef PE5
|
||||
#define PE5_PIN PINE5
|
||||
#define PE5_RPORT PINE
|
||||
#define PE5_WPORT PORTE
|
||||
#define PE5_PWM NULL
|
||||
#define PE5_PWM 0
|
||||
#define PE5_DDR DDRE
|
||||
#undef PE6
|
||||
#define PE6_PIN PINE6
|
||||
#define PE6_RPORT PINE
|
||||
#define PE6_WPORT PORTE
|
||||
#define PE6_PWM NULL
|
||||
#define PE6_PWM 0
|
||||
#define PE6_DDR DDRE
|
||||
#undef PE7
|
||||
#define PE7_PIN PINE7
|
||||
#define PE7_RPORT PINE
|
||||
#define PE7_WPORT PORTE
|
||||
#define PE7_PWM NULL
|
||||
#define PE7_PWM 0
|
||||
#define PE7_DDR DDRE
|
||||
|
||||
#undef PF0
|
||||
#define PF0_PIN PINF0
|
||||
#define PF0_RPORT PINF
|
||||
#define PF0_WPORT PORTF
|
||||
#define PF0_PWM NULL
|
||||
#define PF0_PWM 0
|
||||
#define PF0_DDR DDRF
|
||||
#undef PF1
|
||||
#define PF1_PIN PINF1
|
||||
#define PF1_RPORT PINF
|
||||
#define PF1_WPORT PORTF
|
||||
#define PF1_PWM NULL
|
||||
#define PF1_PWM 0
|
||||
#define PF1_DDR DDRF
|
||||
#undef PF2
|
||||
#define PF2_PIN PINF2
|
||||
#define PF2_RPORT PINF
|
||||
#define PF2_WPORT PORTF
|
||||
#define PF2_PWM NULL
|
||||
#define PF2_PWM 0
|
||||
#define PF2_DDR DDRF
|
||||
#undef PF3
|
||||
#define PF3_PIN PINF3
|
||||
#define PF3_RPORT PINF
|
||||
#define PF3_WPORT PORTF
|
||||
#define PF3_PWM NULL
|
||||
#define PF3_PWM 0
|
||||
#define PF3_DDR DDRF
|
||||
#undef PF4
|
||||
#define PF4_PIN PINF4
|
||||
#define PF4_RPORT PINF
|
||||
#define PF4_WPORT PORTF
|
||||
#define PF4_PWM NULL
|
||||
#define PF4_PWM 0
|
||||
#define PF4_DDR DDRF
|
||||
#undef PF5
|
||||
#define PF5_PIN PINF5
|
||||
#define PF5_RPORT PINF
|
||||
#define PF5_WPORT PORTF
|
||||
#define PF5_PWM NULL
|
||||
#define PF5_PWM 0
|
||||
#define PF5_DDR DDRF
|
||||
#undef PF6
|
||||
#define PF6_PIN PINF6
|
||||
#define PF6_RPORT PINF
|
||||
#define PF6_WPORT PORTF
|
||||
#define PF6_PWM NULL
|
||||
#define PF6_PWM 0
|
||||
#define PF6_DDR DDRF
|
||||
#undef PF7
|
||||
#define PF7_PIN PINF7
|
||||
#define PF7_RPORT PINF
|
||||
#define PF7_WPORT PORTF
|
||||
#define PF7_PWM NULL
|
||||
#define PF7_PWM 0
|
||||
#define PF7_DDR DDRF
|
||||
|
||||
|
||||
/**
|
||||
* some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
||||
* do not function the same as the other Arduino extensions
|
||||
* Some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
||||
* do not function the same as the other Arduino extensions.
|
||||
*/
|
||||
|
||||
//digitalPinToTimer(pin) function works like Arduino but Timers are not defined
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#ifdef FASTIO_EXT_START
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
|
||||
#define _IS_EXT(P) WITHIN(P, FASTIO_EXT_START, FASTIO_EXT_END)
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
#define _IS_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
|
||||
#define _IS_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
|
||||
#define _HAS_TIMER(IO) DIO ## IO ## _PWM
|
||||
#define _HAS_TIMER(IO) bool(DIO ## IO ## _PWM)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#ifdef FASTIO_EXT_START
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
#if HAS_SERVOS
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/servo.h"
|
||||
#include "../shared/servo_private.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Based on u8g_com_st7920_hw_spi.c
|
||||
*
|
||||
* Universal 8bit Graphics Library
|
||||
*
|
||||
* Copyright (c) 2011, olikraus@gmail.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO) && !defined(ARDUINO_ARCH_STM32) && !defined(ARDUINO_ARCH_SAM)
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
|
||||
uint8_t u8g_bitData, u8g_bitNotData;
|
||||
uint8_t u8g_bitClock, u8g_bitNotClock;
|
||||
volatile uint8_t *u8g_outData;
|
||||
volatile uint8_t *u8g_outClock;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin) {
|
||||
u8g_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
u8g_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
u8g_bitData = digitalPinToBitMask(dataPin);
|
||||
u8g_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
u8g_bitNotClock = u8g_bitClock;
|
||||
u8g_bitNotClock ^= 0xFF;
|
||||
|
||||
u8g_bitNotData = u8g_bitData;
|
||||
u8g_bitNotData ^= 0xFF;
|
||||
}
|
||||
|
||||
void U8G_spiSend_sw_AVR_mode_0(uint8_t val) {
|
||||
uint8_t bitData = u8g_bitData;
|
||||
uint8_t bitNotData = u8g_bitNotData;
|
||||
uint8_t bitClock = u8g_bitClock;
|
||||
uint8_t bitNotClock = u8g_bitNotClock;
|
||||
volatile uint8_t *outData = u8g_outData;
|
||||
volatile uint8_t *outClock = u8g_outClock;
|
||||
U8G_ATOMIC_START();
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
if (val & 0x80)
|
||||
*outData |= bitData;
|
||||
else
|
||||
*outData &= bitNotData;
|
||||
*outClock |= bitClock;
|
||||
val <<= 1;
|
||||
*outClock &= bitNotClock;
|
||||
}
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
void U8G_spiSend_sw_AVR_mode_3(uint8_t val) {
|
||||
uint8_t bitData = u8g_bitData;
|
||||
uint8_t bitNotData = u8g_bitNotData;
|
||||
uint8_t bitClock = u8g_bitClock;
|
||||
uint8_t bitNotClock = u8g_bitNotClock;
|
||||
volatile uint8_t *outData = u8g_outData;
|
||||
volatile uint8_t *outClock = u8g_outClock;
|
||||
U8G_ATOMIC_START();
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
*outClock &= bitNotClock;
|
||||
if (val & 0x80)
|
||||
*outData |= bitData;
|
||||
else
|
||||
*outData &= bitNotData;
|
||||
*outClock |= bitClock;
|
||||
val <<= 1;
|
||||
}
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
#define U8G_spiSend_sw_AVR U8G_spiSend_sw_AVR_mode_3
|
||||
#else
|
||||
#define U8G_spiSend_sw_AVR U8G_spiSend_sw_AVR_mode_0
|
||||
#endif
|
||||
|
||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, 0);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, 0);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ENABLED(FYSETC_MINI_12864) // 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
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else {
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, !arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
U8G_spiSend_sw_AVR(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
U8G_spiSend_sw_AVR(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
U8G_spiSend_sw_AVR(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM, SPI_EEPROM)
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
|
||||
#define EEPROMSize 4096
|
||||
#define PagesPerGroup 128
|
||||
|
||||
@@ -248,7 +248,7 @@ const G2_PinDescription G2_g_APinDescription[] = {
|
||||
{ PIOB, PIO_PB15A_CANRX1|PIO_PB14A_CANTX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
|
||||
// END
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }
|
||||
{ nullptr, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }
|
||||
};
|
||||
|
||||
// This section replaces the FASTIO definitions of pins 34-41
|
||||
|
||||
@@ -29,16 +29,15 @@
|
||||
|
||||
#define CPU_32_BIT
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio_Due.h"
|
||||
#include "watchdog_Due.h"
|
||||
#include "HAL_timers_Due.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Serial ports
|
||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||
#error "SERIAL_PORT must be from -1 to 3"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
practice, we need alignment to 256 bytes to make this work in all
|
||||
cases */
|
||||
__attribute__ ((aligned(256)))
|
||||
static DeviceVectors ram_tab = { NULL };
|
||||
static DeviceVectors ram_tab = { nullptr };
|
||||
|
||||
/**
|
||||
* This function checks if the exception/interrupt table is already in SRAM or not.
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#if HAS_SERVOS
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/servo.h"
|
||||
#include "../shared/servo_private.h"
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* Translation of routines & variables used by pinsDebug.h
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
|
||||
/**
|
||||
* Due/Marlin quirks
|
||||
|
||||
@@ -66,20 +66,20 @@
|
||||
|
||||
#include "../../Marlin.h"
|
||||
|
||||
#define SPI_FULL_SPEED 0
|
||||
#define SPI_HALF_SPEED 1
|
||||
#define SPI_QUARTER_SPEED 2
|
||||
#define SPI_EIGHTH_SPEED 3
|
||||
#define SPI_FULL_SPEED 0
|
||||
#define SPI_HALF_SPEED 1
|
||||
#define SPI_QUARTER_SPEED 2
|
||||
#define SPI_EIGHTH_SPEED 3
|
||||
#define SPI_SIXTEENTH_SPEED 4
|
||||
#define SPI_SPEED_5 5
|
||||
#define SPI_SPEED_6 6
|
||||
#define SPI_SPEED_5 5
|
||||
#define SPI_SPEED_6 6
|
||||
|
||||
void spiBegin();
|
||||
void spiInit(uint8_t spiRate);
|
||||
void spiSend(uint8_t b);
|
||||
void spiSend(const uint8_t* buf, size_t n);
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
#include "fastio_Due.h"
|
||||
|
||||
void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
|
||||
|
||||
@@ -59,10 +59,11 @@
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
|
||||
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
|
||||
PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
|
||||
g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Based on u8g_com_std_sw_spi.c
|
||||
*
|
||||
* Universal 8bit Graphics Library
|
||||
*
|
||||
* Copyright (c) 2015, olikraus@gmail.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAM
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_GRAPHICAL_LCD && !ENABLED(U8GLIB_ST7920)
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
|
||||
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index);
|
||||
void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level);
|
||||
void U8G_spiSend_sw_DUE_mode_0(uint8_t val);
|
||||
void U8G_spiSend_sw_DUE_mode_3(uint8_t val);
|
||||
|
||||
Pio *SCK_pPio, *MOSI_pPio;
|
||||
uint32_t SCK_dwMask, MOSI_dwMask;
|
||||
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
#define U8G_spiSend_sw_DUE U8G_spiSend_sw_DUE_mode_3
|
||||
#else
|
||||
#define U8G_spiSend_sw_DUE U8G_spiSend_sw_DUE_mode_0
|
||||
#endif
|
||||
|
||||
uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_INIT:
|
||||
SCK_pPio = g_APinDescription[u8g->pin_list[U8G_PI_SCK]].pPort;
|
||||
SCK_dwMask = g_APinDescription[u8g->pin_list[U8G_PI_SCK]].ulPin;
|
||||
MOSI_pPio = g_APinDescription[u8g->pin_list[U8G_PI_MOSI]].pPort;
|
||||
MOSI_dwMask = g_APinDescription[u8g->pin_list[U8G_PI_MOSI]].ulPin;
|
||||
u8g_SetPIOutput_DUE(u8g, U8G_PI_SCK);
|
||||
u8g_SetPIOutput_DUE(u8g, U8G_PI_MOSI);
|
||||
u8g_SetPIOutput_DUE(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput_DUE(u8g, U8G_PI_A0);
|
||||
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPIOutput_DUE(u8g, U8G_PI_RESET);
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0);
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_MOSI, 0);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel_DUE(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ENABLED(FYSETC_MINI_12864) // 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
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 1); //set SCK to mode 3 idle state before CS goes active
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else {
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, HIGH);
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); //set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, !arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
U8G_spiSend_sw_DUE(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
U8G_spiSend_sw_DUE(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
U8G_spiSend_sw_DUE(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Based on u8g_com_st7920_hw_spi.c
|
||||
*
|
||||
* Universal 8bit Graphics Library
|
||||
*
|
||||
* Copyright (c) 2011, olikraus@gmail.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAM
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\inc\MarlinConfigPre.h
|
||||
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\HAL\HAL_DUE\u8g_com_HAL_DUE_sw_spi_shared.cpp
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
|
||||
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
|
||||
PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
|
||||
g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT
|
||||
}
|
||||
|
||||
void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
|
||||
volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort;
|
||||
uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin;
|
||||
if (level) port->PIO_SODR = mask; else port->PIO_CODR = mask;
|
||||
}
|
||||
|
||||
extern Pio *SCK_pPio, *MOSI_pPio;
|
||||
extern uint32_t SCK_dwMask, MOSI_dwMask;
|
||||
|
||||
void U8G_spiSend_sw_DUE_mode_0(uint8_t val) { // 800KHz
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
if (val & 0x80)
|
||||
MOSI_pPio->PIO_SODR = MOSI_dwMask;
|
||||
else
|
||||
MOSI_pPio->PIO_CODR = MOSI_dwMask;
|
||||
DELAY_NS(48);
|
||||
SCK_pPio->PIO_SODR = SCK_dwMask;
|
||||
DELAY_NS(905); // 762 dead, 810 garbage, 858/0 900kHz, 905/1 825k, 953/1 800k, 1000/2 725KHz
|
||||
val <<= 1;
|
||||
SCK_pPio->PIO_CODR = SCK_dwMask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void U8G_spiSend_sw_DUE_mode_3(uint8_t val) { // 800KHz
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
SCK_pPio->PIO_CODR = SCK_dwMask;
|
||||
DELAY_NS(48);
|
||||
if (val & 0x80)
|
||||
MOSI_pPio->PIO_SODR = MOSI_dwMask;
|
||||
else
|
||||
MOSI_pPio->PIO_CODR = MOSI_dwMask;
|
||||
SCK_pPio->PIO_SODR = SCK_dwMask;
|
||||
DELAY_NS(905); // 762 dead, 810 garbage, 858/0 900kHz, 905/1 825k, 953/1 800k, 1000/2 725KHz
|
||||
val <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
@@ -30,19 +30,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// these are going to be re-defined in Arduino.h
|
||||
#undef DISABLED
|
||||
#undef M_PI
|
||||
#undef _BV
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// revert back to the correct (old) definition
|
||||
#undef DISABLED
|
||||
#define DISABLED(V...) DO(DIS,&&,V)
|
||||
// re-define in case Arduino.h has been skipped due to earlier inclusion (i.e. in Marlin\src\HAL\HAL_ESP32\i2s.cpp)
|
||||
#define _BV(b) (1UL << (b))
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ static timg_dev_t *TG[2] = {&TIMERG0, &TIMERG1};
|
||||
const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = {
|
||||
{ TIMER_GROUP_0, TIMER_0, STEPPER_TIMER_PRESCALE, stepTC_Handler }, // 0 - Stepper
|
||||
{ TIMER_GROUP_0, TIMER_1, TEMP_TIMER_PRESCALE, tempTC_Handler }, // 1 - Temperature
|
||||
{ TIMER_GROUP_1, TIMER_0, 1, NULL }, // 2
|
||||
{ TIMER_GROUP_1, TIMER_1, 1, NULL }, // 3
|
||||
{ TIMER_GROUP_1, TIMER_0, 1, nullptr }, // 2
|
||||
{ TIMER_GROUP_1, TIMER_1, 1, nullptr }, // 3
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -132,7 +132,7 @@ void HAL_timer_start(const uint8_t timer_num, uint32_t frequency) {
|
||||
timer_enable_intr(timer.group, timer.idx);
|
||||
|
||||
// TODO need to deal with timer_group1_isr
|
||||
timer_isr_register(timer.group, timer.idx, timer_group0_isr, (void*)timer.idx, NULL, NULL);
|
||||
timer_isr_register(timer.group, timer.idx, timer_group0_isr, (void*)timer.idx, ESP_INTR_FLAG_INTRDISABLED, nullptr);
|
||||
|
||||
timer_start(timer.group, timer.idx);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,9 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
// replace that with the proper imports, then cleanup workarounds in Marlin\src\HAL\HAL_ESP32\HAL.h
|
||||
#include <Arduino.h>
|
||||
// revert back to the correct definition
|
||||
#undef DISABLED
|
||||
#define DISABLED(V...) DO(DIS,&&,V)
|
||||
|
||||
#include "i2s.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../../core/macros.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "rom/lldesc.h"
|
||||
@@ -187,22 +183,22 @@ int i2s_init() {
|
||||
|
||||
// Allocate the array of pointers to the buffers
|
||||
dma.buffers = (uint32_t **)malloc(sizeof(uint32_t*) * DMA_BUF_COUNT);
|
||||
if (dma.buffers == NULL) return -1;
|
||||
if (dma.buffers == nullptr) return -1;
|
||||
|
||||
// Allocate each buffer that can be used by the DMA controller
|
||||
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
||||
dma.buffers[buf_idx] = (uint32_t*) heap_caps_calloc(1, DMA_BUF_LEN, MALLOC_CAP_DMA);
|
||||
if (dma.buffers[buf_idx] == NULL) return -1;
|
||||
if (dma.buffers[buf_idx] == nullptr) return -1;
|
||||
}
|
||||
|
||||
// Allocate the array of DMA descriptors
|
||||
dma.desc = (lldesc_t**) malloc(sizeof(lldesc_t*) * DMA_BUF_COUNT);
|
||||
if (dma.desc == NULL) return -1;
|
||||
if (dma.desc == nullptr) return -1;
|
||||
|
||||
// Allocate each DMA descriptor that will be used by the DMA controller
|
||||
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
||||
dma.desc[buf_idx] = (lldesc_t*) heap_caps_malloc(sizeof(lldesc_t), MALLOC_CAP_DMA);
|
||||
if (dma.desc[buf_idx] == NULL) return -1;
|
||||
if (dma.desc[buf_idx] == nullptr) return -1;
|
||||
}
|
||||
|
||||
// Initialize
|
||||
@@ -301,11 +297,11 @@ int i2s_init() {
|
||||
|
||||
// Allocate and Enable the I2S interrupt
|
||||
intr_handle_t i2s_isr_handle;
|
||||
esp_intr_alloc(ETS_I2S0_INTR_SOURCE, 0, i2s_intr_handler_default, NULL, &i2s_isr_handle);
|
||||
esp_intr_alloc(ETS_I2S0_INTR_SOURCE, 0, i2s_intr_handler_default, nullptr, &i2s_isr_handle);
|
||||
esp_intr_enable(i2s_isr_handle);
|
||||
|
||||
// Create the task that will feed the buffer
|
||||
xTaskCreate(stepperTask, "StepperTask", 10000, NULL, 1, NULL);
|
||||
xTaskCreate(stepperTask, "StepperTask", 10000, nullptr, 1, nullptr);
|
||||
|
||||
// Route the i2s pins to the appropriate GPIO
|
||||
gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// current value of the outputs provided over i2s
|
||||
extern uint32_t i2s_port_data;
|
||||
|
||||
|
||||
@@ -47,16 +47,15 @@ uint8_t _getc();
|
||||
//arduino: Print.h
|
||||
#define DEC 10
|
||||
#define HEX 16
|
||||
#define OCT 8
|
||||
#define BIN 2
|
||||
#define OCT 8
|
||||
#define BIN 2
|
||||
//arduino: binary.h (weird defines)
|
||||
#define B01 1
|
||||
#define B10 2
|
||||
|
||||
#include "hardware/Clock.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio.h"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Fast I/O Routines for X86_64
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
#include <pinmapping.h>
|
||||
|
||||
#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1)
|
||||
|
||||
@@ -51,7 +51,7 @@ void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
|
||||
sa.sa_flags = SA_SIGINFO;
|
||||
sa.sa_sigaction = Timer::handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
if (sigaction(SIGRTMIN, &sa, NULL) == -1) {
|
||||
if (sigaction(SIGRTMIN, &sa, nullptr) == -1) {
|
||||
return; // todo: handle error
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ void Timer::start(uint32_t frequency) {
|
||||
}
|
||||
|
||||
void Timer::enable() {
|
||||
if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == -1) {
|
||||
if (sigprocmask(SIG_UNBLOCK, &mask, nullptr) == -1) {
|
||||
return; // todo: handle error
|
||||
}
|
||||
active = true;
|
||||
@@ -82,7 +82,7 @@ void Timer::enable() {
|
||||
}
|
||||
|
||||
void Timer::disable() {
|
||||
if (sigprocmask(SIG_SETMASK, &mask, NULL) == -1) {
|
||||
if (sigprocmask(SIG_SETMASK, &mask, nullptr) == -1) {
|
||||
return; // todo: handle error
|
||||
}
|
||||
active = false;
|
||||
@@ -102,7 +102,7 @@ void Timer::setCompare(uint32_t compare) {
|
||||
its.it_interval.tv_sec = its.it_value.tv_sec;
|
||||
its.it_interval.tv_nsec = its.it_value.tv_nsec;
|
||||
|
||||
if (timer_settime(timerid, 0, &its, NULL) == -1) {
|
||||
if (timer_settime(timerid, 0, &its, nullptr) == -1) {
|
||||
printf("timer(%ld) failed, compare: %d(%ld)\n", getID(), compare, its.it_value.tv_nsec);
|
||||
return; // todo: handle error
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ int main(void) {
|
||||
|
||||
#if NUM_SERIAL > 0
|
||||
MYSERIAL0.begin(BAUDRATE);
|
||||
SERIAL_PRINTF("x86_64 Initialised\n");
|
||||
SERIAL_ECHOLNPGM("x86_64 Initialized");
|
||||
SERIAL_FLUSHTX();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ char filename[] = "eeprom.dat";
|
||||
bool PersistentStore::access_start() {
|
||||
const char eeprom_erase_value = 0xFF;
|
||||
FILE * eeprom_file = fopen(filename, "rb");
|
||||
if (eeprom_file == NULL) return false;
|
||||
if (eeprom_file == nullptr) return false;
|
||||
|
||||
fseek(eeprom_file, 0L, SEEK_END);
|
||||
std::size_t file_size = ftell(eeprom_file);
|
||||
@@ -54,7 +54,7 @@ bool PersistentStore::access_start() {
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
FILE * eeprom_file = fopen(filename, "wb");
|
||||
if (eeprom_file == NULL) return false;
|
||||
if (eeprom_file == nullptr) return false;
|
||||
fwrite(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file);
|
||||
fclose(eeprom_file);
|
||||
return true;
|
||||
|
||||
@@ -37,18 +37,18 @@ void HAL_init();
|
||||
|
||||
extern "C" volatile millis_t _millis;
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <pinmapping.h>
|
||||
#include <CDCSerial.h>
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio.h"
|
||||
#include <adc.h>
|
||||
#include "watchdog.h"
|
||||
#include "HAL_timers.h"
|
||||
#include "MarlinSerial.h"
|
||||
|
||||
#include <adc.h>
|
||||
#include <pinmapping.h>
|
||||
#include <CDCSerial.h>
|
||||
|
||||
//
|
||||
// Default graphical display delays
|
||||
//
|
||||
@@ -147,8 +147,8 @@ using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
|
||||
#define HAL_READ_ADC() FilteredADC::get_result()
|
||||
#define HAL_ADC_READY() FilteredADC::finished_conversion()
|
||||
|
||||
// A grace period for the ADC readings to stabilize before they start causing thermal protection errors.
|
||||
#define THERMAL_PROTECTION_GRACE_PERIOD 800
|
||||
// A grace period to allow ADC readings to stabilize, preventing false alarms
|
||||
#define THERMAL_PROTECTION_GRACE_PERIOD 1000
|
||||
|
||||
// Parse a G-code word into a pin index
|
||||
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* For TARGET LPC1768
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../shared/Marduino.h"
|
||||
|
||||
#define PWM_PIN(P) true // all pins are PWM capable
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
@@ -59,17 +59,17 @@
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
||||
#include <U8glib.h>
|
||||
#include "SoftwareSPI.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <algorithm>
|
||||
#include <LPC17xx.h>
|
||||
#include <gpio.h>
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <U8glib.h>
|
||||
|
||||
uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) {
|
||||
|
||||
@@ -158,7 +158,19 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, !arg_val);
|
||||
#if ENABLED(FYSETC_MINI_12864) // 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
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else {
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, HIGH);
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, !arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
@@ -192,5 +204,4 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
}
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# if target_filename is found then that drive is used
|
||||
# else if target_drive is found then that drive is used
|
||||
#
|
||||
from __future__ import print_function
|
||||
|
||||
target_filename = "FIRMWARE.CUR"
|
||||
target_drive = "REARM"
|
||||
@@ -12,11 +13,11 @@ import platform
|
||||
current_OS = platform.system()
|
||||
Import("env")
|
||||
|
||||
def detect_error(e):
|
||||
print '\nUnable to find destination disk (' + e + ')\n' \
|
||||
def print_error(e):
|
||||
print('\nUnable to find destination disk (' + e + ')\n' \
|
||||
'Please select it in platformio.ini using the upload_port keyword ' \
|
||||
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html)\n' \
|
||||
'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n'
|
||||
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
|
||||
'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
|
||||
|
||||
try:
|
||||
if current_OS == 'Windows':
|
||||
@@ -63,9 +64,9 @@ try:
|
||||
env.Replace(
|
||||
UPLOAD_PORT=upload_disk
|
||||
)
|
||||
print 'upload disk: ', upload_disk
|
||||
print('upload disk: ', upload_disk)
|
||||
else:
|
||||
detect_error('Autodetect Error')
|
||||
print_error('Autodetect Error')
|
||||
|
||||
elif current_OS == 'Linux':
|
||||
#
|
||||
@@ -100,9 +101,9 @@ try:
|
||||
UPLOAD_FLAGS="-P$UPLOAD_PORT",
|
||||
UPLOAD_PORT=upload_disk
|
||||
)
|
||||
print 'upload disk: ', upload_disk
|
||||
print('upload disk: ', upload_disk)
|
||||
else:
|
||||
detect_error('Autodetect Error')
|
||||
print_error('Autodetect Error')
|
||||
|
||||
elif current_OS == 'Darwin': # MAC
|
||||
#
|
||||
@@ -133,9 +134,9 @@ try:
|
||||
env.Replace(
|
||||
UPLOAD_PORT=upload_disk
|
||||
)
|
||||
print '\nupload disk: ', upload_disk, '\n'
|
||||
print('\nupload disk: ', upload_disk, '\n')
|
||||
else:
|
||||
detect_error('Autodetect Error')
|
||||
print_error('Autodetect Error')
|
||||
|
||||
except Exception as e:
|
||||
detect_error(str(e))
|
||||
print_error(str(e))
|
||||
|
||||
@@ -28,20 +28,20 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#ifdef USBCON
|
||||
#include <USBSerial.h>
|
||||
#endif
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio_STM32.h"
|
||||
#include "watchdog_STM32.h"
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef USBCON
|
||||
#include <USBSerial.h>
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Defines
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -270,7 +270,7 @@ void HAL_adc_init(void) {
|
||||
adc.calibrate();
|
||||
adc.setSampleRate(ADC_SMPR_41_5); // ?
|
||||
adc.setPins(adc_pins, ADC_PIN_COUNT);
|
||||
adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), (void (*)())NULL);
|
||||
adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), nullptr);
|
||||
adc.setScanMode();
|
||||
adc.setContinuous();
|
||||
adc.startConversion();
|
||||
@@ -279,6 +279,7 @@ void HAL_adc_init(void) {
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
TEMP_PINS pin_index;
|
||||
switch (adc_pin) {
|
||||
default: return;
|
||||
#if HAS_TEMP_ADC_0
|
||||
case TEMP_0_PIN: pin_index = TEMP_0; break;
|
||||
#endif
|
||||
@@ -310,8 +311,6 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
HAL_adc_result = (HAL_adc_results[(int)pin_index] >> 2) & 0x3FF; // shift to get 10 bits only.
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result(void) {
|
||||
return HAL_adc_result;
|
||||
}
|
||||
uint16_t HAL_adc_get_result(void) { return HAL_adc_result; }
|
||||
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -36,14 +36,8 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <stdint.h>
|
||||
#include <util/atomic.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
@@ -51,6 +45,10 @@
|
||||
#include "watchdog_STM32F1.h"
|
||||
|
||||
#include "HAL_timers_STM32F1.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <util/atomic.h>
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -131,7 +129,7 @@ void HAL_init();
|
||||
#endif
|
||||
|
||||
#ifndef digitalPinHasPWM
|
||||
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != NULL)
|
||||
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != nullptr)
|
||||
#endif
|
||||
|
||||
#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); (void)__iCliRetVal()
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "../shared/Marduino.h"
|
||||
|
||||
#include "libmaple/sdio.h"
|
||||
#include "libmaple/dma.h"
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#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 HAS_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
|
||||
#define HAS_TIMER(IO) (PIN_MAP[IO].timer_device != nullptr)
|
||||
|
||||
#define PWM_PIN(P) HAS_TIMER(P)
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
@@ -67,7 +67,7 @@ uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
|
||||
LCD_IO_Init(u8g->pin_list[U8G_PI_CS], u8g->pin_list[U8G_PI_A0]);
|
||||
u8g_Delay(100);
|
||||
|
||||
if (arg_ptr != NULL)
|
||||
if (arg_ptr != nullptr)
|
||||
*((uint32_t *)arg_ptr) = LCD_IO_ReadData(LCD_READ_ID, 3);
|
||||
|
||||
isCommand = 0;
|
||||
|
||||
@@ -32,21 +32,21 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#ifdef USBCON
|
||||
#include <USBSerial.h>
|
||||
#endif
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio_STM32F4.h"
|
||||
#include "watchdog_STM32F4.h"
|
||||
|
||||
#include "HAL_timers_STM32F4.h"
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef USBCON
|
||||
#include <USBSerial.h>
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Defines
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -165,7 +165,7 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
#ifdef STM32GENERIC
|
||||
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
|
||||
#else
|
||||
SPI.transfer((uint8_t*)buf, (uint8_t*)0, 512);
|
||||
SPI.transfer((uint8_t*)buf, nullptr, 512);
|
||||
#endif
|
||||
|
||||
SPI.endTransaction();
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
@@ -44,6 +43,7 @@
|
||||
|
||||
#include "HAL_timers_STM32F7.h"
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Defines
|
||||
|
||||
@@ -222,7 +222,6 @@ void TMC26XStepper::setSpeed(uint16_t whatSpeed) {
|
||||
this->speed = whatSpeed;
|
||||
this->step_delay = 60UL * sq(1000UL) / ((uint32_t)this->number_of_steps * (uint32_t)whatSpeed * (uint32_t)this->microsteps);
|
||||
#ifdef TMC_DEBUG0 // crashes
|
||||
//SERIAL_PRINTF("Step delay in micros: ");
|
||||
SERIAL_ECHOPAIR("\nStep delay in micros: ", this->step_delay);
|
||||
#endif
|
||||
// Update the next step time
|
||||
@@ -315,10 +314,8 @@ void TMC26XStepper::setCurrent(uint16_t current) {
|
||||
// and recalculate the current setting
|
||||
current_scaling = (byte)((resistor_value * mASetting * 32.0 / (0.165 * sq(1000.0))) - 0.5); //theoretically - 1.0 for better rounding it is 0.5
|
||||
#ifdef TMC_DEBUG0 // crashes
|
||||
//SERIAL_PRINTF("CS (Vsense=1): ");
|
||||
SERIAL_ECHOPAIR("\nCS (Vsense=1): ",current_scaling);
|
||||
} else {
|
||||
//SERIAL_PRINTF("CS: ");
|
||||
SERIAL_ECHOPAIR("\nCS: ", current_scaling);
|
||||
#endif
|
||||
}
|
||||
@@ -405,7 +402,6 @@ void TMC26XStepper::setMicrosteps(const int16_t in_steps) {
|
||||
microsteps = _BV(8 - setting_pattern);
|
||||
|
||||
#ifdef TMC_DEBUG0 // crashes
|
||||
//SERIAL_PRINTF("Microstepping: ");
|
||||
SERIAL_ECHOPAIR("\n Microstepping: ", microsteps);
|
||||
#endif
|
||||
|
||||
@@ -612,7 +608,6 @@ void TMC26XStepper::setCoolStepConfiguration(
|
||||
| (((uint32_t)lower_current_limit) << 15)
|
||||
| COOL_STEP_REGISTER; // Register signature
|
||||
|
||||
//SERIAL_PRINTFln(cool_step_register_value,HEX);
|
||||
if (started) send262(cool_step_register_value);
|
||||
}
|
||||
|
||||
@@ -830,18 +825,14 @@ void TMC26XStepper::debugLastStatus() {
|
||||
uint32_t readout_config = driver_configuration_register_value & READ_SELECTION_PATTERN;
|
||||
const int16_t value = getReadoutValue();
|
||||
if (readout_config == READ_MICROSTEP_POSTION) {
|
||||
//SERIAL_PRINTF("Microstep position phase A: ");
|
||||
SERIAL_ECHOPAIR("\n Microstep position phase A: ", value);
|
||||
}
|
||||
else if (readout_config == READ_STALL_GUARD_READING) {
|
||||
//SERIAL_PRINTF("Stall Guard value:");
|
||||
SERIAL_ECHOPAIR("\n Stall Guard value:", value);
|
||||
}
|
||||
else if (readout_config == READ_STALL_GUARD_AND_COOL_STEP) {
|
||||
int16_t stallGuard = value & 0xF, current = value & 0x1F0;
|
||||
//SERIAL_PRINTF("Approx Stall Guard: ");
|
||||
SERIAL_ECHOPAIR("\n Approx Stall Guard: ", stallGuard);
|
||||
//SERIAL_PRINTF("Current level");
|
||||
SERIAL_ECHOPAIR("\n Current level", current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,7 @@
|
||||
|
||||
#define CPU_32_BIT
|
||||
|
||||
// _BV is re-defined in Arduino.h
|
||||
#undef _BV
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// Redefine sq macro defined by teensy3/wiring.h
|
||||
#undef sq
|
||||
#define sq(x) ((x)*(x))
|
||||
#include "../shared/Marduino.h"
|
||||
|
||||
#include "../math_32bit.h"
|
||||
#include "../HAL_SPI.h"
|
||||
|
||||
@@ -31,15 +31,7 @@
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// _BV is re-defined in Arduino.h
|
||||
#undef _BV
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// Redefine sq macro defined by teensy3/wiring.h
|
||||
#undef sq
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
|
||||
@@ -33,4 +33,4 @@
|
||||
void ST7920_set_cmd();
|
||||
void ST7920_set_dat();
|
||||
void ST7920_write_byte(const uint8_t data);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* HAL/shared/Marduino.h
|
||||
*/
|
||||
|
||||
#undef DISABLED // Redefined by ESP32
|
||||
#undef M_PI // Redefined by all
|
||||
#undef _BV // Redefined by some
|
||||
#undef sq // Redefined by teensy3/wiring.h
|
||||
|
||||
#include <Arduino.h> // NOTE: If included earlier then this line is a NOOP
|
||||
|
||||
#undef DISABLED
|
||||
#define DISABLED(V...) DO(DIS,&&,V)
|
||||
|
||||
#undef _BV
|
||||
#define _BV(b) (1UL << (b))
|
||||
|
||||
#undef sq
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#ifndef SBI
|
||||
#define SBI(A,B) (A |= (1 << (B)))
|
||||
#endif
|
||||
|
||||
#ifndef CBI
|
||||
#define CBI(A,B) (A &= ~(1 << (B)))
|
||||
#endif
|
||||
|
||||
#ifndef __AVR__
|
||||
#ifndef strchr_P // Some platforms define a macro (DUE, teensy35)
|
||||
inline const char* strchr_P(const char *s, int c) { return strchr(s,c); }
|
||||
//#define strchr_P(s,c) strchr(s,c)
|
||||
#endif
|
||||
#endif
|
||||
@@ -93,7 +93,7 @@ bool UnwReportRetAddr(UnwState * const state, uint32_t addr) {
|
||||
UnwReport entry;
|
||||
|
||||
// We found two acceptable values.
|
||||
entry.name = NULL;
|
||||
entry.name = nullptr;
|
||||
entry.address = addr & 0xFFFFFFFE; // Remove Thumb bit
|
||||
entry.function = 0;
|
||||
|
||||
|
||||
@@ -124,13 +124,11 @@ UnwResult UnwStartArm(UnwState * const state) {
|
||||
|
||||
/* MRS */
|
||||
else if ((instr & 0xFFBF0FFF) == 0xE10F0000) {
|
||||
uint8_t rd = (instr & 0x0000F000) >> 12;
|
||||
#ifdef UNW_DEBUG
|
||||
const bool R = !!(instr & 0x00400000);
|
||||
#else
|
||||
constexpr bool R = false;
|
||||
UnwPrintd4("MRS r%d,%s\t; r%d invalidated", rd, R ? "SPSR" : "CPSR", rd);
|
||||
#endif
|
||||
uint8_t rd = (instr & 0x0000F000) >> 12;
|
||||
UnwPrintd4("MRS r%d,%s\t; r%d invalidated", rd, R ? "SPSR" : "CPSR", rd);
|
||||
|
||||
/* Status registers untracked */
|
||||
state->regData[rd].o = REG_VAL_INVALID;
|
||||
|
||||
@@ -47,17 +47,17 @@ static const UnwTabEntry *UnwTabSearchIndex(const UnwTabEntry *start, const UnwT
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the function name or NULL if not found
|
||||
* Get the function name or nullptr if not found
|
||||
*/
|
||||
static const char *UnwTabGetFunctionName(const UnwindCallbacks *cb, uint32_t address) {
|
||||
uint32_t flag_word = 0;
|
||||
if (!cb->readW(address-4,&flag_word))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if ((flag_word & 0xFF000000) == 0xFF000000) {
|
||||
return (const char *)(address - 4 - (flag_word & 0x00FFFFFF));
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
#define END_FLASH_ADDR 0x00020000
|
||||
#endif
|
||||
|
||||
#ifdef __STM32F1__
|
||||
// For STM32F103ZET6/STM32F103VET6
|
||||
#if defined(__STM32F1__) || defined(STM32F1xx) || defined(STM32F0xx)
|
||||
// For STM32F103ZET6/STM32F103VET6/STM32F0xx
|
||||
// SRAM (0x20000000 - 0x20010000) (64kb)
|
||||
// FLASH (0x00000000 - 0x00080000) (512kb)
|
||||
//
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
|
||||
#if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx) || defined(STM32F7xx))
|
||||
|
||||
//#include <Arduino.h>
|
||||
#include "servo.h"
|
||||
#include "servo_private.h"
|
||||
|
||||
|
||||
+25
-10
@@ -728,12 +728,12 @@ void idle(
|
||||
* Kill all activity and lock the machine.
|
||||
* After this the machine will need to be reset.
|
||||
*/
|
||||
void kill(PGM_P const lcd_msg/*=NULL*/) {
|
||||
void kill(PGM_P const lcd_msg/*=nullptr*/) {
|
||||
thermalManager.disable_all_heaters();
|
||||
|
||||
SERIAL_ERROR_MSG(MSG_ERR_KILLED);
|
||||
|
||||
#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
|
||||
#if HAS_DISPLAY
|
||||
ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED));
|
||||
#else
|
||||
UNUSED(lcd_msg);
|
||||
@@ -939,9 +939,31 @@ void setup() {
|
||||
|
||||
queue_setup();
|
||||
|
||||
// UI must be initialized before EEPROM
|
||||
// (because EEPROM code calls the UI).
|
||||
ui.init();
|
||||
ui.reset_status();
|
||||
|
||||
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
|
||||
ui.show_bootscreen();
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDIO_SUPPORT) && SD_DETECT_PIN == -1
|
||||
// Auto-mount the SD for EEPROM.dat emulation
|
||||
if (!card.isDetected()) card.initsd();
|
||||
#endif
|
||||
|
||||
// Load data from EEPROM if available (or use defaults)
|
||||
// This also updates variables in the planner, elsewhere
|
||||
(void)settings.load();
|
||||
#if ENABLED(EEPROM_AUTO_INIT)
|
||||
if (!settings.load()) {
|
||||
(void)settings.reset();
|
||||
(void)settings.save();
|
||||
SERIAL_ECHO_MSG("EEPROM Initialized");
|
||||
}
|
||||
#else
|
||||
(void)settings.load();
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
// Initialize current position based on home_offset
|
||||
@@ -1039,13 +1061,6 @@ void setup() {
|
||||
fanmux_init();
|
||||
#endif
|
||||
|
||||
ui.init();
|
||||
ui.reset_status();
|
||||
|
||||
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
|
||||
ui.show_bootscreen();
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.init();
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ void disable_e_stepper(const uint8_t e);
|
||||
void disable_e_steppers();
|
||||
void disable_all_steppers();
|
||||
|
||||
void kill(PGM_P const lcd_msg=NULL);
|
||||
void kill(PGM_P const lcd_msg=nullptr);
|
||||
void minkill();
|
||||
|
||||
void quickstop_stepper();
|
||||
|
||||
@@ -162,6 +162,8 @@
|
||||
#define MSG_BEGIN_FILE_LIST "Begin file list"
|
||||
#define MSG_END_FILE_LIST "End file list"
|
||||
#define MSG_INVALID_EXTRUDER "Invalid extruder"
|
||||
#define MSG_INVALID_E_STEPPER "Invalid E stepper"
|
||||
#define MSG_E_STEPPER_NOT_SPECIFIED "E stepper not specified"
|
||||
#define MSG_INVALID_SOLENOID "Invalid solenoid"
|
||||
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
|
||||
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID
|
||||
|
||||
@@ -50,7 +50,7 @@ void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P)
|
||||
|
||||
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
|
||||
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=NULL*/) {
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=nullptr*/) {
|
||||
if (pre) serialprintPGM(pre);
|
||||
serialprintPGM(onoff ? on : off);
|
||||
if (post) serialprintPGM(post);
|
||||
|
||||
@@ -174,7 +174,7 @@ inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PG
|
||||
void serialprintPGM(PGM_P str);
|
||||
void serial_echo_start();
|
||||
void serial_error_start();
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=NULL);
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=nullptr);
|
||||
void serialprint_onoff(const bool onoff);
|
||||
void serialprintln_onoff(const bool onoff);
|
||||
void serialprint_truefalse(const bool tf);
|
||||
@@ -185,4 +185,4 @@ void print_bin(const uint16_t val);
|
||||
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
|
||||
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
|
||||
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
|
||||
#define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), NULL, __VA_ARGS__); } while(0)
|
||||
#define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), nullptr, __VA_ARGS__); } while(0)
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* 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 "../Marlin.h"
|
||||
|
||||
#if ENABLED(BACKLASH_COMPENSATION)
|
||||
|
||||
#include "backlash.h"
|
||||
#include "../module/planner.h"
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
uint8_t Backlash::correction = (BACKLASH_CORRECTION) * 0xFF;
|
||||
#ifdef BACKLASH_DISTANCE_MM
|
||||
float Backlash::distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
|
||||
#endif
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
float Backlash::smoothing_mm = BACKLASH_SMOOTHING_MM;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
float Backlash::measured_mm[XYZ] = { 0 };
|
||||
uint8_t Backlash::measured_count[XYZ] = { 0 };
|
||||
#endif
|
||||
|
||||
Backlash backlash;
|
||||
|
||||
/**
|
||||
* To minimize seams in the printed part, backlash correction only adds
|
||||
* steps to the current segment (instead of creating a new segment, which
|
||||
* causes discontinuities and print artifacts).
|
||||
*
|
||||
* With a non-zero BACKLASH_SMOOTHING_MM value the backlash correction is
|
||||
* spread over multiple segments, smoothing out artifacts even more.
|
||||
*/
|
||||
|
||||
void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block) {
|
||||
static uint8_t last_direction_bits;
|
||||
uint8_t changed_dir = last_direction_bits ^ dm;
|
||||
// Ignore direction change if no steps are taken in that direction
|
||||
if (da == 0) CBI(changed_dir, X_AXIS);
|
||||
if (db == 0) CBI(changed_dir, Y_AXIS);
|
||||
if (dc == 0) CBI(changed_dir, Z_AXIS);
|
||||
last_direction_bits ^= changed_dir;
|
||||
|
||||
if (correction == 0) return;
|
||||
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
// The segment proportion is a value greater than 0.0 indicating how much residual_error
|
||||
// is corrected for in this segment. The contribution is based on segment length and the
|
||||
// smoothing distance. Since the computation of this proportion involves a floating point
|
||||
// division, defer computation until needed.
|
||||
float segment_proportion = 0;
|
||||
|
||||
// Residual error carried forward across multiple segments, so correction can be applied
|
||||
// to segments where there is no direction change.
|
||||
static int32_t residual_error[XYZ] = { 0 };
|
||||
#else
|
||||
// No leftover residual error from segment to segment
|
||||
int32_t residual_error[XYZ] = { 0 };
|
||||
// No direction change, no correction.
|
||||
if (!changed_dir) return;
|
||||
#endif
|
||||
|
||||
const float f_corr = float(correction) / 255.0f;
|
||||
|
||||
LOOP_XYZ(axis) {
|
||||
if (distance_mm[axis]) {
|
||||
const bool reversing = TEST(dm,axis);
|
||||
|
||||
// When an axis changes direction, add axis backlash to the residual error
|
||||
if (TEST(changed_dir, axis))
|
||||
residual_error[axis] += (reversing ? -f_corr : f_corr) * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
|
||||
|
||||
// Decide how much of the residual error to correct in this segment
|
||||
int32_t error_correction = residual_error[axis];
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
if (error_correction && smoothing_mm != 0) {
|
||||
// Take up a portion of the residual_error in this segment, but only when
|
||||
// the current segment travels in the same direction as the correction
|
||||
if (reversing == (error_correction < 0)) {
|
||||
if (segment_proportion == 0)
|
||||
segment_proportion = MIN(1.0f, block->millimeters / smoothing_mm);
|
||||
error_correction = ceil(segment_proportion * error_correction);
|
||||
}
|
||||
else
|
||||
error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps
|
||||
}
|
||||
#endif
|
||||
// Making a correction reduces the residual error and modifies delta_mm
|
||||
if (error_correction) {
|
||||
block->steps[axis] += ABS(error_correction);
|
||||
residual_error[axis] -= error_correction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
#if USES_Z_MIN_PROBE_ENDSTOP
|
||||
#define TEST_PROBE_PIN (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
|
||||
#else
|
||||
#define TEST_PROBE_PIN (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
|
||||
#endif
|
||||
|
||||
// Measure Z backlash by raising nozzle in increments until probe deactivates
|
||||
void Backlash::measure_with_probe() {
|
||||
if (measured_count[Z_AXIS] == 255) return;
|
||||
|
||||
float start_height = current_position[Z_AXIS];
|
||||
while (current_position[Z_AXIS] < (start_height + BACKLASH_MEASUREMENT_LIMIT) && TEST_PROBE_PIN)
|
||||
do_blocking_move_to_z(current_position[Z_AXIS] + BACKLASH_MEASUREMENT_RESOLUTION, MMM_TO_MMS(BACKLASH_MEASUREMENT_FEEDRATE));
|
||||
|
||||
// The backlash from all probe points is averaged, so count the number of measurements
|
||||
measured_mm[Z_AXIS] += current_position[Z_AXIS] - start_height;
|
||||
measured_count[Z_AXIS]++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BACKLASH_COMPENSATION
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
#include "../module/planner.h"
|
||||
|
||||
class Backlash {
|
||||
public:
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
static uint8_t correction;
|
||||
#ifdef BACKLASH_DISTANCE_MM
|
||||
static float distance_mm[XYZ];
|
||||
#endif
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
static float smoothing_mm;
|
||||
#endif
|
||||
static inline void set_correction(const float &v) { correction = MAX(0, MIN(1.0, v)) * all_on; }
|
||||
static inline float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
|
||||
#elif ENABLED(BACKLASH_COMPENSATION)
|
||||
static constexpr uint8_t correction = (BACKLASH_CORRECTION) * 0xFF;
|
||||
#ifdef BACKLASH_DISTANCE_MM
|
||||
static constexpr float distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
|
||||
#endif
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
static constexpr float smoothing_mm = BACKLASH_SMOOTHING_MM;
|
||||
#endif
|
||||
static inline void set_correction(float) { }
|
||||
static inline float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
|
||||
#else
|
||||
static constexpr uint8_t correction = 0;
|
||||
static inline void set_correction(float) { }
|
||||
static inline float get_correction() { return 0; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
private:
|
||||
static float measured_mm[XYZ];
|
||||
static uint8_t measured_count[XYZ];
|
||||
public:
|
||||
static void measure_with_probe();
|
||||
#endif
|
||||
|
||||
static inline float get_measurement(const uint8_t e) {
|
||||
// Return the measurement averaged over all readings
|
||||
return (
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
measured_count[e] > 0 ? measured_mm[e] / measured_count[e] :
|
||||
#endif
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static inline bool has_measurement(const uint8_t e) {
|
||||
return (false
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
|| (measured_count[e] > 0)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
static inline bool has_any_measurement() {
|
||||
return has_measurement(X_AXIS) || has_measurement(Y_AXIS) || has_measurement(Z_AXIS);
|
||||
}
|
||||
|
||||
void add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block);
|
||||
};
|
||||
|
||||
extern Backlash backlash;
|
||||
@@ -330,7 +330,7 @@
|
||||
else {
|
||||
while (g29_repetition_cnt--) {
|
||||
if (cnt > 20) { cnt = 0; idle(); }
|
||||
const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, NULL);
|
||||
const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, nullptr);
|
||||
if (location.x_index < 0) {
|
||||
// No more REACHABLE mesh points to invalidate, so we ASSUME the user
|
||||
// meant to invalidate the ENTIRE mesh, which cannot be done with
|
||||
@@ -528,7 +528,7 @@
|
||||
}
|
||||
else {
|
||||
while (g29_repetition_cnt--) { // this only populates reachable mesh points near
|
||||
const mesh_index_pair location = find_closest_mesh_point_of_type(INVALID, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, NULL);
|
||||
const mesh_index_pair location = find_closest_mesh_point_of_type(INVALID, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, nullptr);
|
||||
if (location.x_index < 0) {
|
||||
// No more REACHABLE INVALID mesh points to populate, so we ASSUME
|
||||
// user meant to populate ALL INVALID mesh points to value
|
||||
@@ -759,7 +759,7 @@
|
||||
if (do_furthest)
|
||||
location = find_furthest_invalid_mesh_point();
|
||||
else
|
||||
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_PROBE_AS_REFERENCE, NULL);
|
||||
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_PROBE_AS_REFERENCE, nullptr);
|
||||
|
||||
if (location.x_index >= 0) { // mesh point found and is reachable by probe
|
||||
const float rawx = mesh_index_to_xpos(location.x_index),
|
||||
@@ -793,7 +793,7 @@
|
||||
|
||||
typedef void (*clickFunc_t)();
|
||||
|
||||
bool click_and_hold(const clickFunc_t func=NULL) {
|
||||
bool click_and_hold(const clickFunc_t func=nullptr) {
|
||||
if (ui.button_pressed()) {
|
||||
ui.quick_feedback(false); // Preserve button state for click-and-hold
|
||||
const millis_t nxt = millis() + 1500UL;
|
||||
@@ -891,7 +891,7 @@
|
||||
|
||||
mesh_index_pair location;
|
||||
do {
|
||||
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_NOZZLE_AS_REFERENCE, NULL);
|
||||
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_NOZZLE_AS_REFERENCE, nullptr);
|
||||
// It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
|
||||
if (location.x_index < 0 && location.y_index < 0) continue;
|
||||
|
||||
|
||||
+101
-33
@@ -35,15 +35,32 @@ void stop();
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../core/debug_out.h"
|
||||
|
||||
void BLTouch::command(const BLTCommand cmd) {
|
||||
//SERIAL_ECHOLNPAIR("BLTouch Command :", cmd);
|
||||
bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) {
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("BLTouch Command :", cmd);
|
||||
MOVE_SERVO(Z_PROBE_SERVO_NR, cmd);
|
||||
safe_delay(BLTOUCH_DELAY);
|
||||
safe_delay(MAX(ms, BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay
|
||||
return triggered();
|
||||
}
|
||||
|
||||
void BLTouch::init() {
|
||||
reset(); // Clear all BLTouch error conditions
|
||||
stow();
|
||||
// This is called by marlin.cpp on initialization
|
||||
// SET_5V_MODE (if enabled). OD_MODE is the default on power on.
|
||||
// This mode will stay active until manual SET_OD_MODE or power cycle
|
||||
#if ENABLED(BLTOUCH_FORCE_5V_MODE)
|
||||
_set_5V_mode(); // Set 5V mode if explicitely demanded (V3 upwards)
|
||||
#endif
|
||||
clear();
|
||||
// There really should be no alarm outstanding now, and no triggered condition. But if there is,
|
||||
// there is no need to worry people here on init right at the start of the printer.
|
||||
}
|
||||
|
||||
void BLTouch::clear() {
|
||||
_reset(); // RESET or RESET_SW will clear an alarm condition but...
|
||||
// ...it will not clear a triggered condition in SW mode when the pin is currently up
|
||||
// ANTClabs <-- CODE ERROR
|
||||
_stow(); // STOW will pull up the pin and clear any triggered condition unless it fails, don't care
|
||||
_deploy(); // DEPLOY to test the probe. Could fail, don't care
|
||||
_stow(); // STOW to be ready for meaningful work. Could fail, don't care
|
||||
}
|
||||
|
||||
bool BLTouch::triggered() {
|
||||
@@ -56,41 +73,92 @@ bool BLTouch::triggered() {
|
||||
);
|
||||
}
|
||||
|
||||
bool BLTouch::set_deployed(const bool in_deploy) {
|
||||
if (in_deploy && triggered()) { // If BLTouch says it's triggered
|
||||
reset(); // try to reset it.
|
||||
_deploy(); _stow(); // Deploy and stow to clear the "triggered" condition.
|
||||
safe_delay(1500); // Wait for internal self-test to complete.
|
||||
// (Measured completion time was 0.65 seconds
|
||||
// after reset, deploy, and stow sequence)
|
||||
if (triggered()) { // If it still claims to be triggered...
|
||||
SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH);
|
||||
stop(); // punt!
|
||||
return true;
|
||||
bool BLTouch::deploy_proc() {
|
||||
// Do a DEPLOY
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch DEPLOY requested");
|
||||
|
||||
// Attempt to DEPLOY, wait for DEPLOY_DELAY or ALARM
|
||||
if (_deploy_query_alarm()) {
|
||||
// The deploy might have failed or the probe is already triggered (nozzle too low?)
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch ALARM or TRIGGER after DEPLOY, recovering");
|
||||
|
||||
clear(); // Get the probe into start condition
|
||||
|
||||
// Last attempt to DEPLOY
|
||||
if (_deploy_query_alarm()) {
|
||||
// The deploy might have failed or the probe is actually triggered (nozzle too low?) again
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch Recovery Failed");
|
||||
|
||||
SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH); // Tell the user something is wrong, needs action
|
||||
stop(); // but it's not too bad, no need to kill, allow restart
|
||||
|
||||
return true; // Tell our caller we goofed in case he cares to know
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(BLTOUCH_V3)
|
||||
#if EITHER(BLTOUCH_FORCE_5V_MODE, ENDSTOPPULLUPS) \
|
||||
|| ALL(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, ENDSTOPPULLUP_ZMIN) \
|
||||
|| (USES_Z_MIN_PROBE_ENDSTOP && ENABLED(ENDSTOPPULLUP_ZMIN_PROBE))
|
||||
set_5V_mode(); // Assume 5V DC logic level if endstop pullup resistors are enabled
|
||||
#elif true || ENABLED(BLTOUCH_FORCE_OPEN_DRAIN_MODE)
|
||||
set_OD_mode();
|
||||
#endif
|
||||
#endif
|
||||
// Now the probe is ready to issue a 10ms pulse when the pin goes up.
|
||||
// The trigger STOW (see motion.cpp for example) will pull up the probes pin as soon as the pulse
|
||||
// is registered.
|
||||
|
||||
if (in_deploy) {
|
||||
_deploy();
|
||||
#if ENABLED(BLTOUCH_V3)
|
||||
set_SW_mode();
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("bltouch.deploy_proc() end");
|
||||
|
||||
return false; // report success to caller
|
||||
}
|
||||
|
||||
bool BLTouch::stow_proc() {
|
||||
// Do a STOW
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch STOW requested");
|
||||
|
||||
// A STOW will clear a triggered condition in the probe (10ms pulse).
|
||||
// At the moment that we come in here, we might (pulse) or will (SW mode) see the trigger on the pin.
|
||||
// So even though we know a STOW will be ignored if an ALARM condition is active, we will STOW.
|
||||
// Note: If the probe is deployed AND in an ALARM condition, this STOW will not pull up the pin
|
||||
// and the ALARM condition will still be there. --> ANTClabs should change this behaviour maybe
|
||||
|
||||
// Attempt to STOW, wait for STOW_DELAY or ALARM
|
||||
if (_stow_query_alarm()) {
|
||||
// The stow might have failed
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch ALARM or TRIGGER after STOW, recovering");
|
||||
|
||||
_reset(); // This RESET will then also pull up the pin. If it doesn't
|
||||
// work and the pin is still down, there will no longer be
|
||||
// an ALARM condition though.
|
||||
// But one more STOW will catch that
|
||||
// Last attempt to STOW
|
||||
if (_stow_query_alarm()) { // so if there is now STILL an ALARM condition:
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch Recovery Failed");
|
||||
|
||||
SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH); // Tell the user something is wrong, needs action
|
||||
stop(); // but it's not too bad, no need to kill, allow restart
|
||||
|
||||
return true; // Tell our caller we goofed in case he cares to know
|
||||
}
|
||||
}
|
||||
else _stow();
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("bltouch.set_deployed(", in_deploy, ")");
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("bltouch.stow_proc() end");
|
||||
|
||||
return false;
|
||||
return false; // report success to caller
|
||||
}
|
||||
|
||||
bool BLTouch::status_proc() {
|
||||
/**
|
||||
* Return a TRUE for "YES, it is DEPLOYED"
|
||||
* This function will ensure switch state is reset after execution
|
||||
* This may change pin position in some scenarios, specifically
|
||||
* if the pin has been triggered but not yet stowed.
|
||||
*/
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch STATUS requested");
|
||||
|
||||
_set_SW_mode();
|
||||
const bool tr = triggered(); // If triggered in SW mode, the pin is up, it is STOWED
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", (int)tr);
|
||||
|
||||
_reset(); // turn off the SW Mode
|
||||
if (tr) _stow(); else _deploy(); // and reset any triggered signal, restore state
|
||||
return !tr;
|
||||
}
|
||||
|
||||
#endif // BLTOUCH
|
||||
|
||||
@@ -26,37 +26,75 @@
|
||||
// BLTouch commands are sent as servo angles
|
||||
typedef unsigned char BLTCommand;
|
||||
|
||||
#define BLTOUCH_DEPLOY 10
|
||||
#define BLTOUCH_SW_MODE 60
|
||||
#define BLTOUCH_STOW 90
|
||||
#define BLTOUCH_SELFTEST 120
|
||||
#define BLTOUCH_5V_MODE 140
|
||||
#define BLTOUCH_OD_MODE 150
|
||||
#define BLTOUCH_RESET 160
|
||||
#define BLTOUCH_DEPLOY 10
|
||||
#define BLTOUCH_SW_MODE 60
|
||||
#define BLTOUCH_STOW 90
|
||||
#define BLTOUCH_SELFTEST 120
|
||||
#define BLTOUCH_5V_MODE 140
|
||||
#define BLTOUCH_OD_MODE 150
|
||||
#define BLTOUCH_RESET 160
|
||||
|
||||
/**
|
||||
* The following commands may require different 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.
|
||||
*
|
||||
* AntClabs recommends 750ms for Deploy/Stow, otherwise you will
|
||||
* not catch an alarm state until the following move command.
|
||||
*/
|
||||
|
||||
#ifndef BLTOUCH_SET5V_DELAY
|
||||
#define BLTOUCH_SET5V_DELAY BLTOUCH_DELAY
|
||||
#endif
|
||||
#ifndef BLTOUCH_SETOD_DELAY
|
||||
#define BLTOUCH_SETOD_DELAY BLTOUCH_DELAY
|
||||
#endif
|
||||
#ifndef BLTOUCH_DEPLOY_DELAY
|
||||
#define BLTOUCH_DEPLOY_DELAY 750
|
||||
#endif
|
||||
#ifndef BLTOUCH_STOW_DELAY
|
||||
#define BLTOUCH_STOW_DELAY 750
|
||||
#endif
|
||||
#ifndef BLTOUCH_RESET_DELAY
|
||||
#define BLTOUCH_RESET_DELAY BLTOUCH_DELAY
|
||||
#endif
|
||||
|
||||
class BLTouch {
|
||||
public:
|
||||
static void init();
|
||||
static void command(const BLTCommand cmd);
|
||||
static bool triggered();
|
||||
static bool triggered(); // used by menu_advanced.cpp
|
||||
static void init(); // used by main.cpp
|
||||
|
||||
FORCE_INLINE static void reset() { command(BLTOUCH_RESET); }
|
||||
FORCE_INLINE static void selftest() { command(BLTOUCH_SELFTEST); }
|
||||
// DEPLOY and STOW are wrapped for error handling - these are used by homing and by probing
|
||||
FORCE_INLINE static bool deploy() { return deploy_proc(); }
|
||||
FORCE_INLINE static bool stow() { return stow_proc(); }
|
||||
FORCE_INLINE static bool status() { return status_proc(); }
|
||||
|
||||
FORCE_INLINE static void set_5V_mode() { command(BLTOUCH_5V_MODE); }
|
||||
FORCE_INLINE static void set_OD_mode() { command(BLTOUCH_OD_MODE); }
|
||||
FORCE_INLINE static void set_SW_mode() { command(BLTOUCH_SW_MODE); }
|
||||
// Native BLTouch commands ("Underscore"...), used in lcd menus and internally
|
||||
FORCE_INLINE static void _reset() { command(BLTOUCH_RESET, BLTOUCH_RESET_DELAY); }
|
||||
|
||||
FORCE_INLINE static bool deploy() { return set_deployed(true); }
|
||||
FORCE_INLINE static bool stow() { return set_deployed(false); }
|
||||
FORCE_INLINE static void _selftest() { command(BLTOUCH_SELFTEST, BLTOUCH_DELAY); }
|
||||
|
||||
FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY); }
|
||||
FORCE_INLINE static void _stow() { command(BLTOUCH_STOW); }
|
||||
FORCE_INLINE static void _set_SW_mode() { command(BLTOUCH_SW_MODE, BLTOUCH_DELAY); }
|
||||
FORCE_INLINE static void _set_5V_mode() { command(BLTOUCH_5V_MODE, BLTOUCH_SET5V_DELAY); }
|
||||
FORCE_INLINE static void _set_OD_mode() { command(BLTOUCH_OD_MODE, BLTOUCH_SETOD_DELAY); }
|
||||
|
||||
FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
|
||||
FORCE_INLINE static void _stow() { command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
|
||||
|
||||
private:
|
||||
static bool set_deployed(const bool deploy);
|
||||
FORCE_INLINE static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
|
||||
FORCE_INLINE static bool _stow_query_alarm() { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
|
||||
|
||||
static void clear();
|
||||
static bool command(const BLTCommand cmd, const millis_t &ms);
|
||||
static bool deploy_proc();
|
||||
static bool stow_proc();
|
||||
static bool status_proc();
|
||||
};
|
||||
|
||||
// Deploy/stow angles for use by servo.cpp / servo.h
|
||||
#define BLTOUCH_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
|
||||
|
||||
extern BLTouch bltouch;
|
||||
|
||||
@@ -84,7 +84,7 @@ void host_action(const char * const pstr, const bool eol) {
|
||||
void host_action_prompt_button(const char * const pstr) { host_action_prompt_plus(PSTR("button"), pstr); }
|
||||
void host_action_prompt_end() { host_action_prompt(PSTR("end")); }
|
||||
void host_action_prompt_show() { host_action_prompt(PSTR("show")); }
|
||||
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=NULL*/) {
|
||||
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=nullptr*/) {
|
||||
host_prompt_reason = reason;
|
||||
host_action_prompt_end();
|
||||
host_action_prompt_begin(pstr);
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void host_action(const char * const pstr, const bool eol=true);
|
||||
|
||||
@@ -62,8 +64,8 @@ void host_action(const char * const pstr, const bool eol=true);
|
||||
void host_action_prompt_button(const char * const pstr);
|
||||
void host_action_prompt_end();
|
||||
void host_action_prompt_show();
|
||||
void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=NULL);
|
||||
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=NULL) {
|
||||
void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=nullptr);
|
||||
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=nullptr) {
|
||||
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, pbtn);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ void Mixer::init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=selected_vtool*/) {
|
||||
void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=selected_vtool*/, float (&c)[MIXING_STEPPERS]/*=collector*/) {
|
||||
float csum = 0, cmax = 0;
|
||||
MIXER_STEPPER_LOOP(i) {
|
||||
const float v = color[t][i];
|
||||
@@ -142,8 +142,8 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=
|
||||
//SERIAL_ECHOPAIR("Mixer::refresh_collector(", proportion, ", ", int(t), ") cmax=", cmax, " csum=", csum, " color");
|
||||
const float inv_prop = proportion / csum;
|
||||
MIXER_STEPPER_LOOP(i) {
|
||||
collector[i] = color[t][i] * inv_prop;
|
||||
//SERIAL_ECHOPAIR(" [", int(t), "][", int(i), "] = ", int(color[t][i]), " (", collector[i], ") ");
|
||||
c[i] = color[t][i] * inv_prop;
|
||||
//SERIAL_ECHOPAIR(" [", int(t), "][", int(i), "] = ", int(color[t][i]), " (", c[i], ") ");
|
||||
}
|
||||
//SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -51,19 +51,19 @@ enum MixTool {
|
||||
FIRST_USER_VIRTUAL_TOOL = 0,
|
||||
LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1,
|
||||
NR_USER_VIRTUAL_TOOLS,
|
||||
#ifdef RETRACT_SYNC_MIXING
|
||||
MIXER_AUTORETRACT_TOOL = NR_USER_VIRTUAL_TOOLS,
|
||||
NR_MIXING_VIRTUAL_TOOLS
|
||||
#else
|
||||
NR_MIXING_VIRTUAL_TOOLS = NR_USER_VIRTUAL_TOOLS
|
||||
MIXER_DIRECT_SET_TOOL = NR_USER_VIRTUAL_TOOLS,
|
||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
||||
MIXER_AUTORETRACT_TOOL,
|
||||
#endif
|
||||
NR_MIXING_VIRTUAL_TOOLS
|
||||
};
|
||||
|
||||
#ifdef RETRACT_SYNC_MIXING
|
||||
static_assert(NR_MIXING_VIRTUAL_TOOLS <= 254, "MIXING_VIRTUAL_TOOLS must be <= 254!");
|
||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
||||
#define MAX_VTOOLS 254
|
||||
#else
|
||||
static_assert(NR_MIXING_VIRTUAL_TOOLS <= 255, "MIXING_VIRTUAL_TOOLS must be <= 255!");
|
||||
#define MAX_VTOOLS 255
|
||||
#endif
|
||||
static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must be <= " STRINGIFY(MAX_VTOOLS) "!");
|
||||
|
||||
#define MIXER_STEPPER_LOOP(VAR) \
|
||||
for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++)
|
||||
@@ -100,7 +100,7 @@ class Mixer {
|
||||
static void init(); // Populate colors at boot time
|
||||
|
||||
static void reset_vtools();
|
||||
static void refresh_collector(const float proportion=1.0, const uint8_t t=selected_vtool);
|
||||
static void refresh_collector(const float proportion=1.0, const uint8_t t=selected_vtool, float (&c)[MIXING_STEPPERS]=collector);
|
||||
|
||||
// Used up to Planner level
|
||||
FORCE_INLINE static void set_collector(const uint8_t c, const float f) { collector[c] = MAX(f, 0.0f); }
|
||||
|
||||
@@ -302,16 +302,22 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
*/
|
||||
bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
|
||||
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
, const float &mix_multiplier/*=1.0*/
|
||||
#endif
|
||||
) {
|
||||
#if !HAS_LCD_MENU
|
||||
UNUSED(show_lcd);
|
||||
#endif
|
||||
|
||||
#if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
constexpr float mix_multiplier = 1.0;
|
||||
#endif
|
||||
|
||||
if (!ensure_safe_temperature(mode)) {
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -320,13 +326,14 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
#endif
|
||||
|
||||
// Retract filament
|
||||
do_pause_e_move(-FILAMENT_UNLOAD_RETRACT_LENGTH, PAUSE_PARK_RETRACT_FEEDRATE);
|
||||
do_pause_e_move(-(FILAMENT_UNLOAD_RETRACT_LENGTH) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
|
||||
|
||||
// Wait for filament to cool
|
||||
safe_delay(FILAMENT_UNLOAD_DELAY);
|
||||
|
||||
// Quickly purge
|
||||
do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.settings.max_feedrate_mm_s[E_AXIS]);
|
||||
do_pause_e_move((FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH) * mix_multiplier,
|
||||
planner.settings.max_feedrate_mm_s[E_AXIS] * mix_multiplier);
|
||||
|
||||
// Unload filament
|
||||
#if FILAMENT_CHANGE_UNLOAD_ACCEL > 0
|
||||
@@ -334,7 +341,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
planner.settings.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL;
|
||||
#endif
|
||||
|
||||
do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE);
|
||||
do_pause_e_move(unload_length * mix_multiplier, (FILAMENT_CHANGE_UNLOAD_FEEDRATE) * mix_multiplier);
|
||||
|
||||
#if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
|
||||
planner.settings.retract_acceleration = saved_acceleration;
|
||||
@@ -417,6 +424,10 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
|
||||
// Wait for buffered blocks to complete
|
||||
planner.synchronize();
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && FAN_COUNT > 0
|
||||
thermalManager.set_fans_paused(true);
|
||||
#endif
|
||||
|
||||
// Initial retract before move to filament change position
|
||||
if (retract && thermalManager.hotEnoughToExtrude(active_extruder))
|
||||
do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
|
||||
@@ -653,6 +664,10 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && FAN_COUNT > 0
|
||||
thermalManager.set_fans_paused(false);
|
||||
#endif
|
||||
|
||||
// Resume the print job timer if it was running
|
||||
if (print_job_timer.isPaused()) print_job_timer.start();
|
||||
|
||||
|
||||
@@ -92,6 +92,10 @@ void resume_print(const float &slow_load_length=0, const float &fast_load_length
|
||||
bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false,
|
||||
const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
|
||||
|
||||
bool unload_filament(const float &unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT);
|
||||
bool unload_filament(const float &unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT
|
||||
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
, const float &mix_multiplier=1.0
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
||||
@@ -50,6 +50,10 @@ bool Power::is_power_needed() {
|
||||
if (controllerfan_speed) return true;
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
|
||||
if (thermalManager.chamberfan_speed) return true;
|
||||
#endif
|
||||
|
||||
// If any of the drivers or the bed are enabled...
|
||||
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON
|
||||
#if HAS_HEATED_BED
|
||||
|
||||
@@ -55,6 +55,13 @@ job_recovery_info_t PrintJobRecovery::info;
|
||||
|
||||
PrintJobRecovery recovery;
|
||||
|
||||
#ifndef POWER_LOSS_PURGE_LEN
|
||||
#define POWER_LOSS_PURGE_LEN 0
|
||||
#endif
|
||||
#ifndef POWER_LOSS_RETRACT_LEN
|
||||
#define POWER_LOSS_RETRACT_LEN 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clear the recovery info
|
||||
*/
|
||||
@@ -126,6 +133,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
||||
millis_t ms = millis();
|
||||
#endif
|
||||
|
||||
#ifndef POWER_LOSS_MIN_Z_CHANGE
|
||||
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // Vase-mode-friendly out of the box
|
||||
#endif
|
||||
|
||||
// Did Z change since the last call?
|
||||
if (force
|
||||
#if DISABLED(SAVE_EACH_CMD_MODE) // Always save state when enabled
|
||||
@@ -135,8 +146,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
||||
#if SAVE_INFO_INTERVAL_MS > 0 // Save if interval is elapsed
|
||||
|| ELAPSED(ms, next_save_ms)
|
||||
#endif
|
||||
// Save every time Z is higher than the last call
|
||||
|| current_position[Z_AXIS] > info.current_position[Z_AXIS]
|
||||
// Save if Z is above the last-saved position by some minimum height
|
||||
|| current_position[Z_AXIS] > info.current_position[Z_AXIS] + POWER_LOSS_MIN_Z_CHANGE
|
||||
#endif
|
||||
) {
|
||||
|
||||
@@ -228,9 +239,8 @@ void PrintJobRecovery::write() {
|
||||
open(false);
|
||||
file.seekSet(0);
|
||||
const int16_t ret = file.write(&info, sizeof(info));
|
||||
close();
|
||||
|
||||
if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed.");
|
||||
if (!file.close()) DEBUG_ECHOLNPGM("Power-loss file close failed.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,8 +347,9 @@ void PrintJobRecovery::resume() {
|
||||
//gcode.process_subcommands_now(cmd);
|
||||
gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F200"));
|
||||
#endif
|
||||
|
||||
#if POWER_LOSS_RETRACT_LEN
|
||||
sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN - POWER_LOSS_RETRACT_LEN);
|
||||
sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN - (POWER_LOSS_RETRACT_LEN));
|
||||
gcode.process_subcommands_now(cmd);
|
||||
#endif
|
||||
|
||||
@@ -392,7 +403,6 @@ void PrintJobRecovery::resume() {
|
||||
|
||||
// Resume the SD file from the last position
|
||||
char *fn = info.sd_filename;
|
||||
while (*fn == '/') fn++;
|
||||
sprintf_P(cmd, PSTR("M23 %s"), fn);
|
||||
gcode.process_subcommands_now(cmd);
|
||||
sprintf_P(cmd, PSTR("M24 S%ld T%ld"), info.sdpos, info.print_job_elapsed);
|
||||
|
||||
@@ -32,11 +32,9 @@
|
||||
#include "../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
#define SAVE_INFO_INTERVAL_MS 0
|
||||
//#define SAVE_EACH_CMD_MODE
|
||||
//#define DEBUG_POWER_LOSS_RECOVERY
|
||||
#define POWER_LOSS_PURGE_LEN 20
|
||||
#define POWER_LOSS_RETRACT_LEN 10
|
||||
//#define SAVE_EACH_CMD_MODE
|
||||
//#define SAVE_INFO_INTERVAL_MS 0
|
||||
|
||||
typedef struct {
|
||||
uint8_t valid_head;
|
||||
|
||||
@@ -202,19 +202,19 @@ void MMU2::mmu_loop() {
|
||||
}
|
||||
break;
|
||||
|
||||
#if ENABLED(MMU2_MODE_12V)
|
||||
case -5:
|
||||
// response to M1
|
||||
if (rx_ok()) {
|
||||
DEBUG_ECHOLNPGM("MMU => ok");
|
||||
|
||||
check_version();
|
||||
|
||||
DEBUG_ECHOLNPGM("MMU <= 'P0'");
|
||||
|
||||
tx_str_P(PSTR("P0\n")); // read finda
|
||||
state = -4;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case -4:
|
||||
if (rx_ok()) {
|
||||
@@ -302,7 +302,7 @@ void MMU2::mmu_loop() {
|
||||
|
||||
if (!finda && finda_runout_valid) filament_runout();
|
||||
}
|
||||
else if (ELAPSED(millis(), last_request + MMU_P0_TIMEOUT)) // Resend request after timeout (30s)
|
||||
else if (ELAPSED(millis(), last_request + MMU_P0_TIMEOUT)) // Resend request after timeout (3s)
|
||||
state = 1;
|
||||
|
||||
break;
|
||||
|
||||
@@ -51,7 +51,7 @@ void FilamentSensorBase::filament_present(const uint8_t extruder) {
|
||||
uint8_t FilamentSensorEncoder::motion_detected;
|
||||
#endif
|
||||
|
||||
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
|
||||
volatile float RunoutResponseDelayed::runout_mm_countdown[EXTRUDERS];
|
||||
#else
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
#endif
|
||||
|
||||
//#define FILAMENT_RUNOUT_SENSOR_DEBUG
|
||||
#ifndef FILAMENT_RUNOUT_THRESHOLD
|
||||
#define FILAMENT_RUNOUT_THRESHOLD 5
|
||||
#endif
|
||||
|
||||
class FilamentMonitorBase {
|
||||
public:
|
||||
@@ -78,6 +81,11 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
response.filament_present(extruder);
|
||||
}
|
||||
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
static inline float& runout_distance() { return response.runout_distance_mm; }
|
||||
static inline void set_runout_distance(const float &mm) { response.runout_distance_mm = mm; }
|
||||
#endif
|
||||
|
||||
// Handle a block completion. RunoutResponseDelayed uses this to
|
||||
// add up the length of filament moved while the filament is out.
|
||||
static inline void block_completed(const block_t* const b) {
|
||||
@@ -90,13 +98,13 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
// Give the response a chance to update its counter.
|
||||
static inline void run() {
|
||||
if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning() || did_pause_print)) {
|
||||
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
|
||||
#endif
|
||||
response.run();
|
||||
sensor.run();
|
||||
const bool ran_out = response.has_run_out();
|
||||
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
sei();
|
||||
#endif
|
||||
if (ran_out) {
|
||||
@@ -272,7 +280,7 @@ class FilamentSensorBase {
|
||||
|
||||
/********************************* RESPONSE TYPE *********************************/
|
||||
|
||||
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
|
||||
// RunoutResponseDelayed triggers a runout event only if the length
|
||||
// of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed
|
||||
@@ -332,11 +340,11 @@ class FilamentSensorBase {
|
||||
|
||||
class RunoutResponseDebounced {
|
||||
private:
|
||||
static constexpr int8_t runout_threshold = 5;
|
||||
static constexpr int8_t runout_threshold = FILAMENT_RUNOUT_THRESHOLD;
|
||||
static int8_t runout_count;
|
||||
public:
|
||||
static inline void reset() { runout_count = runout_threshold; }
|
||||
static inline void run() { runout_count--; }
|
||||
static inline void run() { if (runout_count >= 0) runout_count--; }
|
||||
static inline bool has_run_out() { return runout_count < 0; }
|
||||
static inline void block_completed(const block_t* const b) { UNUSED(b); }
|
||||
static inline void filament_present(const uint8_t extruder) { runout_count = runout_threshold; UNUSED(extruder); }
|
||||
@@ -347,11 +355,12 @@ class FilamentSensorBase {
|
||||
/********************************* TEMPLATE SPECIALIZATION *********************************/
|
||||
|
||||
typedef TFilamentMonitor<
|
||||
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
RunoutResponseDelayed,
|
||||
#if ENABLED(FILAMENT_MOTION_SENSOR)
|
||||
RunoutResponseDelayed, FilamentSensorEncoder
|
||||
FilamentSensorEncoder
|
||||
#else
|
||||
RunoutResponseDelayed, FilamentSensorSwitch
|
||||
FilamentSensorSwitch
|
||||
#endif
|
||||
#else
|
||||
RunoutResponseDebounced, FilamentSensorSwitch
|
||||
|
||||
@@ -85,12 +85,15 @@
|
||||
#endif
|
||||
|
||||
static TMC_driver_data get_driver_data(TMC2130Stepper &st) {
|
||||
constexpr uint16_t SG_RESULT_bm = 0x3FF; // 0:9
|
||||
constexpr uint8_t STEALTH_bp = 14, CS_ACTUAL_sb = 16;
|
||||
constexpr uint32_t CS_ACTUAL_bm = 0x1F0000; // 16:20
|
||||
constexpr uint8_t STALL_GUARD_bp = 24, OT_bp = 25, OTPW_bp = 26;
|
||||
constexpr uint8_t OT_bp = 25, OTPW_bp = 26;
|
||||
constexpr uint32_t S2G_bm = 0x18000000;
|
||||
constexpr uint8_t STST_bp = 31;
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
constexpr uint16_t SG_RESULT_bm = 0x3FF; // 0:9
|
||||
constexpr uint8_t STEALTH_bp = 14;
|
||||
constexpr uint32_t CS_ACTUAL_bm = 0x1F0000; // 16:20
|
||||
constexpr uint8_t STALL_GUARD_bp = 24;
|
||||
constexpr uint8_t STST_bp = 31;
|
||||
#endif
|
||||
TMC_driver_data data;
|
||||
data.drv_status = st.DRV_STATUS();
|
||||
#ifdef __AVR__
|
||||
@@ -112,13 +115,13 @@
|
||||
data.is_standstill = !!(spart & _BV(STST_bp - 24));
|
||||
data.sg_result_reasonable = !data.is_standstill; // sg_result has no reasonable meaning while standstill
|
||||
#endif
|
||||
UNUSED(CS_ACTUAL_sb);
|
||||
#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);
|
||||
#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;
|
||||
@@ -143,15 +146,14 @@
|
||||
static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
|
||||
constexpr uint8_t OTPW_bp = 0, OT_bp = 1;
|
||||
constexpr uint8_t S2G_bm = 0b11110; // 2..5
|
||||
constexpr uint8_t CS_ACTUAL_sb = 16;
|
||||
constexpr uint32_t CS_ACTUAL_bm = 0x1F0000; // 16:20
|
||||
constexpr uint8_t STEALTH_bp = 30, STST_bp = 31;
|
||||
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);
|
||||
#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;
|
||||
@@ -159,8 +161,8 @@
|
||||
spart = data.drv_status >> 24;
|
||||
data.is_stealth = !!(spart & _BV(STEALTH_bp - 24));
|
||||
data.is_standstill = !!(spart & _BV(STST_bp - 24));
|
||||
UNUSED(CS_ACTUAL_sb);
|
||||
#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));
|
||||
@@ -181,11 +183,8 @@
|
||||
#endif
|
||||
|
||||
static TMC_driver_data get_driver_data(TMC2660Stepper &st) {
|
||||
constexpr uint8_t STALL_GUARD_bp = 0;
|
||||
constexpr uint8_t OT_bp = 1, OTPW_bp = 2;
|
||||
constexpr uint8_t S2G_bm = 0b11000;
|
||||
constexpr uint8_t STST_bp = 7, SG_RESULT_sp = 10;
|
||||
constexpr uint32_t SG_RESULT_bm = 0xFFC00; // 10:19
|
||||
TMC_driver_data data;
|
||||
data.drv_status = st.DRVSTATUS();
|
||||
uint8_t spart = data.drv_status & 0xFF;
|
||||
@@ -193,6 +192,9 @@
|
||||
data.is_ot = !!(spart & _BV(OT_bp));
|
||||
data.is_s2g = !!(data.drv_status & 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;
|
||||
@@ -793,7 +795,9 @@
|
||||
#endif
|
||||
TMC_REPORT("CS actual\t", TMC_CS_ACTUAL);
|
||||
TMC_REPORT("PWM scale", TMC_PWM_SCALE);
|
||||
TMC_REPORT("vsense\t", TMC_VSENSE);
|
||||
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2208)
|
||||
TMC_REPORT("vsense\t", TMC_VSENSE);
|
||||
#endif
|
||||
TMC_REPORT("stealthChop", TMC_STEALTHCHOP);
|
||||
TMC_REPORT("msteps\t", TMC_MICROSTEPS);
|
||||
TMC_REPORT("tstep\t", TMC_TSTEP);
|
||||
|
||||
@@ -162,7 +162,7 @@ void TWIBus::flush() {
|
||||
echodata(bytes, PSTR("i2c-receive"), 0);
|
||||
}
|
||||
|
||||
void TWIBus::reply(char str[]/*=NULL*/) {
|
||||
void TWIBus::reply(char str[]/*=nullptr*/) {
|
||||
#if ENABLED(DEBUG_TWIBUS)
|
||||
debug(PSTR("reply"), str);
|
||||
#endif
|
||||
|
||||
@@ -217,7 +217,7 @@ class TWIBus {
|
||||
* @details Send the buffer and clear it.
|
||||
* If a string is passed, write it into the buffer first.
|
||||
*/
|
||||
void reply(char str[]=NULL);
|
||||
void reply(char str[]=nullptr);
|
||||
inline void reply(const char str[]) { this->reply((char*)str); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,7 @@ void GcodeSuite::M421() {
|
||||
hasQ = !hasZ && parser.seen('Q');
|
||||
|
||||
if (hasC) {
|
||||
const mesh_index_pair location = ubl.find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL);
|
||||
const mesh_index_pair location = ubl.find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, nullptr);
|
||||
ix = location.x_index;
|
||||
iy = location.y_index;
|
||||
}
|
||||
|
||||
@@ -112,8 +112,7 @@ void GcodeSuite::G34() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
bltouch.reset();
|
||||
bltouch.stow();
|
||||
bltouch.init();
|
||||
#endif
|
||||
|
||||
// Always home with tool 0 active
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "../../module/tool_change.h"
|
||||
#include "../../module/endstops.h"
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#include "../../feature/backlash.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -55,11 +56,6 @@
|
||||
#define HAS_X_CENTER BOTH(CALIBRATION_MEASURE_LEFT, CALIBRATION_MEASURE_RIGHT)
|
||||
#define HAS_Y_CENTER BOTH(CALIBRATION_MEASURE_FRONT, CALIBRATION_MEASURE_BACK)
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
extern float backlash_distance_mm[], backlash_smoothing_mm;
|
||||
extern uint8_t backlash_correction;
|
||||
#endif
|
||||
|
||||
enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES };
|
||||
|
||||
struct measurements_t {
|
||||
@@ -79,13 +75,13 @@ struct measurements_t {
|
||||
#define TEMPORARY_SOFT_ENDSTOP_STATE(enable) REMEMBER(tes, soft_endstops_enabled, enable);
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
#define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash_correction, value)
|
||||
#define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash.correction, value)
|
||||
#else
|
||||
#define TEMPORARY_BACKLASH_CORRECTION(value)
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)
|
||||
#define TEMPORARY_BACKLASH_SMOOTHING(value) REMEMBER(tbsm, backlash_smoothing_mm, value)
|
||||
#define TEMPORARY_BACKLASH_SMOOTHING(value) REMEMBER(tbsm, backlash.smoothing_mm, value)
|
||||
#else
|
||||
#define TEMPORARY_BACKLASH_SMOOTHING(value)
|
||||
#endif
|
||||
@@ -209,7 +205,7 @@ float measuring_movement(const AxisEnum axis, const int dir, const bool stop_sta
|
||||
* axis in - Axis along which the measurement will take place
|
||||
* dir in - Direction along that axis (-1 or 1)
|
||||
* stop_state in - Move until probe pin becomes this value
|
||||
* backlash_ptr in/out - When not NULL, measure and record axis backlash
|
||||
* backlash_ptr in/out - When not nullptr, measure and record axis backlash
|
||||
* uncertainty in - If uncertainty is CALIBRATION_MEASUREMENT_UNKNOWN, do a fast probe.
|
||||
*/
|
||||
inline float measure(const AxisEnum axis, const int dir, const bool stop_state, float * const backlash_ptr, const float uncertainty) {
|
||||
@@ -454,22 +450,22 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) {
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
#if HAS_X_CENTER
|
||||
backlash_distance_mm[X_AXIS] = (m.backlash[LEFT] + m.backlash[RIGHT]) / 2;
|
||||
backlash.distance_mm[X_AXIS] = (m.backlash[LEFT] + m.backlash[RIGHT]) / 2;
|
||||
#elif ENABLED(CALIBRATION_MEASURE_LEFT)
|
||||
backlash_distance_mm[X_AXIS] = m.backlash[LEFT];
|
||||
backlash.distance_mm[X_AXIS] = m.backlash[LEFT];
|
||||
#elif ENABLED(CALIBRATION_MEASURE_RIGHT)
|
||||
backlash_distance_mm[X_AXIS] = m.backlash[RIGHT];
|
||||
backlash.distance_mm[X_AXIS] = m.backlash[RIGHT];
|
||||
#endif
|
||||
|
||||
#if HAS_Y_CENTER
|
||||
backlash_distance_mm[Y_AXIS] = (m.backlash[FRONT] + m.backlash[BACK]) / 2;
|
||||
backlash.distance_mm[Y_AXIS] = (m.backlash[FRONT] + m.backlash[BACK]) / 2;
|
||||
#elif ENABLED(CALIBRATION_MEASURE_FRONT)
|
||||
backlash_distance_mm[Y_AXIS] = m.backlash[FRONT];
|
||||
backlash.distance_mm[Y_AXIS] = m.backlash[FRONT];
|
||||
#elif ENABLED(CALIBRATION_MEASURE_BACK)
|
||||
backlash_distance_mm[Y_AXIS] = m.backlash[BACK];
|
||||
backlash.distance_mm[Y_AXIS] = m.backlash[BACK];
|
||||
#endif
|
||||
|
||||
backlash_distance_mm[Z_AXIS] = m.backlash[TOP];
|
||||
backlash.distance_mm[Z_AXIS] = m.backlash[TOP];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,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 ptr);
|
||||
* 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);
|
||||
*
|
||||
* Initial version by Roxy-3D
|
||||
@@ -60,16 +60,57 @@
|
||||
|
||||
#define TEST_BYTE ((char) 0xE5)
|
||||
|
||||
extern char* __brkval;
|
||||
extern size_t __heap_start, __heap_end, __flp;
|
||||
extern char __bss_end;
|
||||
#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;
|
||||
|
||||
#define MEMORY_END_CORRECTION 0
|
||||
|
||||
#elif defined(TARGET_LPC1768)
|
||||
|
||||
extern char __bss_end__;
|
||||
extern char __StackLimit;
|
||||
extern char __HeapLimit;
|
||||
|
||||
char* end_bss = &__bss_end__;
|
||||
char* stacklimit = &__StackLimit;
|
||||
char* heaplimit = &__HeapLimit ;
|
||||
|
||||
#define MEMORY_END_CORRECTION 0x200
|
||||
|
||||
char* free_memory_start = heaplimit;
|
||||
char* free_memory_end = stacklimit - MEMORY_END_CORRECTION;
|
||||
|
||||
|
||||
#elif defined(__SAM3X8E__)
|
||||
|
||||
extern char _ebss;
|
||||
|
||||
char* end_bss = &_ebss;
|
||||
|
||||
char* free_memory_start = end_bss;
|
||||
|
||||
char* free_memory_end = 0;
|
||||
char* stacklimit = 0;
|
||||
char* heaplimit = 0;
|
||||
|
||||
#define MEMORY_END_CORRECTION 0x10000 // need to stay well below 0x20080000 or M100 F crashes
|
||||
|
||||
#else
|
||||
#error "M100 - unsupported CPU"
|
||||
#endif
|
||||
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
|
||||
#define END_OF_HEAP() (__brkval ? __brkval : &__bss_end)
|
||||
|
||||
// Location of a variable on its stack frame. Returns a value above
|
||||
// the stack (once the function returns to the caller).
|
||||
char* top_of_stack() {
|
||||
@@ -78,9 +119,9 @@ char* top_of_stack() {
|
||||
}
|
||||
|
||||
// Count the number of test bytes at the specified location.
|
||||
inline int32_t count_test_bytes(const char * const ptr) {
|
||||
inline int32_t count_test_bytes(const char * const start_free_memory) {
|
||||
for (uint32_t i = 0; i < 32000; i++)
|
||||
if (char(ptr[i]) != TEST_BYTE)
|
||||
if (char(start_free_memory[i]) != TEST_BYTE)
|
||||
return i - 1;
|
||||
|
||||
return -1;
|
||||
@@ -93,35 +134,35 @@ inline int32_t count_test_bytes(const char * const ptr) {
|
||||
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
||||
/**
|
||||
* M100 D
|
||||
* Dump the free memory block from __brkval to the stack pointer.
|
||||
* Dump the free memory block from brkval to the stack pointer.
|
||||
* malloc() eats memory from the start of the block and the stack grows
|
||||
* up from the bottom of the block. Solid test bytes indicate nothing has
|
||||
* used that memory yet. There should not be anything but test bytes within
|
||||
* 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 *ptr, const char *sp) {
|
||||
inline void dump_free_memory(const char *start_free_memory, const char *end_free_memory) {
|
||||
//
|
||||
// Start and end the dump on a nice 16 byte boundary
|
||||
// (even though the values are not 16-byte aligned).
|
||||
//
|
||||
ptr = (char*)((ptr_int_t)((uint32_t)ptr & 0xFFFFFFF0)); // Align to 16-byte boundary
|
||||
sp = (char*)((ptr_int_t)((uint32_t)sp | 0x0000000F)); // Align sp to the 15th byte (at or above sp)
|
||||
start_free_memory = (char*)((ptr_int_t)((uint32_t)start_free_memory & 0xFFFFFFF0)); // Align to 16-byte boundary
|
||||
end_free_memory = (char*)((ptr_int_t)((uint32_t)end_free_memory | 0x0000000F)); // Align end_free_memory to the 15th byte (at or above end_free_memory)
|
||||
|
||||
// Dump command main loop
|
||||
while (ptr < sp) {
|
||||
print_hex_address(ptr); // Print the address
|
||||
while (start_free_memory < end_free_memory) {
|
||||
print_hex_address(start_free_memory); // Print the address
|
||||
SERIAL_CHAR(':');
|
||||
for (uint8_t i = 0; i < 16; i++) { // and 16 data bytes
|
||||
if (i == 8) SERIAL_CHAR('-');
|
||||
print_hex_byte(ptr[i]);
|
||||
print_hex_byte(start_free_memory[i]);
|
||||
SERIAL_CHAR(' ');
|
||||
}
|
||||
serial_delay(25);
|
||||
SERIAL_CHAR('|'); // Point out non test bytes
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
char ccc = (char)ptr[i]; // cast to char before automatically casting to char on assignment, in case the compiler is broken
|
||||
if (&ptr[i] >= (const char*)command_queue && &ptr[i] < (const char*)(command_queue + sizeof(command_queue))) { // Print out ASCII in the command buffer area
|
||||
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 (!WITHIN(ccc, ' ', 0x7E)) ccc = ' ';
|
||||
}
|
||||
else { // If not in the command buffer area, flag bytes that don't match the test byte
|
||||
@@ -130,7 +171,7 @@ inline int32_t count_test_bytes(const char * const ptr) {
|
||||
SERIAL_CHAR(ccc);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
ptr += 16;
|
||||
start_free_memory += 16;
|
||||
serial_delay(25);
|
||||
idle();
|
||||
}
|
||||
@@ -143,7 +184,7 @@ inline int32_t count_test_bytes(const char * const ptr) {
|
||||
// Round the start and end locations to produce full lines of output
|
||||
//
|
||||
start = (char*)((ptr_int_t)((uint32_t)start & 0xFFFFFFF0)); // Align to 16-byte boundary
|
||||
end = (char*)((ptr_int_t)((uint32_t)end | 0x0000000F)); // Align sp to the 15th byte (at or above sp)
|
||||
end = (char*)((ptr_int_t)((uint32_t)end | 0x0000000F)); // Align end_free_memory to the 15th byte (at or above end_free_memory)
|
||||
dump_free_memory(start, end);
|
||||
}
|
||||
|
||||
@@ -152,17 +193,15 @@ inline int32_t count_test_bytes(const char * const ptr) {
|
||||
inline int check_for_free_memory_corruption(PGM_P const title) {
|
||||
serialprintPGM(title);
|
||||
|
||||
char *ptr = END_OF_HEAP(), *sp = top_of_stack();
|
||||
int n = sp - ptr;
|
||||
char *start_free_memory = free_memory_start, *end_free_memory = free_memory_end;
|
||||
int n = end_free_memory - start_free_memory;
|
||||
|
||||
SERIAL_ECHOPAIR("\nfmc() n=", n);
|
||||
SERIAL_ECHOPAIR("\n&__brkval: ", hex_address(&__brkval));
|
||||
SERIAL_ECHOPAIR("=", hex_address(__brkval));
|
||||
SERIAL_ECHOPAIR("\n__bss_end: ", hex_address(&__bss_end));
|
||||
SERIAL_ECHOPAIR(" sp=", hex_address(sp));
|
||||
SERIAL_ECHOPAIR("\nfree_memory_start=", hex_address(free_memory_start));
|
||||
SERIAL_ECHOLNPAIR(" end_free_memory=", hex_address(end_free_memory));
|
||||
|
||||
if (sp < ptr) {
|
||||
SERIAL_ECHOPGM(" sp < Heap ");
|
||||
if (end_free_memory < start_free_memory) {
|
||||
SERIAL_ECHOPGM(" end_free_memory < Heap ");
|
||||
// SET_INPUT_PULLUP(63); // if the developer has a switch wired up to their controller board
|
||||
// safe_delay(5); // this code can be enabled to pause the display as soon as the
|
||||
// while ( READ(63)) // malfunction is detected. It is currently defaulting to a switch
|
||||
@@ -172,29 +211,29 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
|
||||
// idle();
|
||||
serial_delay(20);
|
||||
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
||||
M100_dump_routine(PSTR(" Memory corruption detected with sp<Heap\n"), (char*)0x1B80, (char*)0x21FF);
|
||||
M100_dump_routine(PSTR(" Memory corruption detected with end_free_memory<Heap\n"), (char*)0x1B80, (char*)0x21FF);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Scan through the range looking for the biggest block of 0xE5's we can find
|
||||
int block_cnt = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (ptr[i] == TEST_BYTE) {
|
||||
int32_t j = count_test_bytes(ptr + i);
|
||||
if (start_free_memory[i] == TEST_BYTE) {
|
||||
int32_t j = count_test_bytes(start_free_memory + i);
|
||||
if (j > 8) {
|
||||
// SERIAL_ECHOPAIR("Found ", j);
|
||||
// SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(ptr + i));
|
||||
// SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(start_free_memory + i));
|
||||
i += j;
|
||||
block_cnt++;
|
||||
SERIAL_ECHOPAIR(" (", block_cnt);
|
||||
SERIAL_ECHOPAIR(") found=", j);
|
||||
SERIAL_ECHOPGM(" ");
|
||||
SERIAL_ECHOLNPGM(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
SERIAL_ECHOPAIR(" block_found=", block_cnt);
|
||||
|
||||
if (block_cnt != 1 || __brkval != NULL)
|
||||
if (block_cnt != 1)
|
||||
SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
|
||||
|
||||
if (block_cnt == 0) // Make sure the special case of no free blocks shows up as an
|
||||
@@ -215,12 +254,12 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
|
||||
* Return the number of free bytes in the memory pool,
|
||||
* with other vital statistics defining the pool.
|
||||
*/
|
||||
inline void free_memory_pool_report(char * const ptr, const int32_t size) {
|
||||
inline void free_memory_pool_report(char * const start_free_memory, const int32_t size) {
|
||||
int32_t max_cnt = -1, block_cnt = 0;
|
||||
char *max_addr = NULL;
|
||||
char *max_addr = nullptr;
|
||||
// Find the longest block of test bytes in the buffer
|
||||
for (int32_t i = 0; i < size; i++) {
|
||||
char *addr = ptr + i;
|
||||
char *addr = start_free_memory + i;
|
||||
if (*addr == TEST_BYTE) {
|
||||
const int32_t j = count_test_bytes(addr);
|
||||
if (j > 8) {
|
||||
@@ -249,14 +288,14 @@ inline void free_memory_pool_report(char * const ptr, const int32_t size) {
|
||||
* Corrupt <num> locations in the free memory pool and report the corrupt addresses.
|
||||
* This is useful to check the correctness of the M100 D and the M100 F commands.
|
||||
*/
|
||||
inline void corrupt_free_memory(char *ptr, const uint32_t size) {
|
||||
ptr += 8;
|
||||
const uint32_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack.
|
||||
inline void corrupt_free_memory(char *start_free_memory, const uint32_t size) {
|
||||
start_free_memory += 8;
|
||||
const uint32_t near_top = top_of_stack() - start_free_memory - 250, // -250 to avoid interrupt activity that's altered the stack.
|
||||
j = near_top / (size + 1);
|
||||
|
||||
SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
|
||||
for (uint32_t i = 1; i <= size; i++) {
|
||||
char * const addr = ptr + i * j;
|
||||
char * const addr = start_free_memory + i * j;
|
||||
*addr = i;
|
||||
SERIAL_ECHOPAIR("\nCorrupting address: ", hex_address(addr));
|
||||
}
|
||||
@@ -268,7 +307,7 @@ inline void free_memory_pool_report(char * const ptr, const int32_t size) {
|
||||
* M100 I
|
||||
* Init memory for the M100 tests. (Automatically applied on the first M100.)
|
||||
*/
|
||||
inline void init_free_memory(char *ptr, int32_t size) {
|
||||
inline void init_free_memory(char *start_free_memory, int32_t size) {
|
||||
SERIAL_ECHOLNPGM("Initializing free memory block.\n\n");
|
||||
|
||||
size -= 250; // -250 to avoid interrupt activity that's altered the stack.
|
||||
@@ -277,17 +316,17 @@ inline void init_free_memory(char *ptr, int32_t size) {
|
||||
return;
|
||||
}
|
||||
|
||||
ptr += 8; // move a few bytes away from the heap just because we don't want
|
||||
start_free_memory += 8; // move a few bytes away from the heap just because we don't want
|
||||
// to be altering memory that close to it.
|
||||
memset(ptr, TEST_BYTE, size);
|
||||
memset(start_free_memory, TEST_BYTE, size);
|
||||
|
||||
SERIAL_ECHO(size);
|
||||
SERIAL_ECHOLNPGM(" bytes of memory initialized.\n");
|
||||
|
||||
for (int32_t i = 0; i < size; i++) {
|
||||
if (ptr[i] != TEST_BYTE) {
|
||||
SERIAL_ECHOPAIR("? address : ", hex_address(ptr + i));
|
||||
SERIAL_ECHOLNPAIR("=", hex_byte(ptr[i]));
|
||||
if (start_free_memory[i] != TEST_BYTE) {
|
||||
SERIAL_ECHOPAIR("? address : ", hex_address(start_free_memory + i));
|
||||
SERIAL_ECHOLNPAIR("=", hex_byte(start_free_memory[i]));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
@@ -297,33 +336,36 @@ inline void init_free_memory(char *ptr, int32_t size) {
|
||||
* M100: Free Memory Check
|
||||
*/
|
||||
void GcodeSuite::M100() {
|
||||
SERIAL_ECHOPAIR("\n__brkval : ", hex_address(__brkval));
|
||||
SERIAL_ECHOPAIR("\n__bss_end : ", hex_address(&__bss_end));
|
||||
|
||||
char *ptr = END_OF_HEAP(), *sp = top_of_stack();
|
||||
|
||||
SERIAL_ECHOPAIR("\nstart of free space : ", hex_address(ptr));
|
||||
SERIAL_ECHOLNPAIR("\nStack Pointer : ", hex_address(sp));
|
||||
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 ));
|
||||
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_ECHOLNPAIR("\nStack Pointer : ", hex_address(sp));
|
||||
|
||||
// Always init on the first invocation of M100
|
||||
static bool m100_not_initialized = true;
|
||||
if (m100_not_initialized || parser.seen('I')) {
|
||||
m100_not_initialized = false;
|
||||
init_free_memory(ptr, sp - ptr);
|
||||
init_free_memory(free_memory_start, free_memory_end - free_memory_start);
|
||||
}
|
||||
|
||||
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
||||
if (parser.seen('D'))
|
||||
return dump_free_memory(ptr, sp);
|
||||
return dump_free_memory(free_memory_start, free_memory_end);
|
||||
#endif
|
||||
|
||||
if (parser.seen('F'))
|
||||
return free_memory_pool_report(ptr, sp - ptr);
|
||||
return free_memory_pool_report(free_memory_start, free_memory_end - free_memory_start);
|
||||
|
||||
#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
|
||||
|
||||
if (parser.seen('C'))
|
||||
return corrupt_free_memory(ptr, parser.value_int());
|
||||
return corrupt_free_memory(free_memory_start, parser.value_int());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -24,20 +24,9 @@
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
|
||||
#include "../../feature/backlash.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
|
||||
uint8_t backlash_correction = BACKLASH_CORRECTION * all_on;
|
||||
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM;
|
||||
#endif
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
float backlash_measured_mm[XYZ] = { 0 };
|
||||
uint8_t backlash_measured_num[XYZ] = { 0 };
|
||||
#endif
|
||||
|
||||
#include "../gcode.h"
|
||||
|
||||
/**
|
||||
@@ -60,59 +49,52 @@ void GcodeSuite::M425() {
|
||||
LOOP_XYZ(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
planner.synchronize();
|
||||
const float measured_backlash = (
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
backlash_measured_num[i] > 0 ? backlash_measured_mm[i] / backlash_measured_num[i] : 0
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
);
|
||||
backlash_distance_mm[i] = parser.has_value() ? parser.value_linear_units() : measured_backlash;
|
||||
backlash.distance_mm[i] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(i);
|
||||
noArgs = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.seen('F')) {
|
||||
planner.synchronize();
|
||||
backlash_correction = MAX(0, MIN(1.0, parser.value_float())) * all_on;
|
||||
backlash.set_correction(parser.value_float());
|
||||
noArgs = false;
|
||||
}
|
||||
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
if (parser.seen('S')) {
|
||||
planner.synchronize();
|
||||
backlash_smoothing_mm = parser.value_linear_units();
|
||||
backlash.smoothing_mm = parser.value_linear_units();
|
||||
noArgs = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (noArgs) {
|
||||
SERIAL_ECHOPGM("Backlash correction is ");
|
||||
if (!backlash_correction) SERIAL_ECHOPGM("in");
|
||||
SERIAL_ECHOPGM("Backlash Correction ");
|
||||
if (!backlash.correction) SERIAL_ECHOPGM("in");
|
||||
SERIAL_ECHOLNPGM("active:");
|
||||
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", float(ui8_to_percent(backlash_correction)) / 100, " (F1.0 = full, F0.0 = none)");
|
||||
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
|
||||
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
|
||||
LOOP_XYZ(a) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_ECHO(backlash_distance_mm[a]);
|
||||
SERIAL_ECHO(backlash.distance_mm[a]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
SERIAL_ECHOLNPAIR(" Smoothing (mm): S", backlash_smoothing_mm);
|
||||
SERIAL_ECHOLNPAIR(" Smoothing (mm): S", backlash.smoothing_mm);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
SERIAL_ECHOPGM(" Average measured backlash (mm):");
|
||||
LOOP_XYZ(a) {
|
||||
if (backlash_measured_num[a] > 0) {
|
||||
if (backlash.has_any_measurement()) {
|
||||
LOOP_XYZ(a) if (backlash.has_measurement(a)) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_ECHO(backlash_measured_mm[a] / backlash_measured_num[a]);
|
||||
SERIAL_ECHO(backlash.get_measurement(a));
|
||||
}
|
||||
}
|
||||
if (!backlash_measured_num[X_AXIS] && !backlash_measured_num[Y_AXIS] && !backlash_measured_num[Z_AXIS])
|
||||
else
|
||||
SERIAL_ECHOPGM(" (Not yet measured)");
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* 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 HAS_USER_THERMISTORS
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/temperature.h"
|
||||
|
||||
/**
|
||||
* M305: Set (or report) custom thermistor parameters
|
||||
*
|
||||
* P[index] Thermistor table index
|
||||
* R[ohms] Pullup resistor value
|
||||
* T[ohms] Resistance at 25C
|
||||
* B[beta] Thermistor "beta" value
|
||||
* C[coeff] Steinhart-Hart Coefficient 'C'
|
||||
*
|
||||
* Format: M305 P[tbl_index] R[pullup_resistor_val] T[therm_25C_resistance] B[therm_beta] C[Steinhart_Hart_C_coeff]
|
||||
*
|
||||
* Examples: M305 P0 R4700 T100000 B3950 C0.0
|
||||
* M305 P0 R4700
|
||||
* M305 P0 T100000
|
||||
* M305 P0 B3950
|
||||
* M305 P0 C0.0
|
||||
*/
|
||||
void GcodeSuite::M305() {
|
||||
const int8_t t_index = parser.intval('P', -1);
|
||||
const bool do_set = parser.seen("BCRT");
|
||||
|
||||
// A valid P index is required
|
||||
if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("!Invalid index. (0 <= P <= ", int(USER_THERMISTORS - 1), ")");
|
||||
}
|
||||
else if (do_set) {
|
||||
if (parser.seen('R')) // Pullup resistor value
|
||||
if (!thermalManager.set_pull_up_res(t_index, parser.value_float()))
|
||||
SERIAL_ECHO_MSG("!Invalid series resistance. (0 < R < 1000000)");
|
||||
|
||||
if (parser.seen('T')) // Resistance at 25C
|
||||
if (!thermalManager.set_res25(t_index, parser.value_float()))
|
||||
SERIAL_ECHO_MSG("!Invalid 25C resistance. (0 < T < 10000000)");
|
||||
|
||||
if (parser.seen('B')) // Beta value
|
||||
if (!thermalManager.set_beta(t_index, parser.value_float()))
|
||||
SERIAL_ECHO_MSG("!Invalid beta. (0 < B < 1000000)");
|
||||
|
||||
if (parser.seen('C')) // Steinhart-Hart C coefficient
|
||||
if (!thermalManager.set_sh_coeff(t_index, parser.value_float()))
|
||||
SERIAL_ECHO_MSG("!Invalid Steinhart-Hart C coeff. (-0.01 < C < +0.01)");
|
||||
} // If not setting then report parameters
|
||||
else if (t_index < 0) { // ...all user thermistors
|
||||
for (uint8_t i = 0; i < USER_THERMISTORS; i++)
|
||||
thermalManager.log_user_thermistor(i);
|
||||
}
|
||||
else // ...one user thermistor
|
||||
thermalManager.log_user_thermistor(t_index);
|
||||
}
|
||||
|
||||
#endif // HAS_USER_THERMISTORS
|
||||
@@ -97,7 +97,7 @@ void GcodeSuite::M81() {
|
||||
thermalManager.zero_fan_speeds();
|
||||
#if ENABLED(PROBING_FANS_OFF)
|
||||
thermalManager.fans_paused = false;
|
||||
ZERO(thermalManager.paused_fan_speed);
|
||||
ZERO(thermalManager.saved_fan_speed);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
#include "../../../lcd/menu/menu_mmu2.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
#include "../../../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M600: Pause for filament change
|
||||
*
|
||||
@@ -58,8 +62,21 @@
|
||||
void GcodeSuite::M600() {
|
||||
point_t park_point = NOZZLE_PARK_POINT;
|
||||
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
const int8_t target_e_stepper = get_target_e_stepper_from_command();
|
||||
if (target_e_stepper < 0) return;
|
||||
|
||||
const uint8_t old_mixing_tool = mixer.get_current_vtool();
|
||||
mixer.T(MIXER_DIRECT_SET_TOOL);
|
||||
|
||||
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, i == uint8_t(target_e_stepper) ? 1.0 : 0.0);
|
||||
mixer.normalize();
|
||||
|
||||
const int8_t target_extruder = active_extruder;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#endif
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
int8_t DXC_ext = target_extruder;
|
||||
@@ -155,6 +172,10 @@ void GcodeSuite::M600() {
|
||||
if (active_extruder_before_filament_change != active_extruder)
|
||||
tool_change(active_extruder_before_filament_change, 0, false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
||||
@@ -42,10 +42,15 @@
|
||||
#include "../../../feature/prusa_MMU2/mmu2.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
#include "../../../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M701: Load filament
|
||||
*
|
||||
* T<extruder> - Optional extruder number. Current extruder if omitted.
|
||||
* T<extruder> - Extruder number. Required for mixing extruder.
|
||||
* For non-mixing, current extruder if omitted.
|
||||
* Z<distance> - Move the Z axis by this distance
|
||||
* L<distance> - Extrude distance for insertion (positive value) (manual reload)
|
||||
*
|
||||
@@ -59,9 +64,21 @@ void GcodeSuite::M701() {
|
||||
if (axis_unhomed_error()) park_point.z = 0;
|
||||
#endif
|
||||
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
const int8_t target_e_stepper = get_target_e_stepper_from_command();
|
||||
if (target_e_stepper < 0) return;
|
||||
|
||||
const uint8_t old_mixing_tool = mixer.get_current_vtool();
|
||||
mixer.T(MIXER_DIRECT_SET_TOOL);
|
||||
|
||||
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, (i == (uint8_t)target_e_stepper) ? 1.0 : 0.0);
|
||||
mixer.normalize();
|
||||
|
||||
const int8_t target_extruder = active_extruder;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#endif
|
||||
|
||||
// Z axis lift
|
||||
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
|
||||
@@ -107,6 +124,10 @@ void GcodeSuite::M701() {
|
||||
tool_change(active_extruder_before_filament_change, 0, false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
||||
#endif
|
||||
|
||||
// Show status screen
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
@@ -116,7 +137,8 @@ void GcodeSuite::M701() {
|
||||
/**
|
||||
* M702: Unload filament
|
||||
*
|
||||
* T<extruder> - Optional extruder number. If omitted, current extruder
|
||||
* T<extruder> - Extruder number. Required for mixing extruder.
|
||||
* For non-mixing, if omitted, current extruder
|
||||
* (or ALL extruders with FILAMENT_UNLOAD_ALL_EXTRUDERS).
|
||||
* Z<distance> - Move the Z axis by this distance
|
||||
* U<distance> - Retract distance for removal (manual reload)
|
||||
@@ -131,8 +153,31 @@ void GcodeSuite::M702() {
|
||||
if (axis_unhomed_error()) park_point.z = 0;
|
||||
#endif
|
||||
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
const uint8_t old_mixing_tool = mixer.get_current_vtool();
|
||||
|
||||
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
||||
float mix_multiplier = 1.0;
|
||||
if (!parser.seenval('T')) {
|
||||
mixer.T(MIXER_AUTORETRACT_TOOL);
|
||||
mix_multiplier = MIXING_STEPPERS;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const int8_t target_e_stepper = get_target_e_stepper_from_command();
|
||||
if (target_e_stepper < 0) return;
|
||||
|
||||
mixer.T(MIXER_DIRECT_SET_TOOL);
|
||||
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, (i == (uint8_t)target_e_stepper) ? 1.0 : 0.0);
|
||||
mixer.normalize();
|
||||
}
|
||||
|
||||
const int8_t target_extruder = active_extruder;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#endif
|
||||
|
||||
// Z axis lift
|
||||
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
|
||||
@@ -171,7 +216,11 @@ void GcodeSuite::M702() {
|
||||
const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS)
|
||||
: fc_settings[target_extruder].unload_length);
|
||||
|
||||
unload_filament(unload_length, true, PAUSE_MODE_UNLOAD_FILAMENT);
|
||||
unload_filament(unload_length, true, PAUSE_MODE_UNLOAD_FILAMENT
|
||||
#if ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
, mix_multiplier
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -185,6 +234,10 @@ void GcodeSuite::M702() {
|
||||
tool_change(active_extruder_before_filament_change, 0, false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
||||
#endif
|
||||
|
||||
// Show status screen
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
*/
|
||||
void GcodeSuite::M412() {
|
||||
if (parser.seen("HS"
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
"D"
|
||||
#endif
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
"R"
|
||||
#endif
|
||||
@@ -42,11 +45,17 @@ void GcodeSuite::M412() {
|
||||
const bool seenR = parser.seen('R'), seenS = parser.seen('S');
|
||||
if (seenR || seenS) runout.reset();
|
||||
if (seenS) runout.enabled = parser.value_bool();
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
if (parser.seen('D')) runout.set_runout_distance(parser.value_linear_units());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Filament runout ");
|
||||
serialprintln_onoff(runout.enabled);
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
SERIAL_ECHOLNPAIR("Filament runout distance (mm): ", runout.runout_distance());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,17 +72,32 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
||||
int8_t GcodeSuite::get_target_extruder_from_command() {
|
||||
if (parser.seenval('T')) {
|
||||
const int8_t e = parser.value_byte();
|
||||
if (e >= EXTRUDERS) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
|
||||
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", int(e));
|
||||
return -1;
|
||||
}
|
||||
return e;
|
||||
if (e < EXTRUDERS) return e;
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
|
||||
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", int(e));
|
||||
return -1;
|
||||
}
|
||||
return active_extruder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the target e stepper from the T parameter
|
||||
* Return -1 if the T parameter is out of range or unspecified
|
||||
*/
|
||||
int8_t GcodeSuite::get_target_e_stepper_from_command() {
|
||||
const int8_t e = parser.intval('T', -1);
|
||||
if (WITHIN(e, 0, E_STEPPERS - 1)) return e;
|
||||
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
|
||||
if (e == -1)
|
||||
SERIAL_ECHOLNPGM(" " MSG_E_STEPPER_NOT_SPECIFIED);
|
||||
else
|
||||
SERIAL_ECHOLNPAIR(" " MSG_INVALID_E_STEPPER " ", int(e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set XYZE destination and feedrate from the current GCode command
|
||||
*
|
||||
@@ -574,6 +589,10 @@ void GcodeSuite::process_parsed_command(
|
||||
case 303: M303(); break; // M303: PID autotune
|
||||
#endif
|
||||
|
||||
#if HAS_USER_THERMISTORS
|
||||
case 305: M305(); break; // M305: Set user thermistor parameters
|
||||
#endif
|
||||
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
case 360: if (M360()) return; break; // M360: SCARA Theta pos1
|
||||
case 361: if (M361()) return; break; // M361: SCARA Theta pos2
|
||||
|
||||
@@ -184,6 +184,7 @@
|
||||
* M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. (Requires PREVENT_COLD_EXTRUSION)
|
||||
* M303 - PID relay autotune S<temperature> sets the target temperature. Default 150C. (Requires PIDTEMP)
|
||||
* M304 - Set bed PID parameters P I and D. (Requires PIDTEMPBED)
|
||||
* M305 - Set user thermistor parameters R T and P. (Requires TEMP_SENSOR_x 1000)
|
||||
* M350 - Set microstepping mode. (Requires digital microstepping pins.)
|
||||
* M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
|
||||
* M355 - Set Case Light on/off and set brightness. (Requires CASE_LIGHT_PIN)
|
||||
@@ -298,6 +299,7 @@ public:
|
||||
FORCE_INLINE static void reset_stepper_timeout() { previous_move_ms = millis(); }
|
||||
|
||||
static int8_t get_target_extruder_from_command();
|
||||
static int8_t get_target_e_stepper_from_command();
|
||||
static void get_destination_from_command();
|
||||
|
||||
static void process_parsed_command(
|
||||
@@ -685,6 +687,10 @@ private:
|
||||
static void M304();
|
||||
#endif
|
||||
|
||||
#if HAS_USER_THERMISTORS
|
||||
static void M305();
|
||||
#endif
|
||||
|
||||
#if HAS_MICROSTEPS
|
||||
static void M350();
|
||||
static void M351();
|
||||
|
||||
@@ -152,7 +152,7 @@ void GcodeSuite::M115() {
|
||||
|
||||
// THERMAL_PROTECTION
|
||||
cap_line(PSTR("THERMAL_PROTECTION")
|
||||
#if BOTH(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_BED)
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && (ENABLED(THERMAL_PROTECTION_BED) || !HAS_HEATED_BED) && (ENABLED(THERMAL_PROTECTION_CHAMBER) || !HAS_HEATED_CHAMBER)
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -80,7 +80,7 @@ GCodeParser parser;
|
||||
* this may be optimized by commenting out ZERO(param)
|
||||
*/
|
||||
void GCodeParser::reset() {
|
||||
string_arg = NULL; // No whole line argument
|
||||
string_arg = nullptr; // No whole line argument
|
||||
command_letter = '?'; // No command letter
|
||||
codenum = 0; // No command code
|
||||
#if USE_GCODE_SUBCODES
|
||||
@@ -245,7 +245,7 @@ void GCodeParser::parse(char *p) {
|
||||
* This allows M0/M1 with expire time to work: "M0 S5 You Win!"
|
||||
* For 'M118' you must use 'E1' and 'A1' rather than just 'E' or 'A'
|
||||
*/
|
||||
string_arg = NULL;
|
||||
string_arg = nullptr;
|
||||
while (const char code = *p++) { // Get the next parameter. A NUL ends the loop
|
||||
|
||||
// Special handling for M32 [P] !/path/to/file.g#
|
||||
@@ -289,7 +289,7 @@ void GCodeParser::parse(char *p) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(FASTER_GCODE_PARSER)
|
||||
set(code, has_num ? p : NULL); // Set parameter exists and pointer (NULL for no number)
|
||||
set(code, has_num ? p : nullptr); // Set parameter exists and pointer (nullptr for no number)
|
||||
#endif
|
||||
}
|
||||
else if (!string_arg) { // Not A-Z? First time, keep as the string_arg
|
||||
@@ -315,7 +315,7 @@ void GCodeParser::parse(char *p) {
|
||||
if (next_command) {
|
||||
while (*next_command && *next_command != ' ') ++next_command;
|
||||
while (*next_command == ' ') ++next_command;
|
||||
if (!*next_command) next_command = NULL;
|
||||
if (!*next_command) next_command = nullptr;
|
||||
}
|
||||
#else
|
||||
const char *next_command = command_args;
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
const bool b = TEST32(codebits, ind);
|
||||
if (b) {
|
||||
char * const ptr = command_ptr + param[ind];
|
||||
value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL;
|
||||
value_ptr = param[ind] && valid_float(ptr) ? ptr : nullptr;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
static inline bool seen(const char c) {
|
||||
char *p = strchr(command_args, c);
|
||||
const bool b = !!p;
|
||||
if (b) value_ptr = valid_float(&p[1]) ? &p[1] : (char*)NULL;
|
||||
if (b) value_ptr = valid_float(&p[1]) ? &p[1] : nullptr;
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
#endif
|
||||
|
||||
// The code value pointer was set
|
||||
FORCE_INLINE static bool has_value() { return value_ptr != NULL; }
|
||||
FORCE_INLINE static bool has_value() { return value_ptr != nullptr; }
|
||||
|
||||
// Seen a parameter with a value
|
||||
static inline bool seenval(const char c) { return seen(c) && has_value(); }
|
||||
@@ -224,20 +224,20 @@ public:
|
||||
if (c == '\0' || c == ' ') break;
|
||||
if (c == 'E' || c == 'e') {
|
||||
*e = '\0';
|
||||
const float ret = strtof(value_ptr, NULL);
|
||||
const float ret = strtof(value_ptr, nullptr);
|
||||
*e = c;
|
||||
return ret;
|
||||
}
|
||||
++e;
|
||||
}
|
||||
return strtof(value_ptr, NULL);
|
||||
return strtof(value_ptr, nullptr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Code value as a long or ulong
|
||||
static inline int32_t value_long() { return value_ptr ? strtol(value_ptr, NULL, 10) : 0L; }
|
||||
static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, NULL, 10) : 0UL; }
|
||||
static inline int32_t value_long() { return value_ptr ? strtol(value_ptr, nullptr, 10) : 0L; }
|
||||
static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, nullptr, 10) : 0UL; }
|
||||
|
||||
// Code value for use as time
|
||||
static inline millis_t value_millis() { return value_ulong(); }
|
||||
|
||||
+10
-10
@@ -76,11 +76,11 @@ static int serial_count[NUM_SERIAL] = { 0 };
|
||||
bool send_ok[BUFSIZE];
|
||||
|
||||
/**
|
||||
* Next Injected Command pointer. NULL if no commands are being injected.
|
||||
* Next Injected Command pointer. nullptr if no commands are being injected.
|
||||
* Used by Marlin internally to ensure that commands initiated from within
|
||||
* are enqueued ahead of any pending serial or sd card commands.
|
||||
*/
|
||||
static PGM_P injected_commands_P = NULL;
|
||||
static PGM_P injected_commands_P = nullptr;
|
||||
|
||||
void queue_setup() {
|
||||
// Send "ok" after commands by default
|
||||
@@ -157,7 +157,7 @@ bool enqueue_and_echo_command(const char* cmd) {
|
||||
* Return true if any immediate commands remain to inject.
|
||||
*/
|
||||
static bool drain_injected_commands_P() {
|
||||
if (injected_commands_P != NULL) {
|
||||
if (injected_commands_P != nullptr) {
|
||||
size_t i = 0;
|
||||
char c, cmd[60];
|
||||
strncpy_P(cmd, injected_commands_P, sizeof(cmd) - 1);
|
||||
@@ -165,9 +165,9 @@ static bool drain_injected_commands_P() {
|
||||
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 : NULL; // next command or done
|
||||
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr; // next command or done
|
||||
}
|
||||
return (injected_commands_P != NULL); // return whether any more remain
|
||||
return (injected_commands_P != nullptr); // return whether any more remain
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -597,18 +597,18 @@ inline void get_serial_commands() {
|
||||
char* command = serial_line_buffer[i];
|
||||
|
||||
while (*command == ' ') command++; // Skip leading spaces
|
||||
char *npos = (*command == 'N') ? command : NULL; // Require the N parameter to start the line
|
||||
char *npos = (*command == 'N') ? command : nullptr; // Require the N parameter to start the line
|
||||
|
||||
if (npos) {
|
||||
|
||||
bool M110 = strstr_P(command, PSTR("M110")) != NULL;
|
||||
bool M110 = strstr_P(command, PSTR("M110")) != nullptr;
|
||||
|
||||
if (M110) {
|
||||
char* n2pos = strchr(command + 4, 'N');
|
||||
if (n2pos) npos = n2pos;
|
||||
}
|
||||
|
||||
gcode_N = strtol(npos + 1, NULL, 10);
|
||||
gcode_N = strtol(npos + 1, nullptr, 10);
|
||||
|
||||
if (gcode_N != gcode_LastN + 1 && !M110)
|
||||
return gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
|
||||
@@ -617,7 +617,7 @@ inline void get_serial_commands() {
|
||||
if (apos) {
|
||||
uint8_t checksum = 0, count = uint8_t(apos - command);
|
||||
while (count) checksum ^= command[--count];
|
||||
if (strtol(apos + 1, NULL, 10) != checksum)
|
||||
if (strtol(apos + 1, nullptr, 10) != checksum)
|
||||
return gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
|
||||
}
|
||||
else
|
||||
@@ -635,7 +635,7 @@ inline void get_serial_commands() {
|
||||
if (IsStopped()) {
|
||||
char* gpos = strchr(command, 'G');
|
||||
if (gpos) {
|
||||
switch (strtol(gpos + 1, NULL, 10)) {
|
||||
switch (strtol(gpos + 1, nullptr, 10)) {
|
||||
case 0:
|
||||
case 1:
|
||||
#if ENABLED(ARC_SUPPORT)
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
/**
|
||||
* M23: Open a file
|
||||
*
|
||||
* The path is relative to the root directory
|
||||
*/
|
||||
void GcodeSuite::M23() {
|
||||
// Simplify3D includes the size, so zero out all spaces (#7227)
|
||||
|
||||
@@ -60,7 +60,7 @@ void GcodeSuite::M191() {
|
||||
|
||||
const bool no_wait_for_cooling = parser.seenval('S');
|
||||
if (no_wait_for_cooling || parser.seenval('R')) {
|
||||
thermalManager.setTargetBed(parser.value_celsius());
|
||||
thermalManager.setTargetChamber(parser.value_celsius());
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
if (parser.value_celsius() > BED_MINTEMP)
|
||||
print_job_timer.start();
|
||||
@@ -68,9 +68,9 @@ void GcodeSuite::M191() {
|
||||
}
|
||||
else return;
|
||||
|
||||
lcd_setstatusPGM(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING));
|
||||
lcd_setstatusPGM(thermalManager.isHeatingChamber() ? PSTR(MSG_CHAMBER_HEATING) : PSTR(MSG_CHAMBER_COOLING));
|
||||
|
||||
thermalManager.wait_for_bed(no_wait_for_cooling);
|
||||
thermalManager.wait_for_chamber(no_wait_for_cooling);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user