Skip to content

Commit 0ce7c0c

Browse files
committed
Added step/dir interface and refactored commander
1 parent d84e875 commit 0ce7c0c

File tree

39 files changed

+411
-226
lines changed

39 files changed

+411
-226
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Additionally, most of the efforts at this moment are still channeled towards the
1111
Therefore this is an attempt to:
1212
- 🎯 Demystify FOC algorithm and make a robust but simple Arduino library: [Arduino *SimpleFOClibrary*](https://docs.simplefoc.com/arduino_simplefoc_library_showcase)
1313
- <i>Support as many <b>motor + sensor + driver + mcu</b> combinations out there</i>
14-
- 🎯 Develop a modular low-power BLDC driver board: [Arduino *SimpleFOCShield*](https://docs.simplefoc.com/arduino_simplefoc_shield_showcase).
14+
- 🎯 Develop a modular *low-power BLDC (Gimbal)* driver board: [*Arduino Simple**FOC**Shield*](https://docs.simplefoc.com/arduino_simplefoc_shield_showcase).
15+
- 🎯 Develop a modular *medium-power BLDC* driver board: [*Arduino Simple**FOC**PowerShield*](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield).
1516

1617
##### <b> NEXT RELEASE 📢:</b> <i>Simple<b>FOC</b>library v2.1
1718
> #### Implemented features in dev branch

examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void setup() {
8686
motor.initFOC();
8787

8888
// add target command T
89-
command.add('T', doTarget);
89+
command.add('T', doTarget, "target angle");
9090

9191
Serial.println(F("Motor ready."));
9292
Serial.println(F(("Set the target angle using serial terminal:"));

examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void setup() {
8484
motor.initFOC();
8585

8686
// add target command T
87-
command.add('T', doTarget);
87+
command.add('T', doTarget, "target angle");
8888

8989
Serial.println(F("Motor ready."));
9090
Serial.println(F("Set the target angle using serial terminal:"));

examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void doB(){encoder.handleB();}
3939

4040
// commander interface
4141
Commander command = Commander(Serial);
42-
void onA(char* cmd){ command.motor(&motor, cmd); }
42+
void onMotor(char* cmd){ command.motor(&motor, cmd); }
4343

4444
void setup() {
4545

@@ -105,7 +105,7 @@ void setup() {
105105
motor.target = 2;
106106

107107
// define the motor id
108-
command.add('A', onA);
108+
command.add('A', onMotor, "motor");
109109

110110
Serial.println(F("Full control example: "));
111111
Serial.println(F("Run user commands to configure and the motor (find the full command list in docs.simplefoc.com) \n "));

examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void doB(){encoder.handleB();}
4242

4343
// commander interface
4444
Commander command = Commander(Serial);
45-
void onA(char* cmd){ command.motor(&motor, cmd); }
45+
void onMotor(char* cmd){ command.motor(&motor, cmd); }
4646

4747
void setup() {
4848

@@ -106,7 +106,7 @@ void setup() {
106106
motor.target = 2;
107107

108108
// define the motor id
109-
command.add('A', onA);
109+
command.add('A', onMotor, "motor");
110110

111111
Serial.println(F("Full control example: "));
112112
Serial.println(F("Run user commands to configure and the motor (find the full command list in docs.simplefoc.com) \n "));

examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void setup() {
7878
motor.initFOC();
7979

8080
// add target command T
81-
command.add('T', doTarget);
81+
command.add('T', doTarget, "target angle");
8282

8383
Serial.println(F("Motor ready."));
8484
Serial.println(F("Set the target angle using serial terminal:"));

examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void setup() {
8181
motor.initFOC();
8282

8383
// add target command T
84-
command.add('T', doTarget);
84+
command.add('T', doTarget, "target angle");
8585

8686
Serial.println(F("Motor ready."));
8787
Serial.println(F("Set the target angle using serial terminal:"));

examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void setup() {
9797
motor.initFOC();
9898

9999
// add target command T
100-
command.add('T', doTarget);
100+
command.add('T', doTarget, "target angle");
101101

102102
Serial.println(F("Motor ready."));
103103
Serial.println(F("Set the target angle using serial terminal:"));

examples/hardware_specific_examples/HMBGC_example/voltage_control/voltage_control.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void setup() {
8484
motor.initFOC();
8585

8686
// add target command T
87-
command.add('T', doTarget);
87+
command.add('T', doTarget, "target voltage");
8888

8989
Serial.println(F("Motor ready."));
9090
Serial.println(F("Set the target voltage using serial terminal:"));

examples/hardware_specific_examples/SimpleFOCShield/version_v1/double_full_control_example/double_full_control_example.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ void setup() {
9494
motor2.target = 2;
9595

9696
// subscribe motor to the commander
97-
command.add('A', doMotor1);
98-
command.add('B', doMotor2);
97+
command.add('A', doMotor1, "motor 1");
98+
command.add('B', doMotor2, "motor 2");
9999

100100
// Run user commands to configure and the motor (find the full command list in docs.simplefoc.com)
101101
Serial.println(F("Double motor sketch ready."));

0 commit comments

Comments
 (0)