NEW: add Device view for third-party printers

cherry-picked from SoftFever

Change-Id: I36b2fa0227886e4fac494c8b83e12f4fc0b04e17
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-06-14 14:29:36 +08:00 committed by Lane.Wei
parent 5f04066ac0
commit efd65561a2
27 changed files with 1797 additions and 60 deletions

View file

@ -803,7 +803,8 @@ static std::vector<std::string> s_Preset_printer_options {
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
"nozzle_type", "nozzle_hrc","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types",
//SoftFever
"host_type", "print_host", "printhost_apikey",
"host_type", "print_host", "printhost_apikey",
"print_host_webui",
"printhost_cafile","printhost_port","printhost_authorization_type",
"printhost_user", "printhost_password", "printhost_ssl_ignore_revoke"
};
@ -1694,6 +1695,11 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
{
// Load the preset over a default preset, so that the missing fields are filled in from the default preset.
DynamicPrintConfig cfg(this->default_preset_for(combined_config).config);
// SoftFever: ignore print connection info from project
cfg.erase("print_host");
cfg.erase("print_host_webui");
cfg.erase("printhost_apikey");
cfg.erase("printhost_cafile");
const auto &keys = cfg.keys();
cfg.apply_only(combined_config, keys, true);
std::string &inherits = Preset::inherits(cfg);

View file

@ -1552,6 +1552,9 @@ DynamicPrintConfig PresetBundle::full_config_secure() const
{
DynamicPrintConfig config = this->full_config();
//BBS example: config.erase("print_host");
config.erase("print_host_webui");
config.erase("printhost_apikey");
config.erase("printhost_cafile");
return config;
}

View file

@ -75,11 +75,11 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrinterTechnology)
static t_config_enum_values s_keys_map_PrintHostType{
{ "prusalink", htPrusaLink },
{ "octoprint", htOctoPrint },
//{ "duet", htDuet },
//{ "flashair", htFlashAir },
//{ "astrobox", htAstroBox },
//{ "repetier", htRepetier },
//{ "mks", htMKS }
{ "duet", htDuet },
{ "flashair", htFlashAir },
{ "astrobox", htAstroBox },
{ "repetier", htRepetier },
{ "mks", htMKS }
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrintHostType)
@ -404,6 +404,14 @@ void PrintConfigDef::init_common_params()
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionString(""));
def = this->add("print_host_webui", coString);
def->label = L("Device UI");
def->tooltip = L("Specify the URL of your device user interface if it's not same as print_host");
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionString(""));
def = this->add("printhost_apikey", coString);
def->label = L("API Key / Password");
def->tooltip = L("Slic3r can upload G-code files to a printer host. This field should contain "
@ -2011,18 +2019,18 @@ void PrintConfigDef::init_fff_params()
def->enum_keys_map = &ConfigOptionEnum<PrintHostType>::get_enum_values();
def->enum_values.push_back("prusalink");
def->enum_values.push_back("octoprint");
//def->enum_values.push_back("duet");
//def->enum_values.push_back("flashair");
//def->enum_values.push_back("astrobox");
//def->enum_values.push_back("repetier");
//def->enum_values.push_back("mks");
def->enum_values.push_back("duet");
def->enum_values.push_back("flashair");
def->enum_values.push_back("astrobox");
def->enum_values.push_back("repetier");
def->enum_values.push_back("mks");
def->enum_labels.push_back("PrusaLink");
def->enum_labels.push_back("OctoPrint");
//def->enum_labels.push_back("Duet");
//def->enum_labels.push_back("FlashAir");
//def->enum_labels.push_back("AstroBox");
//def->enum_labels.push_back("Repetier");
//def->enum_labels.push_back("MKS");
def->enum_labels.push_back("Duet");
def->enum_labels.push_back("FlashAir");
def->enum_labels.push_back("AstroBox");
def->enum_labels.push_back("Repetier");
def->enum_labels.push_back("MKS");
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));