Skip to content

Commit 3c3e9c8

Browse files
committed
added the debugging in examples
1 parent 0611830 commit 3c3e9c8

File tree

54 files changed

+322
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+322
-112
lines changed

examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ void doTarget(char* cmd) { command.motion(&motor, cmd); }
2626

2727
void setup() {
2828

29+
// use monitoring with serial
30+
Serial.begin(115200);
31+
// enable more verbose output for debugging
32+
// comment out if not needed
33+
SimpleFOCDebug::enable(&Serial);
34+
2935
// initialize encoder sensor hardware
3036
encoder.init();
3137
encoder.enableInterrupts(doA, doB);
@@ -76,9 +82,6 @@ void setup() {
7682
// maximal velocity of the position control
7783
motor.velocity_limit = 4;
7884

79-
80-
// use monitoring with serial
81-
Serial.begin(115200);
8285
// comment out if not needed
8386
motor.useMonitoring(Serial);
8487

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3333

3434
void setup() {
3535

36+
// use monitoring with serial
37+
Serial.begin(115200);
38+
// enable more verbose output for debugging
39+
// comment out if not needed
40+
SimpleFOCDebug::enable(&Serial);
41+
3642
// initialize encoder sensor hardware
3743
encoder.init();
3844
encoder.enableInterrupts(doA, doB, doI);
@@ -75,8 +81,6 @@ void setup() {
7581
motor.velocity_limit = 4;
7682

7783

78-
// use monitoring with serial
79-
Serial.begin(115200);
8084
// comment out if not needed
8185
motor.useMonitoring(Serial);
8286

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3636

3737
void setup() {
3838

39+
// use monitoring with serial
40+
Serial.begin(115200);
41+
// enable more verbose output for debugging
42+
// comment out if not needed
43+
SimpleFOCDebug::enable(&Serial);
44+
3945
// initialise magnetic sensor hardware
4046
sensor.init();
4147
// link the motor to the sensor
@@ -72,8 +78,6 @@ void setup() {
7278
// maximal velocity of the position control
7379
motor.velocity_limit = 40;
7480

75-
// use monitoring with serial
76-
Serial.begin(115200);
7781
// comment out if not needed
7882
motor.useMonitoring(Serial);
7983

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
4343

4444
void setup() {
4545

46+
// use monitoring with serial
47+
Serial.begin(115200);
48+
// enable more verbose output for debugging
49+
// comment out if not needed
50+
SimpleFOCDebug::enable(&Serial);
51+
4652
// initialize encoder sensor hardware
4753
encoder.init();
4854
encoder.enableInterrupts(doA, doB);
@@ -90,9 +96,6 @@ void setup() {
9096
// angle loop velocity limit
9197
motor.velocity_limit = 50;
9298

93-
// use monitoring with serial for motor init
94-
// monitoring port
95-
Serial.begin(115200);
9699
// comment out if not needed
97100
motor.useMonitoring(Serial);
98101

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
4646

4747
void setup() {
4848

49+
// use monitoring with serial
50+
Serial.begin(115200);
51+
// enable more verbose output for debugging
52+
// comment out if not needed
53+
SimpleFOCDebug::enable(&Serial);
54+
4955
// initialize encoder sensor hardware
5056
encoder.init();
5157
encoder.enableInterrupts(doA, doB);
@@ -91,9 +97,6 @@ void setup() {
9197
// angle loop velocity limit
9298
motor.velocity_limit = 50;
9399

94-
// use monitoring with serial for motor init
95-
// monitoring port
96-
Serial.begin(115200);
97100
// comment out if not needed
98101
motor.useMonitoring(Serial);
99102

examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5151

5252
void setup() {
5353

54+
// use monitoring with serial
55+
Serial.begin(115200);
56+
// enable more verbose output for debugging
57+
// comment out if not needed
58+
SimpleFOCDebug::enable(&Serial);
59+
5460
// initialize encoder sensor hardware
5561
encoder.init();
5662
encoder.enableInterrupts(doA, doB);
@@ -115,10 +121,6 @@ void setup() {
115121
motor.voltage_limit = 12.0; // 12 Volt limit
116122
motor.current_limit = 2.0; // 2 Amp current limit
117123

118-
119-
// use monitoring with serial for motor init
120-
// monitoring port
121-
Serial.begin(115200);
122124
// comment out if not needed
123125
motor.useMonitoring(Serial);
124126
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5151

5252
void setup() {
5353

54+
// use monitoring with serial
55+
Serial.begin(115200);
56+
// enable more verbose output for debugging
57+
// comment out if not needed
58+
SimpleFOCDebug::enable(&Serial);
59+
5460
// initialize encoder sensor hardware
5561
encoder.init();
5662
encoder.enableInterrupts(doA, doB);
@@ -115,10 +121,6 @@ void setup() {
115121
motor.voltage_limit = 12.0; // 12 Volt limit
116122
motor.current_limit = 2.0; // 2 Amp current limit
117123

118-
119-
// use monitoring with serial for motor init
120-
// monitoring port
121-
Serial.begin(115200);
122124
// comment out if not needed
123125
motor.useMonitoring(Serial);
124126
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5454

5555
void setup() {
5656

57+
// use monitoring with serial
58+
Serial.begin(115200);
59+
// enable more verbose output for debugging
60+
// comment out if not needed
61+
SimpleFOCDebug::enable(&Serial);
62+
5763
// initialize encoder sensor hardware
5864
encoder.init();
5965
encoder.enableInterrupts(doA, doB);
@@ -116,10 +122,6 @@ void setup() {
116122
motor.voltage_limit = 12.0; // 12 Volt limit
117123
motor.current_limit = 2.0; // 2 Amp current limit
118124

119-
120-
// use monitoring with serial for motor init
121-
// monitoring port
122-
Serial.begin(115200);
123125
// comment out if not needed
124126
motor.useMonitoring(Serial);
125127
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
2424

2525
void setup() {
2626

27+
// use monitoring with serial
28+
Serial.begin(115200);
29+
// enable more verbose output for debugging
30+
// comment out if not needed
31+
SimpleFOCDebug::enable(&Serial);
32+
2733
// initialize encoder sensor hardware
2834
encoder.init();
2935
encoder.enableInterrupts(doA, doB);
@@ -66,9 +72,6 @@ void setup() {
6672
// maximal velocity of the position control
6773
motor.velocity_limit = 4;
6874

69-
70-
// use monitoring with serial
71-
Serial.begin(115200);
7275
// comment out if not needed
7376
motor.useMonitoring(Serial);
7477

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3333

3434
void setup() {
3535

36+
// use monitoring with serial
37+
Serial.begin(115200);
38+
// enable more verbose output for debugging
39+
// comment out if not needed
40+
SimpleFOCDebug::enable(&Serial);
41+
3642
// initialise magnetic sensor hardware
3743
sensor.init();
3844
// link the motor to the sensor
@@ -69,8 +75,6 @@ void setup() {
6975
// maximal velocity of the position control
7076
motor.velocity_limit = 40;
7177

72-
// use monitoring with serial
73-
Serial.begin(115200);
7478
// comment out if not needed
7579
motor.useMonitoring(Serial);
7680

0 commit comments

Comments
 (0)