Yet more compile error fixes

This commit is contained in:
thewildmage
2023-06-05 13:54:48 -06:00
parent 47fdf2d63e
commit a14d917eff
3 changed files with 33 additions and 33 deletions

View File

@@ -1882,9 +1882,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
auto params = print.calib_params();
switch (print.calib_params().mode) {
case CalibMode::Calib_PA_Line:
calib_pressure_advance_line pa_test(this);
if (print.calib_params().mode == CalibMode::Calib_PA_Line) {
CalibPressureAdvanceLine pa_test(this);
double filament_max_volumetric_speed = m_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(initial_extruder_id);
Flow pattern_line = Flow(pa_test.line_width(), 0.2, m_config.nozzle_diameter.get_at(0));
@@ -1895,11 +1894,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
pa_test.draw_numbers() = print.calib_params().print_numbers;
gcode += pa_test.generate_test(params.start, params.step, std::llround(std::ceil((params.end - params.start) / params.step)));
break;
case CalibMode::Calib_PA_Pattern:
calib_pressure_advance_pattern pa_test(this);
} else if (print.calib_params().mode == CalibMode::Calib_PA_Pattern) {
CalibPressureAdvancePattern pa_test(this);
gcode += pa_test.generate_test(params.start, params.end, params.step);
break;
}
file.write(gcode);

View File

@@ -1,5 +1,4 @@
#include "calib.hpp"
#include "Point.hpp"
#include "PrintConfig.hpp"
#include "GCodeWriter.hpp"
#include "GCode.hpp"
@@ -213,12 +212,6 @@ void CalibPressureAdvance::delta_scale_bed_ext(BoundingBoxf& bed_ext)
bed_ext.scale(1.0f / 1.41421f);
}
void CalibPressureAdvance::delta_modify_start(double& start_x, double& start_y, int count)
{
startx = -startx;
starty = -(count * m_space_y) / 2; // TODO fix for pattern
}
std::string CalibPressureAdvanceLine::generate_test(double start_pa /*= 0*/, double step_pa /*= 0.002*/, int count /*= 10*/)
{
BoundingBoxf bed_ext = get_extents(mp_gcodegen->config().printable_area.values);
@@ -243,6 +236,12 @@ std::string CalibPressureAdvanceLine::generate_test(double start_pa /*= 0*/, dou
return print_pa_lines(startx, starty, start_pa, step_pa, count);
}
void CalibPressureAdvanceLine::delta_modify_start(double& startx, double& starty, int count)
{
startx = -startx;
starty = -(count * m_space_y) / 2;
}
std::string CalibPressureAdvanceLine::print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num)
{
auto& writer = mp_gcodegen->writer();
@@ -308,10 +307,6 @@ std::string CalibPressureAdvancePattern::generate_test(double start_pa, double e
auto start_x = pattern_start_x(num_patterns, center_x);
auto start_y = pattern_start_y(start_pa, step_pa, num_patterns, center_y);
if (is_delta()) {
delta_modify_start(start_x, start_y, num_patterns);
}
CalibPressureAdvancePattern::PatternCalc pattern_calc(
start_pa,
step_pa,
@@ -329,6 +324,10 @@ std::string CalibPressureAdvancePattern::generate_test(double start_pa, double e
glyph_tab_max_x(num_patterns, center_x)
);
if (is_delta()) {
delta_modify_start(pattern_calc);
}
return print_pa_pattern(pattern_calc);
}
@@ -348,23 +347,25 @@ CalibPressureAdvancePattern::PatternSettings::PatternSettings() {
}
CalibPressureAdvancePattern::DrawLineOptArgs::DrawLineOptArgs() {
PatternSettings ps;
extrusion_multiplier = ps.extrusion_multiplier;
height = ps.layer_height;
line_width = ps.line_width;
speed = ps.perim_speed;
extrusion_multiplier = PatternSettings::extrusion_multiplier;
height = PatternSettings::layer_height;
line_width = PatternSettings::line_width;
speed = PatternSettings::perim_speed;
comment = "Print line";
}
CalibPressureAdvancePattern::DrawBoxOptArgs::DrawBoxOptArgs() {
PatternSettings ps;
is_filled = false;
num_perimeters = ps.anchor_perimeters;
height = ps.first_layer_height;
line_width = ps.anchor_line_width;
speed = ps.first_layer_speed;
num_perimeters = PatternSettings::anchor_perimeters;
height = PatternSettings::first_layer_height;
line_width = PatternSettings::anchor_line_width;
speed = PatternSettings::first_layer_speed;
}
void CalibPressureAdvancePattern::delta_modify_start(PatternCalc& pc)
{
pc.pattern_start_x = -pc.pattern_start_x;
pc.pattern_start_y = -(frame_size_y() / 2);
}
double CalibPressureAdvancePattern::get_distance(double cur_x, double cur_y, double to_x, double to_y)

View File

@@ -44,7 +44,6 @@ protected:
bool is_delta();
void delta_scale_bed_ext(BoundingBoxf& bed_ext);
void delta_modify_start(double start_x, double start_y, int count);
GCode* mp_gcodegen;
double m_nozzle_diameter;
@@ -77,6 +76,7 @@ public:
bool& draw_numbers() { return m_draw_numbers; }
private:
void delta_modify_start(double& startx, double& starty, int count);
std::string print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num);
double m_length_short, m_length_long;
@@ -185,7 +185,7 @@ private:
int perim_speed;
};
struct DrawLineOptArgs {
struct DrawLineOptArgs : PatternSettings {
DrawLineOptArgs();
double extrusion_multiplier;
@@ -195,7 +195,7 @@ private:
std::string comment;
};
struct DrawBoxOptArgs {
struct DrawBoxOptArgs : PatternSettings {
DrawBoxOptArgs();
bool is_filled;
@@ -205,6 +205,8 @@ private:
double speed;
};
void delta_modify_start(PatternCalc& pc);
double speed_adjust(int speed) const { return speed * 60; };
double to_radians(double degrees) { return degrees * M_PI / 180; };
double get_distance(double cur_x, double cur_y, double to_x, double to_y);