#222 expose thumbnails setting to gui

This commit is contained in:
supermerill 2020-08-17 21:06:50 +02:00
parent 47e817a9a3
commit 8b416a083a
7 changed files with 29 additions and 8 deletions

View File

@ -13,6 +13,10 @@ group:Print Host upload
printhost
group:silent_mode_event:Firmware
setting:gcode_flavor
line:Gcode thumbnails
setting:id$0:label$Small:thumbnails
setting:id$1:label$Big:thumbnails
end_line
setting:silent_mode
setting:remaining_times
setting:fan_speedup_time

View File

@ -1011,9 +1011,14 @@ namespace DoExport {
// Write thumbnails using base64 encoding
if (thumbnail_cb != nullptr)
{
std::vector<Vec2d> good_sizes;
for (const Vec2d &size : sizes)
if (size.x() > 0 && size.y() > 0)
good_sizes.push_back(size);
const size_t max_row_length = 78;
ThumbnailsList thumbnails;
thumbnail_cb(thumbnails, sizes, true, true, true, true);
thumbnail_cb(thumbnails, good_sizes, true, true, true, true);
for (const ThumbnailData& data : thumbnails)
{
if (data.is_valid())

View File

@ -74,7 +74,7 @@ void PrintConfigDef::init_common_params()
def = this->add("thumbnails", coPoints);
def->label = L("Picture sizes to be stored into a .gcode and .sl1 files");
def->mode = comExpert;
def->set_default_value(new ConfigOptionPoints());
def->set_default_value(new ConfigOptionPoints{ Vec2d(0,0), Vec2d(0,0) });
def = this->add("layer_height", coFloat);
def->label = L("Base Layer height");

View File

@ -1104,6 +1104,7 @@ public:
ConfigOptionInt standby_temperature_delta;
ConfigOptionInts temperature;
ConfigOptionInt threads;
ConfigOptionPoints thumbnails;
ConfigOptionPercent time_estimation_compensation;
ConfigOptionInts top_fan_speed;
ConfigOptionBools wipe;
@ -1194,6 +1195,7 @@ protected:
OPT_PTR(standby_temperature_delta);
OPT_PTR(temperature);
OPT_PTR(threads);
OPT_PTR(thumbnails);
OPT_PTR(time_estimation_compensation);
OPT_PTR(top_fan_speed);
OPT_PTR(wipe);

View File

@ -165,8 +165,12 @@ void BackgroundSlicingProcess::process_sla()
if (m_thumbnail_cb != nullptr)
{
ThumbnailsList thumbnails;
m_thumbnail_cb(thumbnails, current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values, true, true, true, true);
// m_thumbnail_cb(thumbnails, current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values, true, false, true, true); // renders also supports and pad
std::vector<Vec2d> good_sizes;
for (const Vec2d &size : current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values)
if (size.x() > 0 && size.y() > 0)
good_sizes.push_back(size);
m_thumbnail_cb(thumbnails, good_sizes, true, true, true, true);
// m_thumbnail_cb(thumbnails, good_sizes, true, false, true, true); // renders also supports and pad
for (const ThumbnailData& data : thumbnails)
{
if (data.is_valid())
@ -493,8 +497,12 @@ void BackgroundSlicingProcess::prepare_upload()
if (m_thumbnail_cb != nullptr)
{
ThumbnailsList thumbnails;
m_thumbnail_cb(thumbnails, current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values, true, true, true, true);
// m_thumbnail_cb(thumbnails, current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values, true, false, true, true); // renders also supports and pad
std::vector<Vec2d> good_sizes;
for (const Vec2d &size : current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values)
if (size.x() > 0 && size.y() > 0)
good_sizes.push_back(size);
m_thumbnail_cb(thumbnails, good_sizes, true, true, true, true);
// m_thumbnail_cb(thumbnails, good_sizes, true, false, true, true); // renders also supports and pad
for (const ThumbnailData& data : thumbnails)
{
if (data.is_valid())

View File

@ -63,6 +63,7 @@ void Field::PostInitialize()
case coFloats:
case coStrings:
case coBools:
case coPoints:
case coInts: {
auto tag_pos = m_opt_id.find("#");
if (tag_pos != std::string::npos)

View File

@ -614,6 +614,7 @@ const std::vector<std::string>& Preset::printer_options()
"machine_max_feedrate_x", "machine_max_feedrate_y", "machine_max_feedrate_z", "machine_max_feedrate_e",
"machine_min_extruding_rate", "machine_min_travel_rate",
"machine_max_jerk_x", "machine_max_jerk_y", "machine_max_jerk_z", "machine_max_jerk_e",
"thumbnails",
"time_estimation_compensation",
"print_machine_envelope",
"fan_speedup_time",