Merge pull request #3279 from thinkyhead/rc_filament_width_sensor

FILAMENT_SENSOR -> FILAMENT_WIDTH_SENSOR
This commit is contained in:
Scott Lahteine 2016-03-30 12:16:27 -07:00
commit de333c4fea
32 changed files with 90 additions and 94 deletions

View File

@ -124,11 +124,11 @@ script:
- build_marlin
# Enable filament sensor
- restore_configs
- opt_enable FILAMENT_SENSOR
- opt_enable FILAMENT_WIDTH_SENSOR
- build_marlin
# Enable filament sensor with LCD display
- restore_configs
- opt_enable ULTIMAKERCONTROLLER FILAMENT_SENSOR FILAMENT_LCD_DISPLAY
- opt_enable ULTIMAKERCONTROLLER FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY
- build_marlin
# Enable COREXY
- restore_configs

View File

@ -513,7 +513,7 @@
#define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
#define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
#define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
#define HAS_FILAMENT_SENSOR (ENABLED(FILAMENT_SENSOR) && PIN_EXISTS(FILWIDTH))
#define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
#define HAS_FILRUNOUT (PIN_EXISTS(FILRUNOUT))
#define HAS_HOME (PIN_EXISTS(HOME))
#define HAS_KILL (PIN_EXISTS(KILL))

View File

@ -920,11 +920,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -336,7 +336,7 @@ extern bool axis_homed[3]; // axis[n].is_homed
extern int EtoPPressure;
#endif
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
extern float filament_width_nominal; //holds the theoretical filament diameter i.e., 3.00 or 1.75
extern bool filament_sensor; //indicates that filament sensor readings should control extrusion
extern float filament_width_meas; //holds the filament diameter as accurately measured

View File

@ -405,7 +405,7 @@ static uint8_t target_extruder;
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
#endif
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
//Variables for Filament Sensor input
float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404
bool filament_sensor = false; //M405 turns on filament_sensor control, M406 turns it off
@ -5454,13 +5454,12 @@ inline void gcode_M400() { st_synchronize(); }
#endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
/**
* M404: Display or set the nominal filament width (3mm, 1.75mm ) W<3.0>
*/
inline void gcode_M404() {
#if HAS_FILWIDTH
if (code_seen('W')) {
filament_width_nominal = code_value();
}
@ -5468,7 +5467,6 @@ inline void gcode_M400() { st_synchronize(); }
SERIAL_PROTOCOLPGM("Filament dia (nominal mm):");
SERIAL_PROTOCOLLN(filament_width_nominal);
}
#endif
}
/**
@ -5508,7 +5506,7 @@ inline void gcode_M400() { st_synchronize(); }
SERIAL_PROTOCOLLN(filament_width_meas);
}
#endif // FILAMENT_SENSOR
#endif // FILAMENT_WIDTH_SENSOR
/**
* M410: Quickstop - Abort all planned moves
@ -6550,7 +6548,7 @@ void process_next_command() {
break;
#endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
gcode_M404();
break;
@ -6563,7 +6561,7 @@ void process_next_command() {
case 407: //M407 Display measured filament diameter
gcode_M407();
break;
#endif // FILAMENT_SENSOR
#endif // ENABLED(FILAMENT_WIDTH_SENSOR)
case 410: // M410 quickstop - Abort all the planned moves.
gcode_M410();

View File

@ -275,6 +275,14 @@
#endif // AUTO_BED_LEVELING_FEATURE
/**
* Filament Width Sensor
*/
#if ENABLED(FILAMENT_WIDTH_SENSOR) && !HAS_FILAMENT_WIDTH_SENSOR
#error FILAMENT_WIDTH_SENSOR requires a FILWIDTH_PIN to be defined.
#endif
/**
* ULTIPANEL encoder
*/
@ -446,6 +454,8 @@
#error SDEXTRASLOW deprecated - set SPI_SPEED to SPI_QUARTER_SPEED instead
#elif defined(Z_RAISE_BEFORE_HOMING)
#error Z_RAISE_BEFORE_HOMING is deprecated. Use MIN_Z_HEIGHT_FOR_HOMING instead.
#elif defined(FILAMENT_SENSOR)
#error FILAMENT_SENSOR is deprecated. Use FILAMENT_WIDTH_SENSOR instead.
#endif
#endif //SANITYCHECK_H

View File

@ -903,11 +903,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -900,11 +900,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -915,11 +915,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -917,11 +917,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -937,11 +937,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -920,11 +920,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -922,11 +922,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -928,11 +928,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -941,11 +941,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -912,11 +912,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -920,11 +920,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -1049,11 +1049,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -1049,11 +1049,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -1053,11 +1053,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -1046,11 +1046,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -956,11 +956,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -923,11 +923,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -914,11 +914,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
// Uncomment below to enable
//#define FILAMENT_SENSOR
//#define FILAMENT_WIDTH_SENSOR
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.00 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2)
#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel

View File

@ -74,10 +74,7 @@
#endif
#endif // VIKI2/miniVIKI
#if ENABLED(FILAMENT_SENSOR)
//Filip added pin for Filament sensor analog input
#define FILWIDTH_PIN 3
#endif
#define FILWIDTH_PIN 3 // ANALOG NUMBERING
/************************************************
* Rambo pin assignments old

View File

@ -79,9 +79,7 @@
#define TEMP_0_PIN 1 // Extruder / Analog pin numbering
#define TEMP_BED_PIN 0 // Bed / Analog pin numbering
#if ENABLED(FILAMENT_SENSOR)
#define FILWIDTH_PIN 2
#endif
#define FILWIDTH_PIN 2 // ANALOG NUMBERING
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1

View File

@ -73,9 +73,7 @@
#define TEMP_0_PIN 1 // Extruder / Analog pin numbering
#define TEMP_BED_PIN 0 // Bed / Analog pin numbering
#if ENABLED(FILAMENT_SENSOR)
#define FILWIDTH_PIN 2
#endif
#define FILWIDTH_PIN 2 // ANALOG NUMBERING
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1

View File

@ -112,6 +112,8 @@
#define LED_PIN 13
#define FAN_PIN 8
#define FILWIDTH_PIN 3 // ANALOG NUMBERING
/**********************************************************
Fan Pins
Fan_0 8
@ -201,7 +203,3 @@
#endif
#endif // VIKI2/miniVIKI
#if ENABLED(FILAMENT_SENSOR)
//Filip added pin for Filament sensor analog input
#define FILWIDTH_PIN 3
#endif

View File

@ -91,11 +91,8 @@
#define SDSS 53
#define LED_PIN 13
#if ENABLED(FILAMENT_SENSOR) // FMM added for Filament Extruder
// define analog pin for the filament width sensor input
// Use the RAMPS 1.4 Analog input 5 on the AUX2 connector
#define FILWIDTH_PIN 5
#endif
#define FILWIDTH_PIN 5 // ANALOG NUMBERING
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
// Define a pin to use as the signal pin on Arduino for the Z_PROBE endstop.

View File

@ -851,7 +851,7 @@ float junction_deviation = 0.1;
block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
//FMM update ring buffer used for delay with filament measurements
if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM && delay_index2 > -1) { //only for extruder with filament sensor and if ring buffer is initialized

View File

@ -93,7 +93,7 @@ unsigned char soft_pwm_bed;
volatile int babystepsTodo[3] = { 0 };
#endif
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
#endif
@ -209,7 +209,7 @@ static void updateTemperaturesFromRawValues();
#define SOFT_PWM_SCALE 0
#endif
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
static int meas_shift_index; //used to point to a delayed sample in buffer for filament width sensor
#endif
@ -703,7 +703,7 @@ void manage_heater() {
#endif
// Control the extruder rate based on the width sensor
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
if (filament_sensor) {
meas_shift_index = delay_index1 - meas_delay_cm;
if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed
@ -715,7 +715,7 @@ void manage_heater() {
NOLESS(vm, 0.01);
volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vm;
}
#endif //FILAMENT_SENSOR
#endif //FILAMENT_WIDTH_SENSOR
#if DISABLED(PIDTEMPBED)
if (ms < next_bed_check_ms) return;
@ -849,7 +849,7 @@ static void updateTemperaturesFromRawValues() {
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature = analog2temp(redundant_temperature_raw, 1);
#endif
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_WIDTH_SENSOR)
filament_width_meas = analog2widthFil();
#endif
@ -864,7 +864,7 @@ static void updateTemperaturesFromRawValues() {
}
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
// Convert raw Filament Width to millimeters
float analog2widthFil() {
@ -1003,7 +1003,7 @@ void tp_init() {
#if HAS_TEMP_BED
ANALOG_SELECT(TEMP_BED_PIN);
#endif
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_WIDTH_SENSOR)
ANALOG_SELECT(FILWIDTH_PIN);
#endif
@ -1354,7 +1354,7 @@ ISR(TIMER0_COMPB_vect) {
ISR_STATICS(BED);
#endif
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_WIDTH_SENSOR)
static unsigned long raw_filwidth_value = 0;
#endif
@ -1636,14 +1636,14 @@ ISR(TIMER0_COMPB_vect) {
break;
case Prepare_FILWIDTH:
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_WIDTH_SENSOR)
START_ADC(FILWIDTH_PIN);
#endif
lcd_buttons_update();
temp_state = Measure_FILWIDTH;
break;
case Measure_FILWIDTH:
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_WIDTH_SENSOR)
// raw_filwidth_value += ADC; //remove to use an IIR filter approach
if (ADC > 102) { //check that ADC is reading a voltage > 0.5 volts, otherwise don't take in the data.
raw_filwidth_value -= (raw_filwidth_value >> 7); //multiply raw_filwidth_value by 127/128
@ -1669,7 +1669,7 @@ ISR(TIMER0_COMPB_vect) {
if (!temp_meas_ready) set_current_temp_raw();
// Filament Sensor - can be read any time since IIR filtering is used
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_WIDTH_SENSOR)
current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach
#endif

View File

@ -53,7 +53,7 @@
void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically.
#if ENABLED(FILAMENT_SENSOR)
#if ENABLED(FILAMENT_WIDTH_SENSOR)
// For converting raw Filament Width to milimeters
float analog2widthFil();