Browse Source

Optimize calculate_volumetric_multiplier

Scott Lahteine 9 years ago
parent
commit
0cf0c20532
1 changed files with 3 additions and 12 deletions
  1. 3
    12
      Marlin/Marlin_main.cpp

+ 3
- 12
Marlin/Marlin_main.cpp View File

@@ -4695,18 +4695,9 @@ bool setTargetedHotend(int code){
4695 4695
 
4696 4696
 
4697 4697
 float calculate_volumetric_multiplier(float diameter) {
4698
-	float area = .0;
4699
-	float radius = .0;
4700
-
4701
-	radius = diameter * .5;
4702
-	if (! volumetric_enabled || radius == 0) {
4703
-		area = 1;
4704
-	}
4705
-	else {
4706
-		area = M_PI * pow(radius, 2);
4707
-	}
4708
-
4709
-	return 1.0 / area;
4698
+	if (!volumetric_enabled || diameter == 0) return 1.0;
4699
+  float d2 = diameter * 0.5;
4700
+	return 1.0 / (M_PI * d2 * d2);
4710 4701
 }
4711 4702
 
4712 4703
 void calculate_volumetric_multipliers() {

Loading…
Cancel
Save