FIX: wrong flush logic
1.Fix flush calc logic 2.Rename m_extruder in GCodeWriter jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I38f023fbad983305632ca62cbfb3909759013c25 (cherry picked from commit f1b0805ed13eb94d6eb61e12330db3d628c0241b)
This commit is contained in:
@@ -15,9 +15,10 @@ class GCodeWriter {
|
||||
public:
|
||||
GCodeConfig config;
|
||||
bool multiple_extruders;
|
||||
|
||||
GCodeWriter() :
|
||||
multiple_extruders(false), m_extruder(nullptr),
|
||||
|
||||
GCodeWriter() :
|
||||
multiple_extruders(false), m_curr_filament_extruder{ nullptr,nullptr },
|
||||
m_curr_extruder_id (-1),
|
||||
m_single_extruder_multi_material(false),
|
||||
m_last_acceleration(0), m_max_acceleration(0),m_last_travel_acceleration(0), m_max_travel_acceleration(0),
|
||||
m_last_jerk(0), m_max_jerk_x(0), m_max_jerk_y(0),
|
||||
@@ -27,18 +28,20 @@ public:
|
||||
m_to_lift_type(LiftType::NormalLift),
|
||||
m_current_speed(3600), m_is_first_layer(true)
|
||||
{}
|
||||
Extruder* extruder() { return m_extruder; }
|
||||
const Extruder* extruder() const { return m_extruder; }
|
||||
Extruder* filament(size_t extruder_id) { assert(extruder_id < m_curr_filament_extruder.size()); return m_curr_filament_extruder[extruder_id]; }
|
||||
const Extruder* filament(size_t extruder_id) const { assert(extruder_id < m_curr_filament_extruder.size()); return m_curr_filament_extruder[extruder_id]; }
|
||||
Extruder* filament() { if (m_curr_extruder_id == -1) return nullptr; return m_curr_filament_extruder[m_curr_extruder_id]; }
|
||||
const Extruder* filament() const { if(m_curr_extruder_id==-1) return nullptr; return m_curr_filament_extruder[m_curr_extruder_id]; }
|
||||
|
||||
void apply_print_config(const PrintConfig &print_config);
|
||||
// Extruders are expected to be sorted in an increasing order.
|
||||
void set_extruders(std::vector<unsigned int> extruder_ids);
|
||||
const std::vector<Extruder>& extruders() const { return m_extruders; }
|
||||
std::vector<unsigned int> extruder_ids() const {
|
||||
std::vector<unsigned int> out;
|
||||
out.reserve(m_extruders.size());
|
||||
for (const Extruder &e : m_extruders)
|
||||
out.push_back(e.id());
|
||||
const std::vector<Extruder>& extruders() const { return m_filament_extruders; }
|
||||
std::vector<unsigned int> extruder_ids() const {
|
||||
std::vector<unsigned int> out;
|
||||
out.reserve(m_filament_extruders.size());
|
||||
for (const Extruder &e : m_filament_extruders)
|
||||
out.push_back(e.id());
|
||||
return out;
|
||||
}
|
||||
std::string preamble();
|
||||
@@ -59,14 +62,12 @@ public:
|
||||
std::string reset_e(bool force = false);
|
||||
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
|
||||
// return false if this extruder was already selected
|
||||
bool need_toolchange(unsigned int extruder_id) const
|
||||
{ return m_extruder == nullptr || m_extruder->id() != extruder_id; }
|
||||
std::string set_extruder(unsigned int extruder_id)
|
||||
{ return this->need_toolchange(extruder_id) ? this->toolchange(extruder_id) : ""; }
|
||||
bool need_toolchange(unsigned int filament_id) const;
|
||||
std::string set_extruder(unsigned int filament_id);
|
||||
// Prefix of the toolchange G-code line, to be used by the CoolingBuffer to separate sections of the G-code
|
||||
// printed with the same extruder.
|
||||
std::string toolchange_prefix() const;
|
||||
std::string toolchange(unsigned int extruder_id);
|
||||
std::string toolchange(unsigned int filament_id);
|
||||
std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string());
|
||||
// SoftFever NOTE: the returned speed is mm/minute
|
||||
double get_current_speed() const { return m_current_speed;}
|
||||
@@ -123,9 +124,10 @@ public:
|
||||
static bool supports_separate_travel_acceleration(GCodeFlavor flavor);
|
||||
private:
|
||||
// Extruders are sorted by their ID, so that binary search is possible.
|
||||
std::vector<Extruder> m_extruders;
|
||||
std::vector<Extruder> m_filament_extruders;
|
||||
bool m_single_extruder_multi_material;
|
||||
Extruder* m_extruder;
|
||||
std::vector<Extruder*> m_curr_filament_extruder;
|
||||
int m_curr_extruder_id;
|
||||
unsigned int m_last_acceleration;
|
||||
unsigned int m_last_travel_acceleration;
|
||||
unsigned int m_max_travel_acceleration;
|
||||
|
||||
Reference in New Issue
Block a user