mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-06-29 18:30:36 +00:00
FILAMENT_SENSOR -> FILAMENT_WIDTH_SENSOR
This commit is contained in:
parent
7f81aa7ff3
commit
1a79b13b7a
27 changed files with 76 additions and 66 deletions
Marlin
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue