Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2015-01-04 01:25:55 +0300
committerAlessandro Ranellucci <aar@cpan.org>2015-01-04 01:25:55 +0300
commit2c0d216c1a87f79d91c956c1d62da577e430d079 (patch)
tree99f04cd9d4b3e3d98605311e3ca541c915ec2370 /xs/src/libslic3r/GCodeSender.cpp
parentc06ce3b58ccf6c3638d8feba157c9b1170734dec (diff)
More work on print controller
Diffstat (limited to 'xs/src/libslic3r/GCodeSender.cpp')
-rw-r--r--xs/src/libslic3r/GCodeSender.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/xs/src/libslic3r/GCodeSender.cpp b/xs/src/libslic3r/GCodeSender.cpp
index 8ed233c5f..c0871dc90 100644
--- a/xs/src/libslic3r/GCodeSender.cpp
+++ b/xs/src/libslic3r/GCodeSender.cpp
@@ -23,7 +23,8 @@ namespace Slic3r {
namespace asio = boost::asio;
GCodeSender::GCodeSender()
- : io(), serial(io), can_send(false), sent(0), error(false), connected(false)
+ : io(), serial(io), can_send(false), sent(0), error(false), connected(false),
+ queue_paused(false)
{}
GCodeSender::~GCodeSender()
@@ -141,6 +142,23 @@ GCodeSender::queue_size() const
}
void
+GCodeSender::pause_queue()
+{
+ boost::lock_guard<boost::mutex> l(this->queue_mutex);
+ this->queue_paused = true;
+}
+
+void
+GCodeSender::resume_queue()
+{
+ {
+ boost::lock_guard<boost::mutex> l(this->queue_mutex);
+ this->queue_paused = false;
+ }
+ this->send();
+}
+
+void
GCodeSender::do_close()
{
boost::system::error_code ec;
@@ -260,6 +278,7 @@ GCodeSender::send()
{
// printer is not connected or we're still waiting for the previous ack
if (!this->can_send) return;
+ if (this->queue_paused) return;
boost::lock_guard<boost::mutex> l(this->queue_mutex);
if (this->queue.empty()) return;