mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 06:57:36 -06:00
Fix Process_T
This commit is contained in:
parent
338f4609f3
commit
6fe5abc8cc
1 changed files with 11 additions and 5 deletions
|
@ -19,6 +19,8 @@
|
|||
#include <float.h>
|
||||
#include <assert.h>
|
||||
#include <regex>
|
||||
#include <charconv>
|
||||
#include <system_error>
|
||||
|
||||
#if __has_include(<charconv>)
|
||||
#include <charconv>
|
||||
|
@ -4061,19 +4063,23 @@ void GCodeProcessor::process_T(const GCodeReader::GCodeLine& line)
|
|||
|
||||
void GCodeProcessor::process_T(const std::string_view command)
|
||||
{
|
||||
unsigned int new_extruder = 0;
|
||||
auto ret = std::from_chars(command.data() + 1, command.data()+command.size(), new_extruder);
|
||||
if (std::errc::invalid_argument == ret.ec)
|
||||
return;
|
||||
|
||||
if (command.length() > 1) {
|
||||
int eid = 0;
|
||||
if (! parse_number(command.substr(1), eid) || eid < 0 || eid > 254) {
|
||||
if (new_extruder < 0 || new_extruder > 254) {
|
||||
//BBS: T255, T1000 and T1100 is used as special command for BBL machine and does not cost time. return directly
|
||||
if ((m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware) && (command == "Tx" || command == "Tc" || command == "T?" ||
|
||||
eid == 1000 || eid == 1100 || eid == 255))
|
||||
new_extruder == 1000 || new_extruder == 1100 || new_extruder == 255))
|
||||
return;
|
||||
|
||||
// T-1 is a valid gcode line for RepRap Firmwares (used to deselects all tools)
|
||||
if ((m_flavor != gcfRepRapFirmware && m_flavor != gcfRepRapSprinter) || eid != -1)
|
||||
if ((m_flavor != gcfRepRapFirmware && m_flavor != gcfRepRapSprinter) || new_extruder != -1)
|
||||
BOOST_LOG_TRIVIAL(error) << "Invalid T command (" << command << ").";
|
||||
} else {
|
||||
unsigned char id = static_cast<unsigned char>(eid);
|
||||
unsigned char id = static_cast<unsigned char>(new_extruder);
|
||||
if (m_extruder_id != id) {
|
||||
if (id >= m_result.extruders_count)
|
||||
BOOST_LOG_TRIVIAL(error) << "Invalid T command (" << command << ").";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue