Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
done
Browse files Browse the repository at this point in the history
download the configs you pass.  If there's a override file,
open both into json objects, and replace the values in the override value for all keys, except those excluded.
for layer-height fields, we open the printer config, read the min/max and clamp the override value as needed.
if the printer config doens't specify the max layer height (=0), then the max_layer_height is 75% of the nozzle_diameter.
save  the merged config file with a new file name.
update the filename to pooint to the merged one.
load configs into Orca as previously.
  • Loading branch information
PilotMatt committed Feb 25, 2024
1 parent 84db29b commit a857816
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 72 deletions.
4 changes: 3 additions & 1 deletion src/slic3r/Utils/PrintagoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ bool PrintagoDirector::ProcessPrintagoCommand(const PrintagoCommand& cmd)

actionDetail = wxString::Format("slice_config: %s", PBJob::localFile.GetFullPath());

OverridePrintSettings();
if (!PBJob::configFiles["print_override"].GetFullPath().IsEmpty()) {
OverridePrintSettings();
}
ImportPrintagoConfigs();
SetPrintagoConfigs();
wxGetApp().plater()->sidebar().on_bed_type_change(PBJob::bed_type);
Expand Down
148 changes: 77 additions & 71 deletions src/slic3r/Utils/PrintagoServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ class PrintagoCommand
json GetOriginalCommand() const { return m_original_command; }

private:
wxString m_command_type;
wxString m_action;
json m_parameters;
json m_original_command;
wxString m_command_type;
wxString m_action;
json m_parameters;
json m_original_command;
};

//``````````````````````````````````````````````````
Expand Down Expand Up @@ -186,13 +186,20 @@ class PrintagoDirector

void PostStatusMessage(const wxString& printer_id, const json& statusData, const json& command = {});
void PostResponseMessage(const wxString& printer_id, const json& responseData, const json& command = {});
void PostSuccessMessage(const wxString& printer_id, const wxString& localCommand, const json& command = {}, const wxString& localCommandDetail = "");
void PostErrorMessage(const wxString& printer_id, const wxString& localCommand, const json& command = {}, const wxString& errorDetail = "", const bool shouldUnblock = false);
void PostSuccessMessage(const wxString& printer_id,
const wxString& localCommand,
const json& command = {},
const wxString& localCommandDetail = "");
void PostErrorMessage(const wxString& printer_id,
const wxString& localCommand,
const json& command = {},
const wxString& errorDetail = "",
const bool shouldUnblock = false);

void _PostResponse(const PrintagoResponse& response) const;

bool ValidatePrintagoCommand(const PrintagoCommand& cmd);
bool ProcessPrintagoCommand(const PrintagoCommand& command);
bool ValidatePrintagoCommand(const PrintagoCommand& cmd);
bool ProcessPrintagoCommand(const PrintagoCommand& command);

json GetAllStatus();
void AddCurrentProcessJsonTo(json& statusObject);
Expand Down Expand Up @@ -254,7 +261,6 @@ class PBJob
bbl_do_flow_cali = false;

GUI::wxGetApp().printago_director()->ResetMachineDialog();

}

m_can_process_job = can_process_job;
Expand All @@ -263,68 +269,7 @@ class PBJob
inline static bool m_can_process_job = true;
inline static JobServerState m_serverState = JobServerState::Idle;

public:
static std::string serverStateStr()
{
switch (m_serverState) {
case JobServerState::Idle: return "idle";
case JobServerState::Download: return "download";
case JobServerState::Configure: return "configure";
case JobServerState::Slicing: return "slicing";
case JobServerState::Sending: return "sending";
default: return "null";
}
}

const inline static std::map<JobServerState, int> serverStateProgress = {{JobServerState::Idle, 0},
{JobServerState::Download, 7},
{JobServerState::Configure, 15},
{JobServerState::Slicing, 25},
{JobServerState::Sending, 90}};

