mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-25 19:13:39 +08:00
improve ascii help string
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
#include "odrive_main.h"
|
||||
#include "../build/version.h" // autogenerated based on Git state
|
||||
#include "communication.h"
|
||||
#include "ascii_protocol.hpp"
|
||||
#include <utils.h>
|
||||
@@ -127,10 +128,24 @@ void ASCII_protocol_process_line(const uint8_t* buffer, size_t len, StreamSink&
|
||||
axes[motor_number]->controller_.set_current_setpoint(current_setpoint);
|
||||
}
|
||||
|
||||
} else if (cmd[0] == 'h') { // Help
|
||||
respond(response_channel, use_checksum, "Please see documentation for more details");
|
||||
respond(response_channel, use_checksum, "");
|
||||
respond(response_channel, use_checksum, "Available commands syntax reference:");
|
||||
respond(response_channel, use_checksum, "Position: p axis pos vel-ff I-ff");
|
||||
respond(response_channel, use_checksum, "Velocity: v axis vel I-ff");
|
||||
respond(response_channel, use_checksum, "Current: c axis I");
|
||||
respond(response_channel, use_checksum, "");
|
||||
respond(response_channel, use_checksum, "Properties start at odrive root, such as axis0.requested_state");
|
||||
respond(response_channel, use_checksum, "Read: r property");
|
||||
respond(response_channel, use_checksum, "Write: w property value");
|
||||
|
||||
} else if (cmd[0] == 'i'){ // Dump device info
|
||||
respond(response_channel, use_checksum, "Signature: %#x", STM_ID_GetSignature());
|
||||
respond(response_channel, use_checksum, "Revision: %#x", STM_ID_GetRevision());
|
||||
respond(response_channel, use_checksum, "Flash Size: %#x KiB", STM_ID_GetFlashSize());
|
||||
// respond(response_channel, use_checksum, "Signature: %#x", STM_ID_GetSignature());
|
||||
// respond(response_channel, use_checksum, "Revision: %#x", STM_ID_GetRevision());
|
||||
// respond(response_channel, use_checksum, "Flash Size: %#x KiB", STM_ID_GetFlashSize());
|
||||
respond(response_channel, use_checksum, "Hardware version: %d.%d-%dV", HW_VERSION_MAJOR, HW_VERSION_MINOR, HW_VERSION_VOLTAGE);
|
||||
respond(response_channel, use_checksum, "Firmware version: %d.%d.%d", FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_REVISION);
|
||||
respond(response_channel, use_checksum, "Serial number: %s", serial_number_str);
|
||||
|
||||
} else if (cmd[0] == 'r') { // read property
|
||||
@@ -151,6 +166,7 @@ void ASCII_protocol_process_line(const uint8_t* buffer, size_t len, StreamSink&
|
||||
respond(response_channel, use_checksum, response);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (cmd[0] == 'w') { // write property
|
||||
char name[MAX_LINE_LENGTH];
|
||||
char value[MAX_LINE_LENGTH];
|
||||
@@ -168,10 +184,6 @@ void ASCII_protocol_process_line(const uint8_t* buffer, size_t len, StreamSink&
|
||||
}
|
||||
}
|
||||
|
||||
} else if (cmd[0] == 'h') { // HALT
|
||||
for(size_t i = 0; i < AXIS_COUNT; i++){
|
||||
axes[i]->controller_.set_vel_setpoint(0.0f, 0.0f);
|
||||
}
|
||||
} else if (cmd[0] != 0) {
|
||||
respond(response_channel, use_checksum, "unknown command");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user