Skip to content

Commit 53927d8

Browse files
committed
Merge branch 'dev' into feat_stepper_current_sensing
2 parents c05289a + 538e59d commit 53927d8

File tree

91 files changed

+3055
-1947
lines changed

Some content is hidden

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

91 files changed

+3055
-1947
lines changed

.github/workflows/esp32.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- esp32:esp32:esp32doit-devkit-v1 # esp32
2020
- esp32:esp32:esp32s2 # esp32s2
2121
- esp32:esp32:esp32s3 # esp32s3
22+
- esp32:esp32:esp32c3 # esp32c3
2223

2324
include:
2425

@@ -30,6 +31,10 @@ jobs:
3031
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
3132
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino
3233

34+
- arduino-boards-fqbn: esp32:esp32:esp32c3 # esp32c3
35+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
36+
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, stepper_driver_2pwm_standalone.ino, stepper_driver_4pwm_standalone.ino
37+
3338
- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
3439
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
3540
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, esp32_current_control_low_side.ino, esp32_spi_alt_example.ino

examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// Motor instance
88
BLDCMotor motor = BLDCMotor(11);
99
BLDCDriver6PWM driver = BLDCDriver6PWM(A_PHASE_UH, A_PHASE_UL, A_PHASE_VH, A_PHASE_VL, A_PHASE_WH, A_PHASE_WL);
10+
// Gain calculation shown at https://community.simplefoc.com/t/b-g431b-esc1-current-control/521/21
1011
LowsideCurrentSense currentSense = LowsideCurrentSense(0.003f, -64.0f/7.0f, A_OP1_OUT, A_OP2_OUT, A_OP3_OUT);
1112

1213

@@ -25,6 +26,12 @@ void doTarget(char* cmd) { command.motion(&motor, cmd); }
2526

2627
void setup() {
2728

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+
2835
// initialize encoder sensor hardware
2936
encoder.init();
3037
encoder.enableInterrupts(doA, doB);
@@ -75,9 +82,6 @@ void setup() {
7582
// maximal velocity of the position control
7683
motor.velocity_limit = 4;
7784

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

@@ -107,4 +111,4 @@ void loop() {
107111

108112
// user communication
109113
command.run();
110-
}
114+
}

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

0 commit comments

Comments
 (0)