inline static wxString jobId = "ptgo_default";
inline static wxString printerId;
inline static json command;
inline static wxFileName localFile;
inline static std::unordered_map<std::string, wxFileName> configFiles;
inline static int progress = 0;

inline static bool use_ams = false;
inline static bool bbl_do_bed_leveling = false;
inline static bool bbl_do_flow_cali = false;
inline static BedType bed_type = BedType::btDefault;

static BedType StringToBedType(const std::string& bedType)
{
if (bedType == "cool_plate")
return BedType::btPC;
else if (bedType == "eng_plate")
return BedType::btEP;
else if (bedType == "warm_plate")
return BedType::btPEI;
else if (bedType == "textured_pei")
return BedType::btPTE;
else
return BedType::btDefault;
}

static void SetServerState(JobServerState new_state, bool postMessage = false)
{
if (new_state != m_serverState)
progress = serverStateProgress.at(new_state);
m_serverState = new_state;

if (postMessage)
GUI::wxGetApp().printago_director()->PostJobUpdateMessage();
}

static JobServerState GetServerState() { return m_serverState; }
static bool CanProcessJob() { return m_can_process_job; }
static bool BlockJobProcessing() { return SetCanProcessJob(false); }
static bool UnblockJobProcessing() { return SetCanProcessJob(true); }
static std::vector<std::string> PrintSettingsNotToOverride() { return dont_override_these_print_settings; }
private:
static std::vector<std::string> dont_override_these_print_settings{
inline static std::vector<std::string> dont_override_these_print_settings{
"max_volumetric_extrusion_rate_slope",
"max_volumetric_extrusion_rate_slope_segment_length",
"inner_wall_speed",
Expand Down Expand Up @@ -391,6 +336,67 @@ class PBJob
"notes",
"wiping_volumes_extruders",
};

public:
static std::string serverStateStr()
{
switch (m_serverState) {
case JobServerState::Idle: return "idle";
case JobServerState::Download: return "download";
case JobServerState::Configure: return "configure";
case JobServerState::Slicing: return "slicing";
case JobServerState::Sending: return "sending";
default: return "null";
}
}

const inline static std::map<JobServerState, int> serverStateProgress = {{JobServerState::Idle, 0},
{JobServerState::Download, 7},
{JobServerState::Configure, 15},
{JobServerState::Slicing, 25},
{JobServerState::Sending, 90}};

inline static wxString jobId = "ptgo_default";
inline static wxString printerId;
inline static json command;
inline static wxFileName localFile;
inline static std::unordered_map<std::string, wxFileName> configFiles;
inline static int progress = 0;

inline static bool use_ams = false;
inline static bool bbl_do_bed_leveling = false;
inline static bool bbl_do_flow_cali = false;
inline static BedType bed_type = BedType::btDefault;

static BedType StringToBedType(const std::string& bedType)
{
if (bedType == "cool_plate")
return BedType::btPC;
else if (bedType == "eng_plate")
return BedType::btEP;
else if (bedType == "warm_plate")
return BedType::btPEI;
else if (bedType == "textured_pei")
return BedType::btPTE;
else
return BedType::btDefault;
}

static void SetServerState(JobServerState new_state, bool postMessage = false)
{
if (new_state != m_serverState)
progress = serverStateProgress.at(new_state);
m_serverState = new_state;

if (postMessage)
GUI::wxGetApp().printago_director()->PostJobUpdateMessage();
}

static JobServerState GetServerState() { return m_serverState; }
static bool CanProcessJob() { return m_can_process_job; }
static bool BlockJobProcessing() { return SetCanProcessJob(false); }
static bool UnblockJobProcessing() { return SetCanProcessJob(true); }
static std::vector<std::string> PrintSettingsNotToOverride() { return dont_override_these_print_settings; }
};

} // namespace Slic3r
Expand Down

0 comments on commit a857816

Please sign in to comment.