fix settings printing & failsafe for gcode viewer

This commit is contained in:
supermerill 2020-11-11 19:42:38 +01:00
parent be088cc149
commit 027bf9f132
2 changed files with 11 additions and 6 deletions

View File

@ -465,7 +465,7 @@ private:
#endif // ENABLE_GCODE_VIEWER
// Write a string into a file.
void _write(FILE* file, const std::string& what, bool flush = false) { this->_write(file, what.c_str()); }
void _write(FILE* file, const std::string& what, bool flush = false) { this->_write(file, what.c_str(), flush); }
void _write(FILE* file, const char *what, bool flush = false);
// Write a string into a file.

View File

@ -812,11 +812,16 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
// if the gcode was produced by SuperSlicer,
// extract the config from it
if (m_producer == EProducer::PrusaSlicer || m_producer == EProducer::SuperSlicer || m_producer == EProducer::Slic3rPE || m_producer == EProducer::Slic3r) {
DynamicPrintConfig config;
config.apply(FullPrintConfig::defaults());
config.load_from_gcode_file(filename);
apply_config(config);
try {
if (m_producer == EProducer::PrusaSlicer || m_producer == EProducer::SuperSlicer || m_producer == EProducer::Slic3rPE || m_producer == EProducer::Slic3r) {
DynamicPrintConfig config;
config.apply(FullPrintConfig::defaults());
config.load_from_gcode_file(filename);
apply_config(config);
}
}
catch (Exception ex) {
m_producer = EProducer::Unknown;
}
}