Multiple fixes for building
This commit is contained in:
parent
f1ae74f9d3
commit
bb928f6ef7
4 changed files with 21 additions and 14 deletions
|
@ -32,13 +32,15 @@ namespace pt = boost::property_tree;
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
MKS::MKS(DynamicPrintConfig* config) :
|
MKS::MKS(DynamicPrintConfig* config) :
|
||||||
host(config->opt_string("print_host")), console(config->opt_string("print_host"), "8080")
|
host(config->opt_string("print_host")), console_port("8080")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const char* MKS::get_name() const { return "MKS"; }
|
const char* MKS::get_name() const { return "MKS"; }
|
||||||
|
|
||||||
bool MKS::test(wxString& msg) const
|
bool MKS::test(wxString& msg) const
|
||||||
{
|
{
|
||||||
|
Utils::TCPConsole console(host, console_port);
|
||||||
|
|
||||||
console.enqueue_cmd("M105");
|
console.enqueue_cmd("M105");
|
||||||
bool ret = console.run_queue();
|
bool ret = console.run_queue();
|
||||||
|
|
||||||
|
@ -131,6 +133,8 @@ namespace Slic3r {
|
||||||
// TODO: Inspect reasons
|
// TODO: Inspect reasons
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
|
||||||
|
|
||||||
|
Utils::TCPConsole console(host, console_port);
|
||||||
|
|
||||||
console.enqueue_cmd(std::string("M23 ") + filename);
|
console.enqueue_cmd(std::string("M23 ") + filename);
|
||||||
console.enqueue_cmd("M24");
|
console.enqueue_cmd("M24");
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "TCPConsole.hpp"
|
#include "TCPConsole.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class DynamicPrintConfig;
|
class DynamicPrintConfig;
|
||||||
class Http;
|
class Http;
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ namespace Slic3r {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string host;
|
std::string host;
|
||||||
Utils::TCPConsole console;
|
std::string console_port;
|
||||||
|
|
||||||
std::string get_upload_url(const std::string& filename) const;
|
std::string get_upload_url(const std::string& filename) const;
|
||||||
std::string timestamp_str() const;
|
std::string timestamp_str() const;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <TCPConsole.hpp>
|
#include "TCPConsole.hpp"
|
||||||
|
|
||||||
using boost::asio::steady_timer;
|
using boost::asio::steady_timer;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
@ -20,6 +20,18 @@ using boost::asio::ip::tcp;
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
|
const char* default_newline = "\n";
|
||||||
|
const char* default_done_string = "ok";
|
||||||
|
|
||||||
|
TCPConsole::TCPConsole() : resolver_(io_context_), socket_(io_context_), newline_(default_newline), done_string_(default_done_string) {}
|
||||||
|
|
||||||
|
TCPConsole::TCPConsole(const std::string& host_name, const std::string& port_name) :
|
||||||
|
resolver_(io_context_), socket_(io_context_), newline_(default_newline), done_string_(default_done_string)
|
||||||
|
{
|
||||||
|
set_remote(host_name, port_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TCPConsole::transmit_next_command()
|
void TCPConsole::transmit_next_command()
|
||||||
{
|
{
|
||||||
if (cmd_queue_.empty()) {
|
if (cmd_queue_.empty()) {
|
||||||
|
|
|
@ -10,21 +10,13 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
const char* default_newline = "\n";
|
|
||||||
const char* default_done_string = "ok";
|
|
||||||
|
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
class TCPConsole
|
class TCPConsole
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TCPConsole() : resolver_(io_context_), socket_(io_context_), newline_(default_newline), done_string_(default_done_string) {}
|
TCPConsole();
|
||||||
|
TCPConsole(const std::string& host_name, const std::string& port_name);
|
||||||
TCPConsole(const std::string& host_name, const std::string& port_name) :
|
|
||||||
resolver_(io_context_), socket_(io_context_), newline_(default_newline), done_string_(default_done_string)
|
|
||||||
{
|
|
||||||
set_remote(host_name, port_name);
|
|
||||||
}
|
|
||||||
~TCPConsole() {}
|
~TCPConsole() {}
|
||||||
|
|
||||||
void set_line_delimiter(const std::string& newline) {
|
void set_line_delimiter(const std::string& newline) {
|
||||||
|
|
Loading…
Reference in a new issue