From 5da4221b63c351c37b8b4c9d6661ddc02e2c757b Mon Sep 17 00:00:00 2001 From: Jim Morris Date: Sat, 26 Nov 2016 14:30:55 -0800 Subject: [PATCH] add ABC axis to test raw --- src/modules/utils/simpleshell/SimpleShell.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/utils/simpleshell/SimpleShell.cpp b/src/modules/utils/simpleshell/SimpleShell.cpp index 455ab3a3..c4abe932 100644 --- a/src/modules/utils/simpleshell/SimpleShell.cpp +++ b/src/modules/utils/simpleshell/SimpleShell.cpp @@ -1081,13 +1081,19 @@ void SimpleShell::test_command( string parameters, StreamOutput *stream) return; } - uint8_t a= toupper(axis[0]) - 'X'; + char ax= toupper(axis[0]); + uint8_t a= ax >= 'X' ? ax - 'X' : ax - 'A' + 3; int steps= strtol(stepstr.c_str(), NULL, 10); bool dir= steps >= 0; steps= std::abs(steps); - if(a > Z_AXIS) { - stream->printf("error: axis must be x y or z\n"); + if(a > C_AXIS) { + stream->printf("error: axis must be x, y, z, a, b, c\n"); + return; + } + + if(a >= THEROBOT->get_number_registered_motors()) { + stream->printf("error: axis is out of range\n"); return; } -- 2.20.1