Small adaptation and formatting

This commit is contained in:
Sergey Kovalev 2020-12-29 01:01:39 +07:00
parent 869b8c8c66
commit f1ae74f9d3
4 changed files with 331 additions and 323 deletions

View File

@ -83,7 +83,8 @@ bool MKS::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn er
BOOST_LOG_TRIVIAL(error) << boost::format("MKS: Request completed but error code was received: %1%") % err_code;
error_fn(format_error(body, L("Unknown error occured"), 0));
res = false;
} else if (upload_data.start_print) {
}
else if (upload_data.start_print) {
wxString errormsg;
res = start_print(errormsg, upload_data.upload_path.string());
if (!res) {
@ -107,7 +108,10 @@ bool MKS::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn er
.perform_sync();
if (res && upload_data.start_print) {
start_print(upload_data.upload_path);
wxString msg;
if (!start_print(msg, upload_data.upload_path.string())) {
error_fn(wxString("Can't start printing: ") + msg);
}
}
return res;
@ -127,7 +131,7 @@ bool MKS::start_print(wxString &msg, const std::string &filename) const
// TODO: Inspect reasons
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
console.enqueue_cmd("M23 " + upload_data.upload_path.string());
console.enqueue_cmd(std::string("M23 ") + filename);
console.enqueue_cmd("M24");
bool ret = console.run_queue();

View File

@ -81,7 +81,8 @@ void TCPConsole::handle_read(
% ec.message();
io_context_.stop();
} else {
}
else {
std::string line = extract_next_line();
boost::trim(line);
@ -94,7 +95,8 @@ void TCPConsole::handle_read(
if (line == done_string_) {
transmit_next_command();
} else {
}
else {
wait_next_line();
}
}
@ -112,7 +114,8 @@ void TCPConsole::handle_write(
% ec.message();
io_context_.stop();
} else {
}
else {
wait_next_line();
}
}
@ -128,7 +131,8 @@ void TCPConsole::handle_connect(const boost::system::error_code& ec)
% ec.message();
io_context_.stop();
} else {
}
else {
BOOST_LOG_TRIVIAL(info) << boost::format("TCPConsole: connected to %1%:%2%")
% host_name_
% port_name_;