pa calib: print flow value and acceleration (#7178)

* pa calib: print flow value and acceleration

Print flow value and acceleration for PA pattern calibration.
This should help keep track during adaptive PA calibration.

* pa pattern: fix legent section too wide in some cases

Rework pa pattern legent generation to correctly estimate
width of the legend section.

Current flow value now has variable length which is a longest of
PA value and the acceleration for a given test.

Few examples:
1. PA value are 4 characters:        0.04
   Acceleratioion 3 chars:           400
   Flow value will be 4 chars long:  7.98, or 11.3

2. PA:      0.018
   Accel:   1000
   Flow:    12.35, or 6.345

3. PA:      0.04
   Accel:   15000
   Flow:    34.34, or 4.567

Rework number-to-string conversion flow to correctly round values at
given precision.
This commit is contained in:
Dima Buzdyk 2024-10-24 21:41:51 +06:00 committed by GitHub
parent be5bc632ad
commit 983f1a827e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 57 additions and 12 deletions

View file

@ -155,7 +155,7 @@ protected:
double e_per_mm(double line_width, double layer_height, float nozzle_diameter, float filament_diameter, float print_flow_ratio) const;
double speed_adjust(int speed) const { return speed * 60; };
std::string convert_number_to_string(double num) const;
std::string convert_number_to_string(double num, unsigned precision = 0) const;
double number_spacing() const { return m_digit_segment_len + m_digit_gap_len; };
std::string draw_digit(double startx,
double starty,
@ -188,6 +188,7 @@ protected:
const double m_digit_segment_len{2};
const double m_digit_gap_len{1};
const std::string::size_type m_max_number_len{5};
std::string::size_type m_number_len{m_max_number_len}; /* Current length of number labels */
};
class CalibPressureAdvanceLine : public CalibPressureAdvance
@ -255,6 +256,7 @@ public:
double print_size_x() const { return object_size_x() + pattern_shift(); };
double print_size_y() const { return object_size_y(); };
double max_layer_z() const { return height_first_layer() + ((m_num_layers - 1) * height_layer()); };
double flow_val() const;
void generate_custom_gcodes(const DynamicPrintConfig &config, bool is_bbl_machine, Model &model, const Vec3d &origin);
@ -296,6 +298,7 @@ private:
double glyph_length_x() const;
double glyph_tab_max_x() const;
double max_numbering_height() const;
size_t max_numbering_length() const;
double pattern_shift() const;