From 5f30ab2f0d80b528a25bd987d77dc9b34e0f03e9 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 26 Mar 2017 04:18:06 +0200 Subject: [PATCH] Make N 0-based --- xs/src/libslic3r/GCodeSender.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xs/src/libslic3r/GCodeSender.cpp b/xs/src/libslic3r/GCodeSender.cpp index bb91a84c1..c880ee408 100644 --- a/xs/src/libslic3r/GCodeSender.cpp +++ b/xs/src/libslic3r/GCodeSender.cpp @@ -355,6 +355,7 @@ GCodeSender::on_read(const boost::system::error_code& error, // extract the first number from line boost::algorithm::trim_left_if(line, !boost::algorithm::is_digit()); size_t toresend = boost::lexical_cast(line.substr(0, line.find_first_not_of("0123456789"))); + toresend++; // N is 0-based if (toresend >= this->sent - this->last_sent.size()) { { boost::lock_guard l(this->queue_mutex); @@ -473,8 +474,8 @@ GCodeSender::do_send() if (line.empty()) return; // compute full line - this->sent++; std::string full_line = "N" + boost::lexical_cast(this->sent) + " " + line; + this->sent++; // calculate checksum int cs = 0;