|
@@ -740,17 +740,6 @@ float Temperature::get_pid_output(const int8_t e) {
|
740
|
740
|
* - Apply filament width to the extrusion rate (may move)
|
741
|
741
|
* - Update the heated bed PID output value
|
742
|
742
|
*/
|
743
|
|
-
|
744
|
|
-/**
|
745
|
|
- * The following line SOMETIMES results in the dreaded "unable to find a register to spill in class 'POINTER_REGS'"
|
746
|
|
- * compile error.
|
747
|
|
- * thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
|
748
|
|
- *
|
749
|
|
- * This is due to a bug in the C++ compiler used by the Arduino IDE from 1.6.10 to at least 1.8.1.
|
750
|
|
- *
|
751
|
|
- * The work around is to add the compiler flag "__attribute__((__optimize__("O2")))" to the declaration for manage_heater()
|
752
|
|
- */
|
753
|
|
-//void Temperature::manage_heater() __attribute__((__optimize__("O2")));
|
754
|
743
|
void Temperature::manage_heater() {
|
755
|
744
|
|
756
|
745
|
if (!temp_meas_ready) return;
|
|
@@ -805,18 +794,16 @@ void Temperature::manage_heater() {
|
805
|
794
|
}
|
806
|
795
|
#endif
|
807
|
796
|
|
808
|
|
- // Control the extruder rate based on the width sensor
|
809
|
797
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
|
798
|
+ /**
|
|
799
|
+ * Filament Width Sensor dynamically sets the volumetric multiplier
|
|
800
|
+ * based on a delayed measurement of the filament diameter.
|
|
801
|
+ */
|
810
|
802
|
if (filament_sensor) {
|
811
|
803
|
meas_shift_index = filwidth_delay_index[0] - meas_delay_cm;
|
812
|
804
|
if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed
|
813
|
805
|
meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY);
|
814
|
|
-
|
815
|
|
- // Get the delayed info and add 100 to reconstitute to a percent of
|
816
|
|
- // the nominal filament diameter then square it to get an area
|
817
|
|
- const float vmroot = measurement_delay[meas_shift_index] * 0.01 + 1.0;
|
818
|
|
- planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vmroot <= 0.1 ? 0.01 : sq(vmroot);
|
819
|
|
- planner.refresh_e_factor(FILAMENT_SENSOR_EXTRUDER_NUM);
|
|
806
|
+ calculate_volumetric_for_width_sensor(measurement_delay[meas_shift_index])
|
820
|
807
|
}
|
821
|
808
|
#endif // FILAMENT_WIDTH_SENSOR
|
822
|
809
|
|
|
@@ -1004,12 +991,18 @@ void Temperature::updateTemperaturesFromRawValues() {
|
1004
|
991
|
return current_raw_filwidth * 5.0 * (1.0 / 16383.0);
|
1005
|
992
|
}
|
1006
|
993
|
|
1007
|
|
- // Convert raw Filament Width to a ratio
|
1008
|
|
- int Temperature::widthFil_to_size_ratio() {
|
1009
|
|
- float temp = filament_width_meas;
|
1010
|
|
- if (temp < MEASURED_LOWER_LIMIT) temp = filament_width_nominal; // Assume a bad sensor reading
|
1011
|
|
- else NOMORE(temp, MEASURED_UPPER_LIMIT);
|
1012
|
|
- return filament_width_nominal / temp * 100;
|
|
994
|
+ /**
|
|
995
|
+ * Convert Filament Width (mm) to a simple ratio
|
|
996
|
+ * and reduce to an 8 bit value.
|
|
997
|
+ *
|
|
998
|
+ * A nominal width of 1.75 and measured width of 1.73
|
|
999
|
+ * gives (100 * 1.75 / 1.73) for a ratio of 101 and
|
|
1000
|
+ * a return value of 1.
|
|
1001
|
+ */
|
|
1002
|
+ int8_t Temperature::widthFil_to_size_ratio() {
|
|
1003
|
+ if (WITHIN(filament_width_meas, MEASURED_LOWER_LIMIT, MEASURED_UPPER_LIMIT))
|
|
1004
|
+ return int(100.0 * filament_width_nominal / filament_width_meas) - 100;
|
|
1005
|
+ return 0;
|
1013
|
1006
|
}
|
1014
|
1007
|
|
1015
|
1008
|
#endif
|