Permalink
Browse files

add ascii command f for feedback

  • Loading branch information...
madcowswe committed Feb 10, 2019
1 parent a86fb3e commit 1e4b71b67bb2ba8ba0bd10135dd2db08f2d07def
Showing with 13 additions and 0 deletions.
  1. +13 −0 Firmware/communication/ascii_protocol.cpp
@@ -155,6 +155,19 @@ void ASCII_protocol_process_line(const uint8_t* buffer, size_t len, StreamSink&
axes[motor_number]->controller_.move_to_pos(goal_point);
}

} else if (cmd[0] == 'f') { // feedback
unsigned motor_number;
int numscan = sscanf(cmd, "f %u", &motor_number);
if (numscan < 1) {
respond(response_channel, use_checksum, "invalid command format");
} else if (motor_number >= AXIS_COUNT) {
respond(response_channel, use_checksum, "invalid motor %u", motor_number);
} else {
respond(response_channel, use_checksum, "%f %f",
(double)axes[motor_number]->encoder_.pos_estimate_,
(double)axes[motor_number]->encoder_.vel_estimate_);
}

} else if (cmd[0] == 'h') { // Help
respond(response_channel, use_checksum, "Please see documentation for more details");
respond(response_channel, use_checksum, "");

0 comments on commit 1e4b71b

Please sign in to comment.