From 922f169dba03c9f249a0746dbab0efde0ad10dc1 Mon Sep 17 00:00:00 2001 From: Jim Morris Date: Fri, 4 May 2018 17:48:52 +0100 Subject: [PATCH] Remove deprecated query format --- src/libs/Kernel.cpp | 113 +++++++----------- src/libs/Kernel.h | 1 - src/modules/utils/simpleshell/SimpleShell.cpp | 2 +- 3 files changed, 46 insertions(+), 70 deletions(-) diff --git a/src/libs/Kernel.cpp b/src/libs/Kernel.cpp index a2a29d46..83fe48c2 100644 --- a/src/libs/Kernel.cpp +++ b/src/libs/Kernel.cpp @@ -50,7 +50,6 @@ #define grbl_mode_checksum CHECKSUM("grbl_mode") #define feed_hold_enable_checksum CHECKSUM("enable_feed_hold") #define ok_per_line_checksum CHECKSUM("ok_per_line") -#define new_status_format_checksum CHECKSUM("new_status_format") Kernel* Kernel::instance; @@ -120,8 +119,6 @@ Kernel::Kernel() // we expect ok per line now not per G code, setting this to false will return to the old (incorrect) way of ok per G code this->ok_per_line = this->config->value( ok_per_line_checksum )->by_default(true)->as_bool(); - this->new_status_format = this->config->value( new_status_format_checksum )->by_default(true)->as_bool(); - this->add_module( this->serial ); // HAL stuff @@ -208,54 +205,44 @@ std::string Kernel::get_query_string() size_t n = snprintf(buf, sizeof(buf), "%1.4f,%1.4f,%1.4f", robot->from_millimeters(mpos[0]), robot->from_millimeters(mpos[1]), robot->from_millimeters(mpos[2])); if(n > sizeof(buf)) n= sizeof(buf); - if(new_status_format) { - str.append("|MPos:").append(buf, n); + str.append("|MPos:").append(buf, n); #if MAX_ROBOT_ACTUATORS > 3 - // deal with the ABC axis (E will be A) - for (int i = A_AXIS; i < robot->get_number_registered_motors(); ++i) { - // current actuator position - n = snprintf(buf, sizeof(buf), ",%1.4f", robot->from_millimeters(robot->actuators[i]->get_current_position())); - if(n > sizeof(buf)) n= sizeof(buf); - str.append(buf, n); - } -#endif - - }else{ - str.append(",MPos:").append(buf, n); + // deal with the ABC axis (E will be A) + for (int i = A_AXIS; i < robot->get_number_registered_motors(); ++i) { + // current actuator position + n = snprintf(buf, sizeof(buf), ",%1.4f", robot->from_millimeters(robot->actuators[i]->get_current_position())); + if(n > sizeof(buf)) n= sizeof(buf); + str.append(buf, n); } +#endif // work space position Robot::wcs_t pos = robot->mcs2wcs(mpos); n = snprintf(buf, sizeof(buf), "%1.4f,%1.4f,%1.4f", robot->from_millimeters(std::get(pos)), robot->from_millimeters(std::get(pos)), robot->from_millimeters(std::get(pos))); if(n > sizeof(buf)) n= sizeof(buf); - if(new_status_format) { - str.append("|WPos:").append(buf, n); - // current feedrate - float fr= robot->from_millimeters(conveyor->get_current_feedrate()*60.0F); - n = snprintf(buf, sizeof(buf), "|F:%1.4f", fr); - if(n > sizeof(buf)) n= sizeof(buf); - str.append(buf, n); - float sr= robot->get_s_value(); - n = snprintf(buf, sizeof(buf), "|S:%1.4f", sr); - if(n > sizeof(buf)) n= sizeof(buf); - str.append(buf, n); - - // current Laser power - #ifndef NO_TOOLS_LASER - Laser *plaser= nullptr; - if(PublicData::get_value(laser_checksum, (void *)&plaser) && plaser != nullptr) { - float lp= plaser->get_current_power(); - n = snprintf(buf, sizeof(buf), "|L:%1.4f", lp); - if(n > sizeof(buf)) n= sizeof(buf); - str.append(buf, n); - } - #endif - - }else{ - str.append(",WPos:").append(buf, n); - } + str.append("|WPos:").append(buf, n); + // current feedrate + float fr= robot->from_millimeters(conveyor->get_current_feedrate()*60.0F); + n = snprintf(buf, sizeof(buf), "|F:%1.4f", fr); + if(n > sizeof(buf)) n= sizeof(buf); + str.append(buf, n); + float sr= robot->get_s_value(); + n = snprintf(buf, sizeof(buf), "|S:%1.4f", sr); + if(n > sizeof(buf)) n= sizeof(buf); + str.append(buf, n); + + // current Laser power + #ifndef NO_TOOLS_LASER + Laser *plaser= nullptr; + if(PublicData::get_value(laser_checksum, (void *)&plaser) && plaser != nullptr) { + float lp= plaser->get_current_power(); + n = snprintf(buf, sizeof(buf), "|L:%1.4f", lp); + if(n > sizeof(buf)) n= sizeof(buf); + str.append(buf, n); + } + #endif } else { // return the last milestone if idle @@ -264,43 +251,33 @@ std::string Kernel::get_query_string() Robot::wcs_t mpos = robot->get_axis_position(); size_t n = snprintf(buf, sizeof(buf), "%1.4f,%1.4f,%1.4f", robot->from_millimeters(std::get(mpos)), robot->from_millimeters(std::get(mpos)), robot->from_millimeters(std::get(mpos))); if(n > sizeof(buf)) n= sizeof(buf); - if(new_status_format) { - str.append("|MPos:").append(buf, n); -#if MAX_ROBOT_ACTUATORS > 3 - // deal with the ABC axis (E will be A) - for (int i = A_AXIS; i < robot->get_number_registered_motors(); ++i) { - // current actuator position - n = snprintf(buf, sizeof(buf), ",%1.4f", robot->from_millimeters(robot->actuators[i]->get_current_position())); - if(n > sizeof(buf)) n= sizeof(buf); - str.append(buf, n); - } -#endif - }else{ - str.append(",MPos:").append(buf, n); + str.append("|MPos:").append(buf, n); + +#if MAX_ROBOT_ACTUATORS > 3 + // deal with the ABC axis (E will be A) + for (int i = A_AXIS; i < robot->get_number_registered_motors(); ++i) { + // current actuator position + n = snprintf(buf, sizeof(buf), ",%1.4f", robot->from_millimeters(robot->actuators[i]->get_current_position())); + if(n > sizeof(buf)) n= sizeof(buf); + str.append(buf, n); } +#endif // work space position Robot::wcs_t pos = robot->mcs2wcs(mpos); n = snprintf(buf, sizeof(buf), "%1.4f,%1.4f,%1.4f", robot->from_millimeters(std::get(pos)), robot->from_millimeters(std::get(pos)), robot->from_millimeters(std::get(pos))); if(n > sizeof(buf)) n= sizeof(buf); - if(new_status_format) { - str.append("|WPos:").append(buf, n); - }else{ - str.append(",WPos:").append(buf, n); - } - - if(new_status_format) { - float fr= robot->from_millimeters(robot->get_feed_rate()); - n = snprintf(buf, sizeof(buf), "|F:%1.4f", fr); - if(n > sizeof(buf)) n= sizeof(buf); - str.append(buf, n); - } + str.append("|WPos:").append(buf, n); + float fr= robot->from_millimeters(robot->get_feed_rate()); + n = snprintf(buf, sizeof(buf), "|F:%1.4f", fr); + if(n > sizeof(buf)) n= sizeof(buf); + str.append(buf, n); } // if not grbl mode get temperatures - if(new_status_format && !is_grbl_mode()) { + if(!is_grbl_mode()) { struct pad_temperature temp; // scan all temperature controls std::vector controllers; diff --git a/src/libs/Kernel.h b/src/libs/Kernel.h index 709ff9ff..d30f0ecd 100644 --- a/src/libs/Kernel.h +++ b/src/libs/Kernel.h @@ -84,7 +84,6 @@ class Kernel { bool feed_hold:1; bool ok_per_line:1; bool enable_feed_hold:1; - bool new_status_format:1; }; }; diff --git a/src/modules/utils/simpleshell/SimpleShell.cpp b/src/modules/utils/simpleshell/SimpleShell.cpp index 33f99e11..3821d14f 100644 --- a/src/modules/utils/simpleshell/SimpleShell.cpp +++ b/src/modules/utils/simpleshell/SimpleShell.cpp @@ -1121,7 +1121,7 @@ void SimpleShell::test_command( string parameters, StreamOutput *stream) // reset the position based on current actuator position THEROBOT->reset_position_from_current_actuator_position(); - stream->printf("done\n"); + //stream->printf("done\n"); }else { stream->printf("usage:\n test jog axis distance iterations [feedrate]\n"); -- 2.20.1