mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-06 08:26:02 +08:00
Make N 0-based
This commit is contained in:
parent
2fc8152e24
commit
5f30ab2f0d
@ -355,6 +355,7 @@ GCodeSender::on_read(const boost::system::error_code& error,
|
|||||||
// extract the first number from line
|
// extract the first number from line
|
||||||
boost::algorithm::trim_left_if(line, !boost::algorithm::is_digit());
|
boost::algorithm::trim_left_if(line, !boost::algorithm::is_digit());
|
||||||
size_t toresend = boost::lexical_cast<size_t>(line.substr(0, line.find_first_not_of("0123456789")));
|
size_t toresend = boost::lexical_cast<size_t>(line.substr(0, line.find_first_not_of("0123456789")));
|
||||||
|
toresend++; // N is 0-based
|
||||||
if (toresend >= this->sent - this->last_sent.size()) {
|
if (toresend >= this->sent - this->last_sent.size()) {
|
||||||
{
|
{
|
||||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||||
@ -473,8 +474,8 @@ GCodeSender::do_send()
|
|||||||
if (line.empty()) return;
|
if (line.empty()) return;
|
||||||
|
|
||||||
// compute full line
|
// compute full line
|
||||||
this->sent++;
|
|
||||||
std::string full_line = "N" + boost::lexical_cast<std::string>(this->sent) + " " + line;
|
std::string full_line = "N" + boost::lexical_cast<std::string>(this->sent) + " " + line;
|
||||||
|
this->sent++;
|
||||||
|
|
||||||
// calculate checksum
|
// calculate checksum
|
||||||
int cs = 0;
|
int cs = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user