Higher resolution G-code and volumetric rate legend, disabled.

This commit is contained in:
Vojtech Bubnik 2021-11-16 15:48:06 +01:00
parent 58c93196d5
commit 0420f63540
3 changed files with 43 additions and 1 deletions

View file

@ -536,7 +536,7 @@ std::string GCodeWriter::set_fan(unsigned int speed) const
void GCodeFormatter::emit_axis(const char axis, const double v, size_t digits) {
assert(digits <= 6);
static constexpr const std::array<int, 7> pow_10{1, 10, 100, 1000, 10000, 100000, 1000000};
static constexpr const std::array<int, 10> pow_10{1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
*ptr_err.ptr++ = ' '; *ptr_err.ptr++ = axis;
char *base_ptr = this->ptr_err.ptr;

View file

@ -104,8 +104,22 @@ public:
GCodeFormatter(const GCodeFormatter&) = delete;
GCodeFormatter& operator=(const GCodeFormatter&) = delete;
// At layer height 0.15mm, extrusion width 0.2mm and filament diameter 1.75mm,
// the crossection of extrusion is 0.4 * 0.15 = 0.06mm2
// and the filament crossection is 1.75^2 = 3.063mm2
// thus the filament moves 3.063 / 0.6 = 51x slower than the XY axes
// and we need roughly two decimal digits more on extruder than on XY.
#if 0
static constexpr const int XYZF_EXPORT_DIGITS = 3;
static constexpr const int E_EXPORT_DIGITS = 5;
#else
// order of magnitude smaller extrusion rate erros
static constexpr const int XYZF_EXPORT_DIGITS = 4;
static constexpr const int E_EXPORT_DIGITS = 6;
// excessive accuracy
// static constexpr const int XYZF_EXPORT_DIGITS = 6;
// static constexpr const int E_EXPORT_DIGITS = 9;
#endif
void emit_axis(const char axis, const double v, size_t digits);

View file

@ -520,6 +520,8 @@ const std::vector<GCodeViewer::Color> GCodeViewer::Travel_Colors {{
{ 0.505f, 0.064f, 0.028f, 1.0f } // Retract
}};
#if 1
// Normal ranges
const std::vector<GCodeViewer::Color> GCodeViewer::Range_Colors {{
{ 0.043f, 0.173f, 0.478f, 1.0f }, // bluish
{ 0.075f, 0.349f, 0.522f, 1.0f },
@ -533,6 +535,32 @@ const std::vector<GCodeViewer::Color> GCodeViewer::Range_Colors {{
{ 0.761f, 0.322f, 0.235f, 1.0f },
{ 0.581f, 0.149f, 0.087f, 1.0f } // reddish
}};
#else
// Detailed ranges
const std::vector<GCodeViewer::Color> GCodeViewer::Range_Colors{ {
{ 0.043f, 0.173f, 0.478f, 1.0f }, // bluish
{ 0.5f * (0.043f + 0.075f), 0.5f * (0.173f + 0.349f), 0.5f * (0.478f + 0.522f), 1.0f },
{ 0.075f, 0.349f, 0.522f, 1.0f },
{ 0.5f * (0.075f + 0.110f), 0.5f * (0.349f + 0.533f), 0.5f * (0.522f + 0.569f), 1.0f },
{ 0.110f, 0.533f, 0.569f, 1.0f },
{ 0.5f * (0.110f + 0.016f), 0.5f * (0.533f + 0.839f), 0.5f * (0.569f + 0.059f), 1.0f },
{ 0.016f, 0.839f, 0.059f, 1.0f },
{ 0.5f * (0.016f + 0.667f), 0.5f * (0.839f + 0.949f), 0.5f * (0.059f + 0.000f), 1.0f },
{ 0.667f, 0.949f, 0.000f, 1.0f },
{ 0.5f * (0.667f + 0.988f), 0.5f * (0.949f + 0.975f), 0.5f * (0.000f + 0.012f), 1.0f },
{ 0.988f, 0.975f, 0.012f, 1.0f },
{ 0.5f * (0.988f + 0.961f), 0.5f * (0.975f + 0.808f), 0.5f * (0.012f + 0.039f), 1.0f },
{ 0.961f, 0.808f, 0.039f, 1.0f },
{ 0.5f * (0.961f + 0.890f), 0.5f * (0.808f + 0.533f), 0.5f * (0.039f + 0.125f), 1.0f },
{ 0.890f, 0.533f, 0.125f, 1.0f },
{ 0.5f * (0.890f + 0.820f), 0.5f * (0.533f + 0.408f), 0.5f * (0.125f + 0.188f), 1.0f },
{ 0.820f, 0.408f, 0.188f, 1.0f },
{ 0.5f * (0.820f + 0.761f), 0.5f * (0.408f + 0.322f), 0.5f * (0.188f + 0.235f), 1.0f },
{ 0.761f, 0.322f, 0.235f, 1.0f },
{ 0.5f * (0.761f + 0.581f), 0.5f * (0.322f + 0.149f), 0.5f * (0.235f + 0.087f), 1.0f },
{ 0.581f, 0.149f, 0.087f, 1.0f } // reddishgit
} };
#endif
const GCodeViewer::Color GCodeViewer::Wipe_Color = { 1.0f, 1.0f, 0.0f, 1.0f };
const GCodeViewer::Color GCodeViewer::Neutral_Color = { 0.25f, 0.25f, 0.25f, 1.0f };