Tweak Filament Width variables

This commit is contained in:
Scott Lahteine
2016-09-05 23:57:12 -05:00
parent 68ba45572e
commit 6ac9d895ca
4 changed files with 19 additions and 21 deletions

View File

@ -868,7 +868,7 @@ void Planner::check_axes_activity() {
static float filwidth_e_count = 0, filwidth_delay_dist = 0;
//FMM update ring buffer used for delay with filament measurements
if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM && filwidth_delay_index2 >= 0) { //only for extruder with filament sensor and if ring buffer is initialized
if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM && filwidth_delay_index[1] >= 0) { //only for extruder with filament sensor and if ring buffer is initialized
const int MMD_CM = MAX_MEASUREMENT_DELAY + 1, MMD_MM = MMD_CM * 10;
@ -883,16 +883,16 @@ void Planner::check_axes_activity() {
while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM;
// Convert into an index into the measurement array
filwidth_delay_index1 = (int)(filwidth_delay_dist * 0.1 + 0.0001);
filwidth_delay_index[0] = (int)(filwidth_delay_dist * 0.1 + 0.0001);
// If the index has changed (must have gone forward)...
if (filwidth_delay_index1 != filwidth_delay_index2) {
if (filwidth_delay_index[0] != filwidth_delay_index[1]) {
filwidth_e_count = 0; // Reset the E movement counter
int8_t meas_sample = thermalManager.widthFil_to_size_ratio() - 100; // Subtract 100 to reduce magnitude - to store in a signed char
do {
filwidth_delay_index2 = (filwidth_delay_index2 + 1) % MMD_CM; // The next unused slot
measurement_delay[filwidth_delay_index2] = meas_sample; // Store the measurement
} while (filwidth_delay_index1 != filwidth_delay_index2); // More slots to fill?
filwidth_delay_index[1] = (filwidth_delay_index[1] + 1) % MMD_CM; // The next unused slot
measurement_delay[filwidth_delay_index[1]] = meas_sample; // Store the measurement
} while (filwidth_delay_index[0] != filwidth_delay_index[1]); // More slots to fill?
}
}
}