Integration with Octoprint. #1826

This commit is contained in:
Alessandro Ranellucci 2014-12-28 01:30:05 +01:00
parent eba19aaba4
commit efe7d5f857
6 changed files with 104 additions and 10 deletions

View file

@ -498,6 +498,16 @@ PrintConfigDef::build_def() {
Options["nozzle_diameter"].sidetext = "mm";
Options["nozzle_diameter"].cli = "nozzle-diameter=f@";
Options["octoprint_apikey"].type = coString;
Options["octoprint_apikey"].label = "API Key";
Options["octoprint_apikey"].tooltip = "Slic3r can upload G-code files to Octoprint. This field should contain the API Key required for authentication.";
Options["octoprint_apikey"].cli = "octoprint-apikey=s";
Options["octoprint_host"].type = coString;
Options["octoprint_host"].label = "Host or IP";
Options["octoprint_host"].tooltip = "Slic3r can upload G-code files to Octoprint. This field should contain the hostname or IP address of the Octoprint instance.";
Options["octoprint_host"].cli = "octoprint-host=s";
Options["only_retract_when_crossing_perimeters"].type = coBool;
Options["only_retract_when_crossing_perimeters"].label = "Only retract when crossing perimeters";
Options["only_retract_when_crossing_perimeters"].tooltip = "Disables retraction when the travel path does not exceed the upper layer's perimeters (and thus any ooze will be probably invisible).";

View file

@ -582,7 +582,27 @@ class PrintConfig : public GCodeConfig
};
};
class FullPrintConfig : public PrintObjectConfig, public PrintRegionConfig, public PrintConfig
class HostConfig : public virtual StaticPrintConfig
{
public:
ConfigOptionString octoprint_host;
ConfigOptionString octoprint_apikey;
HostConfig() : StaticPrintConfig() {
this->octoprint_host.value = "";
this->octoprint_apikey.value = "";
};
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
if (opt_key == "octoprint_host") return &this->octoprint_host;
if (opt_key == "octoprint_apikey") return &this->octoprint_apikey;
return NULL;
};
};
class FullPrintConfig
: public PrintObjectConfig, public PrintRegionConfig, public PrintConfig, public HostConfig
{
public:
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
@ -590,6 +610,7 @@ class FullPrintConfig : public PrintObjectConfig, public PrintRegionConfig, publ
if ((opt = PrintObjectConfig::option(opt_key, create)) != NULL) return opt;
if ((opt = PrintRegionConfig::option(opt_key, create)) != NULL) return opt;
if ((opt = PrintConfig::option(opt_key, create)) != NULL) return opt;
if ((opt = HostConfig::option(opt_key, create)) != NULL) return opt;
return NULL;
};
};