Преглед изворни кода

Merge pull request #4650 from thinkyhead/rc_percent_is_percent

extruder_multiplier => flow_percentage
Scott Lahteine пре 8 година
родитељ
комит
733453569b
5 измењених фајлова са 26 додато и 23 уклоњено
  1. 1
    1
      Marlin/Marlin.h
  2. 11
    8
      Marlin/Marlin_main.cpp
  3. 3
    0
      Marlin/macros.h
  4. 5
    8
      Marlin/planner.cpp
  5. 6
    6
      Marlin/ultralcd.cpp

+ 1
- 1
Marlin/Marlin.h Прегледај датотеку

@@ -265,7 +265,7 @@ extern int feedrate_percentage;
265 265
 
266 266
 extern bool axis_relative_modes[];
267 267
 extern bool volumetric_enabled;
268
-extern int extruder_multiplier[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
268
+extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
269 269
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
270 270
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
271 271
 extern bool axis_known_position[3]; // axis[n].is_known

+ 11
- 8
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -320,7 +320,7 @@ static float feedrate_mm_s = MMM_TO_MMS(1500.0), saved_feedrate_mm_s;
320 320
 int feedrate_percentage = 100, saved_feedrate_percentage;
321 321
 
322 322
 bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
323
-int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
323
+int flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
324 324
 bool volumetric_enabled = false;
325 325
 float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA);
326 326
 float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
@@ -5594,7 +5594,7 @@ inline void gcode_M220() {
5594 5594
 inline void gcode_M221() {
5595 5595
   if (get_target_extruder_from_command(221)) return;
5596 5596
   if (code_seen('S'))
5597
-    extruder_multiplier[target_extruder] = code_value_int();
5597
+    flow_percentage[target_extruder] = code_value_int();
5598 5598
 }
5599 5599
 
5600 5600
 /**
@@ -6059,7 +6059,7 @@ inline void gcode_M400() { stepper.synchronize(); }
6059 6059
     //SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
6060 6060
     //SERIAL_PROTOCOL(filament_width_meas);
6061 6061
     //SERIAL_PROTOCOLPGM("Extrusion ratio(%):");
6062
-    //SERIAL_PROTOCOL(extruder_multiplier[active_extruder]);
6062
+    //SERIAL_PROTOCOL(flow_percentage[active_extruder]);
6063 6063
   }
6064 6064
 
6065 6065
   /**
@@ -8431,15 +8431,18 @@ void prepare_move_to_destination() {
8431 8431
   static millis_t next_status_led_update_ms = 0;
8432 8432
 
8433 8433
   void handle_status_leds(void) {
8434
-    float max_temp = 0.0;
8435 8434
     if (ELAPSED(millis(), next_status_led_update_ms)) {
8436 8435
       next_status_led_update_ms += 500; // Update every 0.5s
8436
+      float max_temp =
8437
+        #if HAS_TEMP_BED
8438
+          MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed())
8439
+        #else
8440
+          0.0
8441
+        #endif
8442
+      ;
8437 8443
       HOTEND_LOOP() {
8438
-        max_temp = max(max(max_temp, thermalManager.degHotend(e)), thermalManager.degTargetHotend(e));
8444
+        max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
8439 8445
       }
8440
-      #if HAS_TEMP_BED
8441
-        max_temp = max(max(max_temp, thermalManager.degTargetBed()), thermalManager.degBed());
8442
-      #endif
8443 8446
       bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
8444 8447
       if (new_led != red_led) {
8445 8448
         red_led = new_led;

+ 3
- 0
Marlin/macros.h Прегледај датотеку

@@ -118,4 +118,7 @@
118 118
 
119 119
 #define CEILING(x,y) (((x) + (y) - 1) / (y))
120 120
 
121
+#define MAX3(a, b, c)    max(max(a, b), c)
122
+#define MAX4(a, b, c, d) max(max(max(a, b), c), d)
123
+
121 124
 #endif //__MACROS_H

+ 5
- 8
Marlin/planner.cpp Прегледај датотеку

@@ -622,11 +622,8 @@ void Planner::check_axes_activity() {
622 622
     block->steps[Z_AXIS] = labs(dz);
623 623
   #endif
624 624
 
625
-  block->steps[E_AXIS] = labs(de);
626
-  block->steps[E_AXIS] *= volumetric_multiplier[extruder];
627
-  block->steps[E_AXIS] *= extruder_multiplier[extruder];
628
-  block->steps[E_AXIS] /= 100;
629
-  block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
625
+  block->steps[E_AXIS] = labs(de) * volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01 + 0.5;
626
+  block->step_event_count = MAX4(block->steps[X_AXIS], block->steps[Y_AXIS], block->steps[Z_AXIS], block->steps[E_AXIS]);
630 627
 
631 628
   // Bail if this is a zero-length block
632 629
   if (block->step_event_count <= dropsegments) return;
@@ -809,7 +806,7 @@ void Planner::check_axes_activity() {
809 806
     delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS];
810 807
     delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS];
811 808
   #endif
812
-  delta_mm[E_AXIS] = 0.01 * (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder];
809
+  delta_mm[E_AXIS] = 0.01 * (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * flow_percentage[extruder];
813 810
 
814 811
   if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
815 812
     block->millimeters = fabs(delta_mm[E_AXIS]);
@@ -930,8 +927,8 @@ void Planner::check_axes_activity() {
930 927
     }
931 928
     ys0 = axis_segment_time[Y_AXIS][0] = ys0 + segment_time;
932 929
 
933
-    long max_x_segment_time = max(xs0, max(xs1, xs2)),
934
-         max_y_segment_time = max(ys0, max(ys1, ys2)),
930
+    long max_x_segment_time = MAX3(xs0, xs1, xs2),
931
+         max_y_segment_time = MAX3(ys0, ys1, ys2),
935 932
          min_xy_segment_time = min(max_x_segment_time, max_y_segment_time);
936 933
     if (min_xy_segment_time < MAX_FREQ_TIME) {
937 934
       float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME);

+ 6
- 6
Marlin/ultralcd.cpp Прегледај датотеку

@@ -799,15 +799,15 @@ void kill_screen(const char* lcd_msg) {
799 799
     // Flow 4:
800 800
     //
801 801
     #if EXTRUDERS == 1
802
-      MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiplier[0], 10, 999);
802
+      MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[0], 10, 999);
803 803
     #else // EXTRUDERS > 1
804
-      MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiplier[active_extruder], 10, 999);
805
-      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N1, &extruder_multiplier[0], 10, 999);
806
-      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N2, &extruder_multiplier[1], 10, 999);
804
+      MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[active_extruder], 10, 999);
805
+      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N1, &flow_percentage[0], 10, 999);
806
+      MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N2, &flow_percentage[1], 10, 999);
807 807
       #if EXTRUDERS > 2
808
-        MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &extruder_multiplier[2], 10, 999);
808
+        MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &flow_percentage[2], 10, 999);
809 809
         #if EXTRUDERS > 3
810
-          MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &extruder_multiplier[3], 10, 999);
810
+          MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &flow_percentage[3], 10, 999);
811 811
         #endif //EXTRUDERS > 3
812 812
       #endif //EXTRUDERS > 2
813 813
     #endif //EXTRUDERS > 1

Loading…
Откажи
Сачувај