float get_acceleration() const { return acceleration; }
bool is_selected() const { return selected; }
void set_selected(bool b) { selected= b; }
+ bool is_extruder() const { return extruder; }
+ void set_extruder(bool b) { extruder= b; }
int32_t steps_to_target(float);
volatile bool direction:1;
volatile bool moving:1;
bool selected:1;
+ bool extruder:1;
};
};
{
for (int i = E_AXIS; i < n_motors; ++i) {
// find first selected extruder
- if(actuators[i]->is_selected()) return i;
+ if(actuators[i]->is_extruder() && actuators[i]->is_selected()) return i;
}
return 0;
}
for (int i = A_AXIS; i <= n_motors; i++) {
// ABC and/or extruders just need to set machine_position and compensated_machine_position
float ap= actuator_pos[i];
- if(get_e_scale_fnc && i == get_active_extruder()) ap /= get_e_scale_fnc(); // inverse E scale if there is one and this is the active extruder
+ if(actuators[i]->is_extruder() && get_e_scale_fnc) ap /= get_e_scale_fnc(); // inverse E scale if there is one and this is an extruder
machine_position[i]= compensated_machine_position[i]= ap;
actuators[i]->change_last_milestone(ap);
}
// for the extruders just copy the position, and possibly scale it from mm³ to mm
for (size_t i = E_AXIS; i < n_motors; i++) {
actuator_pos[i]= transformed_target[i];
- if(get_e_scale_fnc) {
+ if(actuators[i]->is_extruder() && get_e_scale_fnc) {
// NOTE this relies on the fact only one extruder is active at a time
// scale for volumetric or flow rate
// TODO is this correct? scaling the absolute target? what if the scale changes?
stepper_motor->set_acceleration(acceleration);
stepper_motor->change_steps_per_mm(steps_per_millimeter);
stepper_motor->set_selected(false); // not selected by default
+ stepper_motor->set_extruder(true); // indicates it is an extruder
}
void Extruder::select()