Browse Source

Merge pull request #4650 from thinkyhead/rc_percent_is_percent

extruder_multiplier => flow_percentage
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
733453569b
  1. 2
      Marlin/Marlin.h
  2. 19
      Marlin/Marlin_main.cpp
  3. 3
      Marlin/macros.h
  4. 13
      Marlin/planner.cpp
  5. 12
      Marlin/ultralcd.cpp

2
Marlin/Marlin.h

@ -265,7 +265,7 @@ extern int feedrate_percentage;
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern bool volumetric_enabled; extern bool volumetric_enabled;
extern int extruder_multiplier[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
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. 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.
extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
extern bool axis_known_position[3]; // axis[n].is_known extern bool axis_known_position[3]; // axis[n].is_known

19
Marlin/Marlin_main.cpp

@ -320,7 +320,7 @@ static float feedrate_mm_s = MMM_TO_MMS(1500.0), saved_feedrate_mm_s;
int feedrate_percentage = 100, saved_feedrate_percentage; int feedrate_percentage = 100, saved_feedrate_percentage;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); int flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
bool volumetric_enabled = false; bool volumetric_enabled = false;
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA); float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA);
float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0); float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
@ -5594,7 +5594,7 @@ inline void gcode_M220() {
inline void gcode_M221() { inline void gcode_M221() {
if (get_target_extruder_from_command(221)) return; if (get_target_extruder_from_command(221)) return;
if (code_seen('S')) if (code_seen('S'))
extruder_multiplier[target_extruder] = code_value_int(); flow_percentage[target_extruder] = code_value_int();
} }
/** /**
@ -6059,7 +6059,7 @@ inline void gcode_M400() { stepper.synchronize(); }
//SERIAL_PROTOCOLPGM("Filament dia (measured mm):"); //SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
//SERIAL_PROTOCOL(filament_width_meas); //SERIAL_PROTOCOL(filament_width_meas);
//SERIAL_PROTOCOLPGM("Extrusion ratio(%):"); //SERIAL_PROTOCOLPGM("Extrusion ratio(%):");
//SERIAL_PROTOCOL(extruder_multiplier[active_extruder]); //SERIAL_PROTOCOL(flow_percentage[active_extruder]);
} }
/** /**
@ -8431,15 +8431,18 @@ void prepare_move_to_destination() {
static millis_t next_status_led_update_ms = 0; static millis_t next_status_led_update_ms = 0;
void handle_status_leds(void) { void handle_status_leds(void) {
float max_temp = 0.0;
if (ELAPSED(millis(), next_status_led_update_ms)) { if (ELAPSED(millis(), next_status_led_update_ms)) {
next_status_led_update_ms += 500; // Update every 0.5s next_status_led_update_ms += 500; // Update every 0.5s
float max_temp =
#if HAS_TEMP_BED
MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed())
#else
0.0
#endif
;
HOTEND_LOOP() { HOTEND_LOOP() {
max_temp = max(max(max_temp, thermalManager.degHotend(e)), thermalManager.degTargetHotend(e)); max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
} }
#if HAS_TEMP_BED
max_temp = max(max(max_temp, thermalManager.degTargetBed()), thermalManager.degBed());
#endif
bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
if (new_led != red_led) { if (new_led != red_led) {
red_led = new_led; red_led = new_led;

3
Marlin/macros.h

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

13
Marlin/planner.cpp

@ -622,11 +622,8 @@ void Planner::check_axes_activity() {
block->steps[Z_AXIS] = labs(dz); block->steps[Z_AXIS] = labs(dz);
#endif #endif
block->steps[E_AXIS] = labs(de); block->steps[E_AXIS] = labs(de) * volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01 + 0.5;
block->steps[E_AXIS] *= volumetric_multiplier[extruder]; block->step_event_count = MAX4(block->steps[X_AXIS], block->steps[Y_AXIS], block->steps[Z_AXIS], block->steps[E_AXIS]);
block->steps[E_AXIS] *= extruder_multiplier[extruder];
block->steps[E_AXIS] /= 100;
block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
// Bail if this is a zero-length block // Bail if this is a zero-length block
if (block->step_event_count <= dropsegments) return; if (block->step_event_count <= dropsegments) return;
@ -809,7 +806,7 @@ void Planner::check_axes_activity() {
delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS]; delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS];
delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS]; delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS];
#endif #endif
delta_mm[E_AXIS] = 0.01 * (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder]; delta_mm[E_AXIS] = 0.01 * (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * flow_percentage[extruder];
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) { if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
block->millimeters = fabs(delta_mm[E_AXIS]); block->millimeters = fabs(delta_mm[E_AXIS]);
@ -930,8 +927,8 @@ void Planner::check_axes_activity() {
} }
ys0 = axis_segment_time[Y_AXIS][0] = ys0 + segment_time; ys0 = axis_segment_time[Y_AXIS][0] = ys0 + segment_time;
long max_x_segment_time = max(xs0, max(xs1, xs2)), long max_x_segment_time = MAX3(xs0, xs1, xs2),
max_y_segment_time = max(ys0, max(ys1, ys2)), max_y_segment_time = MAX3(ys0, ys1, ys2),
min_xy_segment_time = min(max_x_segment_time, max_y_segment_time); min_xy_segment_time = min(max_x_segment_time, max_y_segment_time);
if (min_xy_segment_time < MAX_FREQ_TIME) { if (min_xy_segment_time < MAX_FREQ_TIME) {
float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME); float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME);

12
Marlin/ultralcd.cpp

@ -799,15 +799,15 @@ void kill_screen(const char* lcd_msg) {
// Flow 4: // Flow 4:
// //
#if EXTRUDERS == 1 #if EXTRUDERS == 1
MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiplier[0], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[0], 10, 999);
#else // EXTRUDERS > 1 #else // EXTRUDERS > 1
MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiplier[active_extruder], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW, &flow_percentage[active_extruder], 10, 999);
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N1, &extruder_multiplier[0], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N1, &flow_percentage[0], 10, 999);
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N2, &extruder_multiplier[1], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N2, &flow_percentage[1], 10, 999);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &extruder_multiplier[2], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &flow_percentage[2], 10, 999);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &extruder_multiplier[3], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N4, &flow_percentage[3], 10, 999);
#endif //EXTRUDERS > 3 #endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2 #endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1 #endif //EXTRUDERS > 1

Loading…
Cancel
Save