From 5c9ffe2ba1cedd51165cc83edfdd54abdd0f1efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Sandvik=20Nilsson?= Date: Mon, 26 Mar 2018 11:39:32 +0200 Subject: [PATCH] Run io serivce operations as secondary urscripts --- src/ur/commander.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ur/commander.cpp b/src/ur/commander.cpp index 9b85865..44f5867 100644 --- a/src/ur/commander.cpp +++ b/src/ur/commander.cpp @@ -73,7 +73,7 @@ bool URCommander_V1_X::speedj(std::array &speeds, double acceleration bool URCommander_V1_X::setAnalogOut(uint8_t pin, double value) { std::ostringstream out; - out << "set_analog_out(" << (int)pin << "," << std::fixed << std::setprecision(4) << value << ")\n"; + out << "sec io_fun():\n" << "set_analog_out(" << (int)pin << "," << std::fixed << std::setprecision(4) << value << ")\n" << "end\n"; std::string s(out.str()); return write(s); } @@ -81,7 +81,7 @@ bool URCommander_V1_X::setAnalogOut(uint8_t pin, double value) bool URCommander_V1_X::setDigitalOut(uint8_t pin, bool value) { std::ostringstream out; - out << "set_digital_out(" << (int)pin << "," << (value ? "True" : "False") << ")\n"; + out << "sec io_fun():\n" << "set_digital_out(" << (int)pin << "," << (value ? "True" : "False") << ")\n" << "end\n"; std::string s(out.str()); return write(s); } @@ -89,7 +89,7 @@ bool URCommander_V1_X::setDigitalOut(uint8_t pin, bool value) bool URCommander_V3_X::setAnalogOut(uint8_t pin, double value) { std::ostringstream out; - out << "set_standard_analog_out(" << (int)pin << "," << std::fixed << std::setprecision(5) << value << ")\n"; + out << "sec io_fun():\n" << "set_standard_analog_out(" << (int)pin << "," << std::fixed << std::setprecision(5) << value << ")\n" << "end\n"; std::string s(out.str()); return write(s); } @@ -116,7 +116,7 @@ bool URCommander_V3_X::setDigitalOut(uint8_t pin, bool value) else return false; - out << func << "(" << (int)pin << "," << (value ? "True" : "False") << ")\n"; + out << "sec io_fun():\n" << func << "(" << (int)pin << "," << (value ? "True" : "False") << ")\n" << "end\n"; std::string s(out.str()); return write(s); }