diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index c6c32102793..648a9791b71 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1391,6 +1391,20 @@ void GCode::_do_export(Print& print_mod, GCodeOutputStream &file, ThumbnailsGene std::string preamble_to_put_start_layer = ""; + + // if thumbnail type of BTT_TFT, insert above header + // if not, it is inserted under the header in its normal spot + const ConfigOptionEnum* thumbnails_format = print.full_print_config().option>("thumbnails_format"); + const ConfigOptionBool* thumbnails_with_bed = print.full_print_config().option("thumbnails_with_bed"); + if (thumbnails_format != nullptr && thumbnails_format->value == GCodeThumbnailsFormat::BIQU) + GCodeThumbnails::export_thumbnails_to_file(thumbnail_cb, + print.full_print_config().option("thumbnails")->values, + thumbnails_with_bed ? thumbnails_with_bed->value : false, + thumbnails_format->value, + true, + [&file](const char *sz) { file.write(sz); }, + [&print]() { print.throw_if_canceled(); }); + // Write information on the generator. file.write_format("; %s\n\n", Slic3r::header_slic3r_generated().c_str()); @@ -1398,9 +1412,7 @@ void GCode::_do_export(Print& print_mod, GCodeOutputStream &file, ThumbnailsGene //print thumbnails at the start unless requested at the end. const ConfigOptionBool* thumbnails_end_file = print.full_print_config().option("thumbnails_end_file"); if(!thumbnails_end_file || !thumbnails_end_file->value) { - const ConfigOptionBool* thumbnails_with_bed = print.full_print_config().option("thumbnails_with_bed"); const ConfigOptionBool* thumbnails_tag_with_format = print.full_print_config().option("thumbnails_tag_format"); - const ConfigOptionEnum* thumbnails_format = print.full_print_config().option>("thumbnails_format"); // Unit tests or command line slicing may not define "thumbnails" or "thumbnails_format". // If "thumbnails_format" is not defined, export to PNG. GCodeThumbnails::export_thumbnails_to_file(thumbnail_cb, @@ -2092,8 +2104,8 @@ void GCode::_do_export(Print& print_mod, GCodeOutputStream &file, ThumbnailsGene } print.throw_if_canceled(); - //print thumbnails at the end instead of the start if requested - if (thumbnails_end_file && thumbnails_end_file->value) { + //print thumbnails at the end instead of the start if requested (unless BTT / biqu thumbnail) + if (thumbnails_end_file && thumbnails_end_file->value && (thumbnails_format == nullptr || thumbnails_format->value != GCodeThumbnailsFormat::BIQU)) { const ConfigOptionBool* thumbnails_with_bed = print.full_print_config().option("thumbnails_with_bed"); const ConfigOptionBool* thumbnails_tag_with_format = print.full_print_config().option("thumbnails_tag_format"); const ConfigOptionEnum* thumbnails_format = print.full_print_config().option>("thumbnails_format"); diff --git a/src/libslic3r/GCode/Thumbnails.hpp b/src/libslic3r/GCode/Thumbnails.hpp index 2b04415c9eb..da539ed8ac9 100644 --- a/src/libslic3r/GCode/Thumbnails.hpp +++ b/src/libslic3r/GCode/Thumbnails.hpp @@ -51,9 +51,10 @@ inline void export_thumbnails_to_file(ThumbnailsGeneratorCallback &thumbnail_cb, auto compressed = compress_thumbnail(data, format); if (compressed->data && compressed->size) { if (format == GCodeThumbnailsFormat::BIQU) { - output((boost::format("\n;\n; %s begin %dx%d %d\n") - % (with_tag_format ? compressed->tag() : EMPTY_TAG) - % data.width % data.height % (compressed->size - 1)).str().c_str()); + // BIQU firmware need to have nothing before the thumbnail + //output((boost::format("\n;\n; %s begin %dx%d %d\n") + // % (with_tag_format ? compressed->tag() : EMPTY_TAG) + // % data.width % data.height % (compressed->size - 1)).str().c_str()); //print size in hex std::stringstream ss; ss << std::setfill('0') << std::hex; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index ebe79ddeca3..8ad4bf3b307 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3500,6 +3500,11 @@ void TabPrinter::toggle_options() bool custom_color = m_config->opt_bool("thumbnails_custom_color"); field = get_field("thumbnails_color"); if (field) field->toggle(custom_color); + const ConfigOptionEnum* thumbnails_format = m_config->option>("thumbnails_format"); + field = get_field("thumbnails_end_file"); + if (thumbnails_format && field) field->toggle(thumbnails_format->value != (GCodeThumbnailsFormat::BIQU)); + field = get_field("thumbnails_tag_format"); + if (thumbnails_format && field) field->toggle(thumbnails_format->value != (GCodeThumbnailsFormat::BIQU)); //firmware bool have_remaining_times = m_config->opt_bool("remaining_times");