Improvements and bug fixes in sensor delay buffer for filament sensor code

Improvement to avoid reinitializing delay buffer with every print. Fixed
issues in buffer indexing and memory out of bounds due to floating point
imprecision.  Simplified the code by avoiding conversion to standard
diameter and 1cu mm extrusion, which caused complications in determining
mm extruded.
This commit is contained in:
Filip Mulier
2014-08-16 06:50:13 -05:00
parent 85649a4549
commit 62db9848d3
4 changed files with 59 additions and 35 deletions

View File

@ -230,8 +230,8 @@ extern unsigned char fanSpeedSoftPwm;
#endif
#ifdef FILAMENT_SENSOR
extern volatile float filament_width_nominal; //holds the theoretical filament diameter ie., 3.00 or 1.75
extern volatile bool filament_sensor; //indicates that filament sensor readings should control extrusion
extern float filament_width_nominal; //holds the theoretical filament diameter ie., 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
extern signed char measurement_delay[]; //ring buffer to delay measurement
extern int delay_index1, delay_index2; //index into ring buffer