Skip to content

Commit

Permalink
fix(cmd): fix cmds to match automated test (#16)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
	- Updated variable declarations for improved clarity.
	- Renamed a function for better consistency.
	- Adjusted command character in setup for enhanced clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
hcd-bdltd authored Feb 15, 2024
2 parents 96af783 + 525918a commit 70cbf17
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ void doB(){ hall_sensor.handleB(); }
void doC(){ hall_sensor.handleC(); }

// angle set point variable
float target = 0;
float target = 0.0f;
// instantiate the commander
Commander commander = Commander(Serial);
void doMotor(char* cmd) { commander.motor(&motor, cmd); }
void doRadians(char* cmd) { commander.scalar(&target, cmd); }
void doDegrees(char* cmd) {
void doTarget(char* cmd) {
float angle_degrees;
commander.scalar(&angle_degrees, cmd);
target = angle_degrees * (PI / 180.0);
Expand Down Expand Up @@ -107,9 +106,8 @@ void setup() {

// initialize serial communication
commander.verbose = VerboseMode::user_friendly;
commander.add('m',doMotor,"motor");
commander.add('r', doRadians, "angle [rad]");
commander.add('d', doDegrees, "angle [deg]");
commander.add('M',doMotor,"motor");
commander.add('T', doTarget, "target [deg]");

SIMPLEFOC_DEBUG("Setup ready.");
SIMPLEFOC_DEBUG("Set the target angle using serial terminal:");
Expand Down

0 comments on commit 70cbf17

Please sign in to comment.