Procházet zdrojové kódy

Minor optimization of FILAMENT_WIDTH_SENSOR

Scott Lahteine před 8 roky
rodič
revize
096b927102
1 změnil soubory, kde provedl 3 přidání a 4 odebrání
  1. 3
    4
      Marlin/temperature.cpp

+ 3
- 4
Marlin/temperature.cpp Zobrazit soubor

766
     if (filament_sensor) {
766
     if (filament_sensor) {
767
       meas_shift_index = filwidth_delay_index[0] - meas_delay_cm;
767
       meas_shift_index = filwidth_delay_index[0] - meas_delay_cm;
768
       if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1;  //loop around buffer if needed
768
       if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1;  //loop around buffer if needed
769
+      meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY);
769
 
770
 
770
       // Get the delayed info and add 100 to reconstitute to a percent of
771
       // Get the delayed info and add 100 to reconstitute to a percent of
771
       // the nominal filament diameter then square it to get an area
772
       // the nominal filament diameter then square it to get an area
772
-      meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY);
773
-      float vm = pow((measurement_delay[meas_shift_index] + 100.0) * 0.01, 2);
774
-      NOLESS(vm, 0.01);
775
-      volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vm;
773
+      const float vmroot = measurement_delay[meas_shift_index] * 0.01 + 1.0;
774
+      volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vmroot <= 0.1 ? 0.01 : sq(vmroot);
776
     }
775
     }
777
   #endif // FILAMENT_WIDTH_SENSOR
776
   #endif // FILAMENT_WIDTH_SENSOR
778
 
777
 

Loading…
Zrušit
Uložit