diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 8803004f7..7d4b8896b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 8002bc039..558171f46 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -231,6 +231,8 @@ #error "PROBE_DOUBLE_TOUCH is now MULTIPLE_PROBING. Please update your configuration." #elif defined(ANET_KEYPAD_LCD) #error "ANET_KEYPAD_LCD is now ZONESTAR_LCD. Please update your configuration." +#elif defined(MEASURED_LOWER_LIMIT) || defined(MEASURED_UPPER_LIMIT) + #error "MEASURED_(UPPER|LOWER)_LIMIT is now FILWIDTH_ERROR_MARGIN. Please update your configuration." #endif /** diff --git a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h index c1aaeb4b1..695f1a43c 100644 --- a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Anet/A6/Configuration_adv.h b/Marlin/example_configurations/Anet/A6/Configuration_adv.h index ff27fb9a2..5fb2585bc 100644 --- a/Marlin/example_configurations/Anet/A6/Configuration_adv.h +++ b/Marlin/example_configurations/Anet/A6/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Anet/A8/Configuration_adv.h b/Marlin/example_configurations/Anet/A8/Configuration_adv.h index f2644b7ff..ef4215f48 100644 --- a/Marlin/example_configurations/Anet/A8/Configuration_adv.h +++ b/Marlin/example_configurations/Anet/A8/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h b/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h index 9be30ed4a..0754ad82d 100644 --- a/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h index a7742ab97..b0d9c168b 100644 --- a/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 2.00 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.60 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 0.25 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h b/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h index 9be30ed4a..0754ad82d 100644 --- a/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 3274529e6..541d85f14 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h b/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h index 811120766..5c5b15c43 100755 --- a/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h +++ b/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h @@ -1345,8 +1345,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT (DEFAULT_NOMINAL_FILAMENT_DIA+4*DEFAULT_STDDEV_FILAMENT_DIA) // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT (DEFAULT_NOMINAL_FILAMENT_DIA-4*DEFAULT_STDDEV_FILAMENT_DIA) // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN (DEFAULT_STDDEV_FILAMENT_DIA*4) // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index e160214ba..9ffd8961c 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h index 18589d399..ef47b338e 100644 --- a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h b/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h index 7129862d1..b739a09d0 100644 --- a/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Malyan/M150/Configuration_adv.h b/Marlin/example_configurations/Malyan/M150/Configuration_adv.h index 2aca91b10..3082cb92c 100644 --- a/Marlin/example_configurations/Malyan/M150/Configuration_adv.h +++ b/Marlin/example_configurations/Malyan/M150/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h index e5bd595c9..b7d436d7e 100644 --- a/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h @@ -1343,8 +1343,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index a24e54576..3f0fd39fd 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 845b16e51..1479efe32 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Sanguinololu/Configuration_adv.h b/Marlin/example_configurations/Sanguinololu/Configuration_adv.h index 7c755597f..34c8b4f13 100644 --- a/Marlin/example_configurations/Sanguinololu/Configuration_adv.h +++ b/Marlin/example_configurations/Sanguinololu/Configuration_adv.h @@ -1309,8 +1309,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h index 1e75c2200..df6471d7a 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h b/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h index 677c8bf06..63e2ed3f8 100644 --- a/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h @@ -1353,8 +1353,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h b/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h index 89f7f6fef..bd476f719 100644 --- a/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/example_configurations/Wanhao/Duplicator 6/Configuration_adv.h index 1c5cc06ad..60ed13e25 100644 --- a/Marlin/example_configurations/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/example_configurations/Wanhao/Duplicator 6/Configuration_adv.h @@ -1344,8 +1344,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h index 1ba8825da..a165ea79e 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1344,8 +1344,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 1.95 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.20 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h index 91ff478da..15ac614a8 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1344,8 +1344,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 91ff478da..15ac614a8 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -1344,8 +1344,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 91ff478da..15ac614a8 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -1344,8 +1344,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 297c3b658..e2648ea97 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -1349,8 +1349,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index c5df70e4a..94b0bb802 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -1344,8 +1344,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h index e94c72b1e..c9af3121d 100644 --- a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index f4409c9ee..a7d733d22 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 5ce261587..8d6e2e1ed 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -1342,8 +1342,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/wt150/Configuration_adv.h b/Marlin/example_configurations/wt150/Configuration_adv.h index 33c3ebb02..0d936d3a3 100644 --- a/Marlin/example_configurations/wt150/Configuration_adv.h +++ b/Marlin/example_configurations/wt150/Configuration_adv.h @@ -1332,8 +1332,7 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index cc75b4442..750f08467 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1000,7 +1000,7 @@ void Temperature::updateTemperaturesFromRawValues() { * a return value of 1. */ int8_t Temperature::widthFil_to_size_ratio() { - if (WITHIN(filament_width_meas, MEASURED_LOWER_LIMIT, MEASURED_UPPER_LIMIT)) + if (FABS(filament_width_nominal - filament_width_meas) <= FILWIDTH_ERROR_MARGIN) return int(100.0 * filament_width_nominal / filament_width_meas) - 100; return 0; }