diff --git a/README.md b/README.md index 9bb5a80bb..485459aa2 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Therefore this is an attempt to: > - BG341 low-side current sense sync was lost in v2.3.5 - fixed [#482](https://github.com/simplefoc/Arduino-FOC/pull/482) > - ESP32 > - Many ESP32 safety optimisations by [@uLipe](https://github.com/uLipe): [#490](https://github.com/simplefoc/Arduino-FOC/pull/490),[#491](https://github.com/simplefoc/Arduino-FOC/pull/491),[#492](https://github.com/simplefoc/Arduino-FOC/pull/492),[#493](https://github.com/simplefoc/Arduino-FOC/pull/493),[#495](https://github.com/simplefoc/Arduino-FOC/pull/495) -> - Better ADC-Timer alignement for more stable current sensing [See this commit](https://github.com/simplefoc/Arduino-FOC/commit/877699b4db4e6e3ecc16b16cc4337af928e746f4) +> - Better ADC-Timer alignment for more stable current sensing [See this commit](https://github.com/simplefoc/Arduino-FOC/commit/877699b4db4e6e3ecc16b16cc4337af928e746f4) > - Now compiles for all v3.x arduino-esp32 versions (v2.3.5 was compatible with v3.2.x) > - `adcRead` small refactor - no more magic numbers > - Others @@ -101,7 +101,7 @@ This video is a bit outdated but it demonstrates the *Simple**FOC**library* basi - Built-in communication and monitoring via Serial, I2C, or custom protocols - **Cross-platform**: - Seamless code transfer from one microcontroller family to another - - Supports multiple [MCU architectures](https://docs.simplefoc.commicrocontrollers): + - Supports multiple [MCU architectures](https://docs.simplefoc.com/microcontrollers): - Arduino: UNO R4, UNO, MEGA, DUE, Leonardo, Nano, Nano33, MKR .... - STM32 (Nucleo, Bluepill, B-G431B-ESC1, H7 family, etc.) - ESP32 (ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6) diff --git a/examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino b/examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino index f1eeefd2a..1caef0418 100644 --- a/examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino +++ b/examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino @@ -14,7 +14,7 @@ LowsideCurrentSense currentSense = LowsideCurrentSense(0.003f, -64.0f/7.0f, A_OP // encoder instance Encoder encoder = Encoder(A_HALL2, A_HALL3, 2048, A_HALL1); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -62,7 +62,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::velocity; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino b/examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino index b29e45d84..81bfcf324 100644 --- a/examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino +++ b/examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino @@ -17,7 +17,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(PB6, PB7, PB8, PB5); // encoder instance Encoder encoder = Encoder(PA8, PA9, 8192, PA10); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -60,7 +60,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::velocity; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino b/examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino index caef7ffec..a0984685a 100644 --- a/examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino +++ b/examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino @@ -60,7 +60,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino b/examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino index 3d90db166..f0e1fe602 100644 --- a/examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino +++ b/examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino @@ -31,7 +31,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(INH_A, INH_B, INH_C, EN_GATE); // encoder instance Encoder encoder = Encoder(2, 3, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -82,7 +82,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.2f; motor.PID_velocity.I = 20; // default voltage_power_supply @@ -104,7 +104,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // define the motor id @@ -125,7 +125,7 @@ void loop() { // iterative function setting the outter loop target // velocity, position or voltage - // if tatget not set in parameter uses motor.target variable + // if target not set in parameter uses motor.target variable motor.move(); // user communication diff --git a/examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino b/examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino index af56e0673..8f7b95964 100644 --- a/examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino +++ b/examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino @@ -34,7 +34,7 @@ BLDCDriver6PWM driver = BLDCDriver6PWM(INH_A,INL_A, INH_B,INL_B, INH_C,INL_C, EN // encoder instance Encoder encoder = Encoder(2, 3, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -83,7 +83,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.2f; motor.PID_velocity.I = 20; // default voltage_power_supply @@ -105,7 +105,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // define the motor id @@ -124,7 +124,7 @@ void loop() { // iterative function setting the outter loop target // velocity, position or voltage - // if tatget not set in parameter uses motor.target variable + // if target not set in parameter uses motor.target variable motor.move(); // user communication diff --git a/examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino b/examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino index f00d9fe59..96c79645d 100644 --- a/examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino +++ b/examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino @@ -39,7 +39,7 @@ LowsideCurrentSense cs = LowsideCurrentSense(0.005f, 12.22f, IOUTA, IOUTB, IOUTC // encoder instance Encoder encoder = Encoder(22, 23, 500); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -137,7 +137,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 0; // define the motor id diff --git a/examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino b/examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino index c598f3513..ddec0c63a 100644 --- a/examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino +++ b/examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino @@ -39,7 +39,7 @@ LowsideCurrentSense cs = LowsideCurrentSense(0.005f, 12.22f, IOUTA, IOUTB, IOUTC // encoder instance Encoder encoder = Encoder(PB14, PB15, 2048); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -137,7 +137,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 0; // define the motor id diff --git a/examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino b/examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino index 7f08b6b44..9bffa5d39 100644 --- a/examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino +++ b/examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino @@ -42,7 +42,7 @@ LowsideCurrentSense cs = LowsideCurrentSense(0.005f, 12.22f, IOUTA, IOUTB); // encoder instance Encoder encoder = Encoder(10, 11, 2048); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -138,7 +138,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 0; // define the motor id diff --git a/examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino b/examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino index 7f6b33cec..e27754902 100644 --- a/examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino +++ b/examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino @@ -11,7 +11,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(25, 26, 27, 7); // encoder instance Encoder encoder = Encoder(4, 2, 1024); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -52,7 +52,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::velocity; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino b/examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino index 9ba9604ae..342b40a32 100644 --- a/examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino +++ b/examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino @@ -57,7 +57,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino b/examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino index d91076549..5ec613a23 100644 --- a/examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino +++ b/examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino @@ -24,7 +24,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11); // encoder instance Encoder encoder = Encoder(A0, A1, 2048); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -68,7 +68,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/HMBGC_example/voltage_control/voltage_control.ino b/examples/hardware_specific_examples/HMBGC_example/voltage_control/voltage_control.ino index 9c9655f94..e442e6e1b 100644 --- a/examples/hardware_specific_examples/HMBGC_example/voltage_control/voltage_control.ino +++ b/examples/hardware_specific_examples/HMBGC_example/voltage_control/voltage_control.ino @@ -30,7 +30,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11); // encoder instance Encoder encoder = Encoder(A0, A1, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} diff --git a/examples/hardware_specific_examples/Odrive_examples/odrive_example_encoder/odrive_example_encoder.ino b/examples/hardware_specific_examples/Odrive_examples/odrive_example_encoder/odrive_example_encoder.ino index 504ab9c87..3bd1449b3 100644 --- a/examples/hardware_specific_examples/Odrive_examples/odrive_example_encoder/odrive_example_encoder.ino +++ b/examples/hardware_specific_examples/Odrive_examples/odrive_example_encoder/odrive_example_encoder.ino @@ -15,7 +15,7 @@ #define M0_INL_A PB13 #define M0_INL_B PB14 #define M0_INL_C PB15 -// M0 currnets +// M0 currents #define M0_IB PC0 #define M0_IC PC1 // Odrive M0 encoder pinout @@ -31,7 +31,7 @@ #define M1_INL_A PA7 #define M1_INL_B PB0 #define M1_INL_C PB1 -// M0 currnets +// M0 currents #define M1_IB PC2 #define M1_IC PC3 // Odrive M1 encoder pinout @@ -62,7 +62,7 @@ void doMotor(char* cmd) { command.motor(&motor, cmd); } LowsideCurrentSense current_sense = LowsideCurrentSense(0.0005f, 10.0f, _NC, M0_IB, M0_IC); Encoder encoder = Encoder(M0_ENC_A, M0_ENC_B, 500,M0_ENC_Z); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} diff --git a/examples/hardware_specific_examples/Odrive_examples/odrive_example_spi/odrive_example_spi.ino b/examples/hardware_specific_examples/Odrive_examples/odrive_example_spi/odrive_example_spi.ino index 7abcde54e..ccc577986 100644 --- a/examples/hardware_specific_examples/Odrive_examples/odrive_example_spi/odrive_example_spi.ino +++ b/examples/hardware_specific_examples/Odrive_examples/odrive_example_spi/odrive_example_spi.ino @@ -15,7 +15,7 @@ #define M0_INL_A PB13 #define M0_INL_B PB14 #define M0_INL_C PB15 -// M0 currnets +// M0 currents #define M0_IB PC0 #define M0_IC PC1 // Odrive M0 encoder pinout @@ -31,7 +31,7 @@ #define M1_INL_A PA7 #define M1_INL_B PB0 #define M1_INL_C PB1 -// M0 currnets +// M0 currents #define M1_IB PC2 #define M1_IC PC3 // Odrive M1 encoder pinout diff --git a/examples/hardware_specific_examples/SAMD_examples/README.md b/examples/hardware_specific_examples/SAMD_examples/README.md index d1a52584e..3617e39a9 100644 --- a/examples/hardware_specific_examples/SAMD_examples/README.md +++ b/examples/hardware_specific_examples/SAMD_examples/README.md @@ -41,7 +41,7 @@ Note: in all of the above note that you *cannot* set the timers or WOs used - th So it is matter of choosing the right pins, nothing else. Note also: Unfortunately you can't set the PWM frequency. It is currently fixed at 24KHz. This is a tradeoff between limiting PWM resolution vs -increasing frequency, and also due to keeping the pin assignemts flexible, which would not be possible if we ran the timers at different rates. +increasing frequency, and also due to keeping the pin assignments flexible, which would not be possible if we ran the timers at different rates. ## Status diff --git a/examples/hardware_specific_examples/SimpleFOC-PowerShield/version_v02/single_full_control_example/single_full_control_example.ino b/examples/hardware_specific_examples/SimpleFOC-PowerShield/version_v02/single_full_control_example/single_full_control_example.ino index bc3874373..6893a5289 100644 --- a/examples/hardware_specific_examples/SimpleFOC-PowerShield/version_v02/single_full_control_example/single_full_control_example.ino +++ b/examples/hardware_specific_examples/SimpleFOC-PowerShield/version_v02/single_full_control_example/single_full_control_example.ino @@ -47,7 +47,7 @@ void setup() { motor.torque_controller = TorqueControlType::foc_current; motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.05f; motor.PID_velocity.I = 1; motor.PID_velocity.D = 0; @@ -64,7 +64,7 @@ void setup() { // comment out if not needed motor.useMonitoring(Serial); - motor.monitor_downsample = 0; // disable intially + motor.monitor_downsample = 0; // disable initially motor.monitor_variables = _MON_TARGET | _MON_VEL | _MON_ANGLE; // monitor target velocity and angle // current sense init and linking @@ -76,7 +76,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 0; // subscribe motor to the commander diff --git a/examples/hardware_specific_examples/SimpleFOCMini/angle_control/angle_control.ino b/examples/hardware_specific_examples/SimpleFOCMini/angle_control/angle_control.ino index 8eb122a0e..70334044c 100644 --- a/examples/hardware_specific_examples/SimpleFOCMini/angle_control/angle_control.ino +++ b/examples/hardware_specific_examples/SimpleFOCMini/angle_control/angle_control.ino @@ -28,7 +28,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(11, 10, 9, 8); // encoder instance Encoder encoder = Encoder(2, 3, 500); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -69,7 +69,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/hardware_specific_examples/SimpleFOCShield/version_v1/double_full_control_example/double_full_control_example.ino b/examples/hardware_specific_examples/SimpleFOCShield/version_v1/double_full_control_example/double_full_control_example.ino index fb5e15638..92c8f3a6a 100644 --- a/examples/hardware_specific_examples/SimpleFOCShield/version_v1/double_full_control_example/double_full_control_example.ino +++ b/examples/hardware_specific_examples/SimpleFOCShield/version_v1/double_full_control_example/double_full_control_example.ino @@ -61,13 +61,13 @@ void setup() { motor1.controller = MotionControlType::torque; motor2.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor1.PID_velocity.P = 0.05f; motor1.PID_velocity.I = 1; motor1.PID_velocity.D = 0; // default voltage_power_supply motor1.voltage_limit = 12; - // contoller configuration based on the controll type + // controller configuration based on the control type motor2.PID_velocity.P = 0.05f; motor2.PID_velocity.I = 1; motor2.PID_velocity.D = 0; @@ -92,7 +92,7 @@ void setup() { // align encoder and start FOC motor2.initFOC(); - // set the inital target value + // set the initial target value motor1.target = 2; motor2.target = 2; diff --git a/examples/hardware_specific_examples/SimpleFOCShield/version_v1/single_full_control_example/single_full_control_example.ino b/examples/hardware_specific_examples/SimpleFOCShield/version_v1/single_full_control_example/single_full_control_example.ino index 3faa38b2a..7addaf218 100644 --- a/examples/hardware_specific_examples/SimpleFOCShield/version_v1/single_full_control_example/single_full_control_example.ino +++ b/examples/hardware_specific_examples/SimpleFOCShield/version_v1/single_full_control_example/single_full_control_example.ino @@ -39,7 +39,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.05f; motor.PID_velocity.I = 1; motor.PID_velocity.D = 0; @@ -56,7 +56,7 @@ void setup() { // comment out if not needed motor.useMonitoring(Serial); - motor.monitor_downsample = 0; // disable intially + motor.monitor_downsample = 0; // disable initially motor.monitor_variables = _MON_TARGET | _MON_VEL | _MON_ANGLE; // monitor target velocity and angle // initialise motor @@ -64,7 +64,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // subscribe motor to the commander diff --git a/examples/hardware_specific_examples/SimpleFOCShield/version_v2/double_full_control_example/double_full_control_example.ino b/examples/hardware_specific_examples/SimpleFOCShield/version_v2/double_full_control_example/double_full_control_example.ino index 8eb3a86d2..4982f0d47 100644 --- a/examples/hardware_specific_examples/SimpleFOCShield/version_v2/double_full_control_example/double_full_control_example.ino +++ b/examples/hardware_specific_examples/SimpleFOCShield/version_v2/double_full_control_example/double_full_control_example.ino @@ -77,13 +77,13 @@ void setup() { motor1.controller = MotionControlType::torque; motor2.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor1.PID_velocity.P = 0.05f; motor1.PID_velocity.I = 1; motor1.PID_velocity.D = 0; // default voltage_power_supply motor1.voltage_limit = 12; - // contoller configuration based on the controll type + // controller configuration based on the control type motor2.PID_velocity.P = 0.05f; motor2.PID_velocity.I = 1; motor2.PID_velocity.D = 0; @@ -116,7 +116,7 @@ void setup() { // align encoder and start FOC motor2.initFOC(); - // set the inital target value + // set the initial target value motor1.target = 2; motor2.target = 2; diff --git a/examples/hardware_specific_examples/SimpleFOCShield/version_v2/single_full_control_example/single_full_control_example.ino b/examples/hardware_specific_examples/SimpleFOCShield/version_v2/single_full_control_example/single_full_control_example.ino index b65a9cb07..5fc5f3dd8 100644 --- a/examples/hardware_specific_examples/SimpleFOCShield/version_v2/single_full_control_example/single_full_control_example.ino +++ b/examples/hardware_specific_examples/SimpleFOCShield/version_v2/single_full_control_example/single_full_control_example.ino @@ -46,7 +46,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.05f; motor.PID_velocity.I = 1; motor.PID_velocity.D = 0; @@ -63,7 +63,7 @@ void setup() { // comment out if not needed motor.useMonitoring(Serial); - motor.monitor_downsample = 0; // disable intially + motor.monitor_downsample = 0; // disable initially motor.monitor_variables = _MON_TARGET | _MON_VEL | _MON_ANGLE; // monitor target velocity and angle // current sense init and linking @@ -75,7 +75,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // subscribe motor to the commander diff --git a/examples/hardware_specific_examples/SimpleFOCShield/version_v3/single_full_control_example/single_full_control_example.ino b/examples/hardware_specific_examples/SimpleFOCShield/version_v3/single_full_control_example/single_full_control_example.ino index 6359f201a..5de4ce928 100644 --- a/examples/hardware_specific_examples/SimpleFOCShield/version_v3/single_full_control_example/single_full_control_example.ino +++ b/examples/hardware_specific_examples/SimpleFOCShield/version_v3/single_full_control_example/single_full_control_example.ino @@ -63,7 +63,7 @@ void setup() { // comment out if not needed motor.useMonitoring(Serial); - motor.monitor_downsample = 0; // disable intially + motor.monitor_downsample = 0; // disable initially motor.monitor_variables = _MON_TARGET | _MON_VEL | _MON_ANGLE; // monitor target velocity and angle // current sense init and linking @@ -75,7 +75,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // subscribe motor to the commander diff --git a/examples/hardware_specific_examples/Teensy/Teensy3/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino b/examples/hardware_specific_examples/Teensy/Teensy3/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino index 646513929..e09f53d22 100644 --- a/examples/hardware_specific_examples/Teensy/Teensy3/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino +++ b/examples/hardware_specific_examples/Teensy/Teensy3/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino @@ -38,7 +38,7 @@ void setup() { // limiting motor movements // limit the voltage to be set to the motor // start very low for high resistance motors - // currnet = voltage/resistance, so try to be well under 1Amp + // current = voltage/resistance, so try to be well under 1Amp motor.voltage_limit = 3; // [V] // open loop control config diff --git a/examples/hardware_specific_examples/Teensy/Teensy4/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino b/examples/hardware_specific_examples/Teensy/Teensy4/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino index c46270207..8cba40f5c 100644 --- a/examples/hardware_specific_examples/Teensy/Teensy4/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino +++ b/examples/hardware_specific_examples/Teensy/Teensy4/open_loop_velocity_6pwm/open_loop_velocity_6pwm.ino @@ -53,7 +53,7 @@ void setup() { // limiting motor movements // limit the voltage to be set to the motor // start very low for high resistance motors - // currnet = voltage/resistance, so try to be well under 1Amp + // current = voltage/resistance, so try to be well under 1Amp motor.voltage_limit = 3; // [V] // open loop control config diff --git a/examples/motion_control/custom_motion_control/custom_motion_control.ino b/examples/motion_control/custom_motion_control/custom_motion_control.ino index bf1ed5d52..98c02cdba 100644 --- a/examples/motion_control/custom_motion_control/custom_motion_control.ino +++ b/examples/motion_control/custom_motion_control/custom_motion_control.ino @@ -64,11 +64,11 @@ void setup() { // comment out if not needed motor.useMonitoring(Serial); - motor.monitor_downsample = 0; // disable intially + motor.monitor_downsample = 0; // disable initially motor.monitor_variables = _MON_TARGET | _MON_VEL | _MON_ANGLE; // monitor target velocity and angle // subscribe motor to the commander - //command.add('T', doMotion, "motion control"); // a bit less resouce intensive + //command.add('T', doMotion, "motion control"); // a bit less resource intensive command.add('M', doMotor, "motor"); command.add('C', doPID, "custom PID"); diff --git a/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino b/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino index d564f47ec..8d5cb1bdc 100644 --- a/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino +++ b/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino @@ -46,7 +46,7 @@ void setup() { // limiting motor movements // limit the voltage to be set to the motor // start very low for high resistance motors - // currnet = voltage/resistance, so try to be well under 1Amp + // current = voltage/resistance, so try to be well under 1Amp motor.voltage_limit = 3; // [V] // limit/set the velocity of the transition in between // target angles diff --git a/examples/motion_control/position_motion_control/encoder/angle_control/angle_control.ino b/examples/motion_control/position_motion_control/encoder/angle_control/angle_control.ino index 03e6ea75f..8a707e442 100644 --- a/examples/motion_control/position_motion_control/encoder/angle_control/angle_control.ino +++ b/examples/motion_control/position_motion_control/encoder/angle_control/angle_control.ino @@ -35,7 +35,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // encoder instance Encoder encoder = Encoder(2, 3, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -73,7 +73,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/motion_control/position_motion_control/hall_sensor/angle_control/angle_control.ino b/examples/motion_control/position_motion_control/hall_sensor/angle_control/angle_control.ino index 4bd7163f4..5a2ddaa68 100644 --- a/examples/motion_control/position_motion_control/hall_sensor/angle_control/angle_control.ino +++ b/examples/motion_control/position_motion_control/hall_sensor/angle_control/angle_control.ino @@ -31,12 +31,12 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // hall sensor instance HallSensor sensor = HallSensor(2, 3, 4, 11); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} void doC(){sensor.handleC();} -// If no available hadware interrupt pins use the software interrupt +// If no available hardware interrupt pins use the software interrupt PciListenerImp listenC(sensor.pinC, doC); // angle set point variable @@ -71,7 +71,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/motion_control/position_motion_control/magnetic_sensor/angle_control/angle_control.ino b/examples/motion_control/position_motion_control/magnetic_sensor/angle_control/angle_control.ino index f0f9b27c2..e91bc6efb 100644 --- a/examples/motion_control/position_motion_control/magnetic_sensor/angle_control/angle_control.ino +++ b/examples/motion_control/position_motion_control/magnetic_sensor/angle_control/angle_control.ino @@ -55,7 +55,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/motion_control/torque_control/encoder/current_control/current_control.ino b/examples/motion_control/torque_control/encoder/current_control/current_control.ino index 82aec86a3..b8cc4a9ab 100644 --- a/examples/motion_control/torque_control/encoder/current_control/current_control.ino +++ b/examples/motion_control/torque_control/encoder/current_control/current_control.ino @@ -61,14 +61,14 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::torque; - // foc currnet control parameters (Arduino UNO/Mega) + // foc current control parameters (Arduino UNO/Mega) motor.PID_current_q.P = 5; motor.PID_current_q.I= 300; motor.PID_current_d.P= 5; motor.PID_current_d.I = 300; motor.LPF_current_q.Tf = 0.01f; motor.LPF_current_d.Tf = 0.01f; - // foc currnet control parameters (stm/esp/due/teensy) + // foc current control parameters (stm/esp/due/teensy) // motor.PID_current_q.P = 5; // motor.PID_current_q.I= 1000; // motor.PID_current_d.P= 5; diff --git a/examples/motion_control/torque_control/encoder/voltage_control/voltage_control.ino b/examples/motion_control/torque_control/encoder/voltage_control/voltage_control.ino index 219637c92..c2723dba5 100644 --- a/examples/motion_control/torque_control/encoder/voltage_control/voltage_control.ino +++ b/examples/motion_control/torque_control/encoder/voltage_control/voltage_control.ino @@ -20,7 +20,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // encoder instance Encoder encoder = Encoder(2, 3, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} diff --git a/examples/motion_control/torque_control/hall_sensor/voltage_control/voltage_control.ino b/examples/motion_control/torque_control/hall_sensor/voltage_control/voltage_control.ino index c72c9224a..78e8a690d 100644 --- a/examples/motion_control/torque_control/hall_sensor/voltage_control/voltage_control.ino +++ b/examples/motion_control/torque_control/hall_sensor/voltage_control/voltage_control.ino @@ -20,7 +20,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // hall sensor instance HallSensor sensor = HallSensor(2, 3, 4, 11); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} diff --git a/examples/motion_control/velocity_motion_control/encoder/velocity_control/velocity_control.ino b/examples/motion_control/velocity_motion_control/encoder/velocity_control/velocity_control.ino index f0f1e3e8e..6cc4e7f07 100644 --- a/examples/motion_control/velocity_motion_control/encoder/velocity_control/velocity_control.ino +++ b/examples/motion_control/velocity_motion_control/encoder/velocity_control/velocity_control.ino @@ -39,12 +39,12 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // encoder instance Encoder encoder = Encoder(2, 3, 8192, A0); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} void doIndex(){encoder.handleIndex();} -// If no available hadware interrupt pins use the software interrupt +// If no available hardware interrupt pins use the software interrupt PciListenerImp listenerIndex(encoder.index_pin, doIndex); @@ -80,7 +80,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::velocity; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/motion_control/velocity_motion_control/hall_sensor/velocity_control/velocity_control.ino b/examples/motion_control/velocity_motion_control/hall_sensor/velocity_control/velocity_control.ino index 4fb47f028..d1f0d2b07 100644 --- a/examples/motion_control/velocity_motion_control/hall_sensor/velocity_control/velocity_control.ino +++ b/examples/motion_control/velocity_motion_control/hall_sensor/velocity_control/velocity_control.ino @@ -31,12 +31,12 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // hall sensor instance HallSensor sensor = HallSensor(2, 3, 4, 11); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} void doC(){sensor.handleC();} -// If no available hadware interrupt pins use the software interrupt +// If no available hardware interrupt pins use the software interrupt PciListenerImp listenerIndex(sensor.pinC, doC); // velocity set point variable @@ -74,7 +74,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::velocity; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/motion_control/velocity_motion_control/magnetic_sensor/velocity_control/velocity_control.ino b/examples/motion_control/velocity_motion_control/magnetic_sensor/velocity_control/velocity_control.ino index 40299b8f0..cbab7f3de 100644 --- a/examples/motion_control/velocity_motion_control/magnetic_sensor/velocity_control/velocity_control.ino +++ b/examples/motion_control/velocity_motion_control/magnetic_sensor/velocity_control/velocity_control.ino @@ -54,7 +54,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::velocity; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters diff --git a/examples/motor_commands_serial_examples/encoder/full_control_serial/full_control_serial.ino b/examples/motor_commands_serial_examples/encoder/full_control_serial/full_control_serial.ino index d6ddc6b4c..a24c82eb0 100644 --- a/examples/motor_commands_serial_examples/encoder/full_control_serial/full_control_serial.ino +++ b/examples/motor_commands_serial_examples/encoder/full_control_serial/full_control_serial.ino @@ -22,7 +22,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // encoder instance Encoder encoder = Encoder(2, 3, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -59,7 +59,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.2f; motor.PID_velocity.I = 20; motor.PID_velocity.D = 0; @@ -82,7 +82,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // define the motor id @@ -101,7 +101,7 @@ void loop() { // iterative function setting the outter loop target // velocity, position or voltage - // if tatget not set in parameter uses motor.target variable + // if target not set in parameter uses motor.target variable motor.move(); // user communication diff --git a/examples/motor_commands_serial_examples/hall_sensor/full_control_serial/full_control_serial.ino b/examples/motor_commands_serial_examples/hall_sensor/full_control_serial/full_control_serial.ino index ff6fe7f31..6c0c84bbf 100644 --- a/examples/motor_commands_serial_examples/hall_sensor/full_control_serial/full_control_serial.ino +++ b/examples/motor_commands_serial_examples/hall_sensor/full_control_serial/full_control_serial.ino @@ -25,12 +25,12 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // hall sensor instance HallSensor sensor = HallSensor(2, 3, 4, 11); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A, B and C callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} void doC(){sensor.handleC();} -// If no available hadware interrupt pins use the software interrupt +// If no available hardware interrupt pins use the software interrupt PciListenerImp listenC(sensor.pinC, doC); @@ -67,7 +67,7 @@ void setup() { motor.foc_modulation = FOCModulationType::SpaceVectorPWM; // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the controll type + // controller configuration based on the control type motor.PID_velocity.P = 0.2f; motor.PID_velocity.I = 20; motor.PID_velocity.D = 0; @@ -90,7 +90,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // define the motor id @@ -109,7 +109,7 @@ void loop() { // iterative function setting the outter loop target // velocity, position or voltage - // if tatget not set in parameter uses motor.target variable + // if target not set in parameter uses motor.target variable motor.move(); // user communication diff --git a/examples/motor_commands_serial_examples/magnetic_sensor/full_control_serial/full_control_serial.ino b/examples/motor_commands_serial_examples/magnetic_sensor/full_control_serial/full_control_serial.ino index e863d8c9d..52b59a066 100644 --- a/examples/motor_commands_serial_examples/magnetic_sensor/full_control_serial/full_control_serial.ino +++ b/examples/motor_commands_serial_examples/magnetic_sensor/full_control_serial/full_control_serial.ino @@ -57,7 +57,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the control type + // controller configuration based on the control type motor.PID_velocity.P = 0.2f; motor.PID_velocity.I = 20; motor.PID_velocity.D = 0; @@ -80,7 +80,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // define the motor id @@ -99,7 +99,7 @@ void loop() { // iterative function setting the outter loop target // velocity, position or voltage - // if tatget not set in parameter uses motor.target variable + // if target not set in parameter uses motor.target variable motor.move(); // user communication diff --git a/examples/osc_control_examples/README.md b/examples/osc_control_examples/README.md index bd6f77668..e6c2396fc 100644 --- a/examples/osc_control_examples/README.md +++ b/examples/osc_control_examples/README.md @@ -5,7 +5,7 @@ OSC - opensoundcontrol.org is a simple message exchange protocol. Widely used in As a protocol it is simple, making implementation quite easy, and while binary, simple enough to be fairly "human readable", which aids in debugging and reduces errors. -The main advantage of using it is that there is a bunch of ready made software, and also libraries to use in your own programs, neaning you don't have to re-invent these things from scratch. +The main advantage of using it is that there is a bunch of ready made software, and also libraries to use in your own programs, meaning you don't have to re-invent these things from scratch. ## TouchOSC diff --git a/examples/osc_control_examples/osc_esp32_fullcontrol/osc_esp32_fullcontrol.ino b/examples/osc_control_examples/osc_esp32_fullcontrol/osc_esp32_fullcontrol.ino index 940b59c26..4a02b875f 100644 --- a/examples/osc_control_examples/osc_esp32_fullcontrol/osc_esp32_fullcontrol.ino +++ b/examples/osc_control_examples/osc_esp32_fullcontrol/osc_esp32_fullcontrol.ino @@ -45,7 +45,7 @@ String m1Prefix("/M1"); String m2Prefix("/M2"); -// we store seperate set-points for each motor, of course +// we store separate set-points for each motor, of course float set_point1 = 0.0f; float set_point2 = 0.0f; diff --git a/examples/utils/calibration/find_kv_rating/encoder/find_kv_rating/find_kv_rating.ino b/examples/utils/calibration/find_kv_rating/encoder/find_kv_rating/find_kv_rating.ino index c39657b1e..53ef4c901 100644 --- a/examples/utils/calibration/find_kv_rating/encoder/find_kv_rating/find_kv_rating.ino +++ b/examples/utils/calibration/find_kv_rating/encoder/find_kv_rating/find_kv_rating.ino @@ -22,7 +22,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // encoder instance Encoder sensor = Encoder(2, 3, 8192); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} diff --git a/examples/utils/calibration/find_kv_rating/hall_sensor/find_kv_rating/find_kv_rating.ino b/examples/utils/calibration/find_kv_rating/hall_sensor/find_kv_rating/find_kv_rating.ino index 4eadd376b..88fa8b881 100644 --- a/examples/utils/calibration/find_kv_rating/hall_sensor/find_kv_rating/find_kv_rating.ino +++ b/examples/utils/calibration/find_kv_rating/hall_sensor/find_kv_rating/find_kv_rating.ino @@ -18,7 +18,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // hall sensor instance HallSensor sensor = HallSensor(2, 3, 4, 11); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} diff --git a/examples/utils/calibration/find_pole_pair_number/encoder/find_pole_pairs_number/find_pole_pairs_number.ino b/examples/utils/calibration/find_pole_pair_number/encoder/find_pole_pairs_number/find_pole_pairs_number.ino index ad8e69ce8..7327a8fd6 100644 --- a/examples/utils/calibration/find_pole_pair_number/encoder/find_pole_pairs_number/find_pole_pairs_number.ino +++ b/examples/utils/calibration/find_pole_pair_number/encoder/find_pole_pairs_number/find_pole_pairs_number.ino @@ -26,7 +26,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8); // Encoder(int encA, int encB , int cpr, int index) Encoder encoder = Encoder(2, 3, 2048); -// interrupt routine intialisation +// interrupt routine initialization void doA(){encoder.handleA();} void doB(){encoder.handleB();} diff --git a/examples/utils/communication_test/step_dir/step_dir_listener_simple/step_dir_listener_simple.ino b/examples/utils/communication_test/step_dir/step_dir_listener_simple/step_dir_listener_simple.ino index a0bebc357..ce16fbf79 100644 --- a/examples/utils/communication_test/step_dir/step_dir_listener_simple/step_dir_listener_simple.ino +++ b/examples/utils/communication_test/step_dir/step_dir_listener_simple/step_dir_listener_simple.ino @@ -21,10 +21,10 @@ void setup() { // enable interrupts step_dir.enableInterrupt(onStep); // attach the variable to be updated on each step (optional) - // the same can be done asynchronously by caling step_dir.getValue(); + // the same can be done asynchronously by calling step_dir.getValue(); step_dir.attach(&received_angle); - Serial.println(F("Step/Dir listenning.")); + Serial.println(F("Step/Dir listening.")); _delay(1000); } diff --git a/examples/utils/communication_test/step_dir/step_dir_listener_software_interrupt/step_dir_listener_software_interrupt.ino b/examples/utils/communication_test/step_dir/step_dir_listener_software_interrupt/step_dir_listener_software_interrupt.ino index b6f0ea5fe..54d627062 100644 --- a/examples/utils/communication_test/step_dir/step_dir_listener_software_interrupt/step_dir_listener_software_interrupt.ino +++ b/examples/utils/communication_test/step_dir/step_dir_listener_software_interrupt/step_dir_listener_software_interrupt.ino @@ -17,7 +17,7 @@ float received_angle = 0; StepDirListener step_dir = StepDirListener(4, 5, 2.0f*_PI/200.0); // receive the angle in radians void onStep() { step_dir.handle(); } -// If no available hadware interrupt pins use the software interrupt +// If no available hardware interrupt pins use the software interrupt PciListenerImp listenStep(step_dir.pin_step, onStep); void setup() { @@ -29,10 +29,10 @@ void setup() { // enable software interrupts PciManager.registerListener(&listenStep); // attach the variable to be updated on each step (optional) - // the same can be done asynchronously by caling step_dir.getValue(); + // the same can be done asynchronously by calling step_dir.getValue(); step_dir.attach(&received_angle); - Serial.println(F("Step/Dir listenning.")); + Serial.println(F("Step/Dir listening.")); _delay(1000); } diff --git a/examples/utils/communication_test/step_dir/step_dir_motor_example/step_dir_motor_example.ino b/examples/utils/communication_test/step_dir/step_dir_motor_example/step_dir_motor_example.ino index 4cd87970d..9b6de9a93 100644 --- a/examples/utils/communication_test/step_dir/step_dir_motor_example/step_dir_motor_example.ino +++ b/examples/utils/communication_test/step_dir/step_dir_motor_example/step_dir_motor_example.ino @@ -51,7 +51,7 @@ void setup() { // set motion control loop to be used motor.controller = MotionControlType::angle; - // contoller configuration + // controller configuration // default parameters in defaults.h // velocity PI controller parameters motor.PID_velocity.P = 0.2f; @@ -84,7 +84,7 @@ void setup() { // enable interrupts step_dir.enableInterrupt(onStep); // attach the variable to be updated on each step (optional) - // the same can be done asynchronously by caling motor.move(step_dir.getValue()); + // the same can be done asynchronously by calling motor.move(step_dir.getValue()); step_dir.attach(&motor.target); Serial.println(F("Motor ready.")); diff --git a/examples/utils/current_sense_test/align_current_sense/align_current_sense.ino b/examples/utils/current_sense_test/align_current_sense/align_current_sense.ino index 3d51215e2..0f217440d 100644 --- a/examples/utils/current_sense_test/align_current_sense/align_current_sense.ino +++ b/examples/utils/current_sense_test/align_current_sense/align_current_sense.ino @@ -105,7 +105,7 @@ void setup() { // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 0.5; diff --git a/examples/utils/current_sense_test/generic_current_sense/generic_current_sense.ino b/examples/utils/current_sense_test/generic_current_sense/generic_current_sense.ino index 2448a51c4..b244ca08d 100644 --- a/examples/utils/current_sense_test/generic_current_sense/generic_current_sense.ino +++ b/examples/utils/current_sense_test/generic_current_sense/generic_current_sense.ino @@ -15,7 +15,7 @@ PhaseCurrent_s readCurrentSense(){ return(c); } -// user defined function for intialising the current sense +// user defined function for initializing the current sense // it is optional and if provided it will be called in current_sense.init() void initCurrentSense(){ pinMode(A0,INPUT); diff --git a/examples/utils/sensor_test/encoder/encoder_example/encoder_example.ino b/examples/utils/sensor_test/encoder/encoder_example/encoder_example.ino index f105f5b00..9ea279cf4 100644 --- a/examples/utils/sensor_test/encoder/encoder_example/encoder_example.ino +++ b/examples/utils/sensor_test/encoder/encoder_example/encoder_example.ino @@ -9,7 +9,7 @@ Encoder encoder = Encoder(2, 3, 8192); -// interrupt routine intialisation +// interrupt routine initialization void doA(){encoder.handleA();} void doB(){encoder.handleB();} diff --git a/examples/utils/sensor_test/encoder/encoder_software_interrupts_example/encoder_software_interrupts_example.ino b/examples/utils/sensor_test/encoder/encoder_software_interrupts_example/encoder_software_interrupts_example.ino index ebf2dd41f..a4b6fab49 100644 --- a/examples/utils/sensor_test/encoder/encoder_software_interrupts_example/encoder_software_interrupts_example.ino +++ b/examples/utils/sensor_test/encoder/encoder_software_interrupts_example/encoder_software_interrupts_example.ino @@ -16,7 +16,7 @@ // encoder instance Encoder encoder = Encoder(A0, A1, 2048); -// interrupt routine intialisation +// interrupt routine initialization void doA(){encoder.handleA();} void doB(){encoder.handleB();} diff --git a/examples/utils/sensor_test/generic_sensor/generic_sensor.ino b/examples/utils/sensor_test/generic_sensor/generic_sensor.ino index 4a470e59a..8a162b147 100644 --- a/examples/utils/sensor_test/generic_sensor/generic_sensor.ino +++ b/examples/utils/sensor_test/generic_sensor/generic_sensor.ino @@ -14,12 +14,12 @@ float readSensor(){ return analogRead(A0)*_2PI/1024.0; } -// sensor intialising function +// sensor initializing function void initSensor(){ pinMode(A0,INPUT); } -// generic sensor class contructor +// generic sensor class constructor // - read sensor callback // - init sensor callback (optional) GenericSensor sensor = GenericSensor(readSensor, initSensor); diff --git a/examples/utils/sensor_test/hall_sensors/hall_sensor_hardware_interrupts_example/hall_sensor_hardware_interrupts_example.ino b/examples/utils/sensor_test/hall_sensors/hall_sensor_hardware_interrupts_example/hall_sensor_hardware_interrupts_example.ino index c4777baa4..ad4472a83 100644 --- a/examples/utils/sensor_test/hall_sensors/hall_sensor_hardware_interrupts_example/hall_sensor_hardware_interrupts_example.ino +++ b/examples/utils/sensor_test/hall_sensors/hall_sensor_hardware_interrupts_example/hall_sensor_hardware_interrupts_example.ino @@ -13,7 +13,7 @@ // - pp - pole pairs HallSensor sensor = HallSensor(2, 3, 4, 14); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} diff --git a/examples/utils/sensor_test/hall_sensors/hall_sensor_software_interrupts_example/hall_sensor_software_interrupts_example.ino b/examples/utils/sensor_test/hall_sensors/hall_sensor_software_interrupts_example/hall_sensor_software_interrupts_example.ino index 238eb2c4f..4fb6ad116 100644 --- a/examples/utils/sensor_test/hall_sensors/hall_sensor_software_interrupts_example/hall_sensor_software_interrupts_example.ino +++ b/examples/utils/sensor_test/hall_sensors/hall_sensor_software_interrupts_example/hall_sensor_software_interrupts_example.ino @@ -19,12 +19,12 @@ // - pp - pole pairs HallSensor sensor = HallSensor(2, 3, 4, 11); -// Interrupt routine intialisation +// Interrupt routine initialization // channel A and B callbacks void doA(){sensor.handleA();} void doB(){sensor.handleB();} void doC(){sensor.handleC();} -// If no available hadware interrupt pins use the software interrupt +// If no available hardware interrupt pins use the software interrupt PciListenerImp listenA(sensor.pinA, doA); PciListenerImp listenB(sensor.pinB, doB); PciListenerImp listenC(sensor.pinC, doC); diff --git a/library.properties b/library.properties index fce7b1aca..46294445f 100644 --- a/library.properties +++ b/library.properties @@ -2,8 +2,8 @@ name=Simple FOC version=2.4.1 author=Simplefoc maintainer=Simplefoc -sentence=A library demistifying FOC for BLDC motors -paragraph=Simple library intended for hobby comunity to run the BLDC and Stepper motor using FOC algorithm. It is intended to support as many BLDC/Stepper motor+sensor+driver combinations as possible and in the same time maintain simplicity of usage. Library supports Arudino devices such as Arduino UNO, MEGA, NANO and similar, stm32 boards such as Nucleo and Bluepill, ESP32 and Teensy boards. +sentence=A library demystifying FOC for BLDC motors +paragraph=Simple library intended for hobby community to run the BLDC and Stepper motor using FOC algorithm. It is intended to support as many BLDC/Stepper motor+sensor+driver combinations as possible and in the same time maintain simplicity of usage. Library supports Arduino devices such as Arduino UNO, MEGA, NANO and similar, stm32 boards such as Nucleo and Bluepill, ESP32 and Teensy boards. category=Device Control url=https://docs.simplefoc.com architectures=* diff --git a/src/HybridStepperMotor.cpp b/src/HybridStepperMotor.cpp index ce79e81eb..09d35022f 100644 --- a/src/HybridStepperMotor.cpp +++ b/src/HybridStepperMotor.cpp @@ -10,7 +10,7 @@ HybridStepperMotor::HybridStepperMotor(int pp, float _R, float _KV, float _Lq, float _Ld) : FOCMotor() { - // number od pole pairs + // number of pole pairs pole_pairs = pp; // save phase resistance number phase_resistance = _R; diff --git a/src/HybridStepperMotor.h b/src/HybridStepperMotor.h index de3ef1aed..31d777d93 100644 --- a/src/HybridStepperMotor.h +++ b/src/HybridStepperMotor.h @@ -80,7 +80,7 @@ class HybridStepperMotor : public FOCMotor */ int characteriseMotor(float voltage){ // correction factor is not correct here, - // we need to add the driver reistance to compensate for the voltage drop on it, but it is a good starting point for now + // we need to add the driver resistance to compensate for the voltage drop on it, but it is a good starting point for now return FOCMotor::characteriseMotor(voltage, 1.0f); }; diff --git a/src/common/base_classes/BLDCDriver.h b/src/common/base_classes/BLDCDriver.h index 6ae8186fb..3f370551b 100644 --- a/src/common/base_classes/BLDCDriver.h +++ b/src/common/base_classes/BLDCDriver.h @@ -23,9 +23,9 @@ class BLDCDriver: public FOCDriver{ /** * Set phase state, enable/disable * - * @param sc - phase A state : active / disabled ( high impedance ) + * @param sa - phase A state : active / disabled ( high impedance ) * @param sb - phase B state : active / disabled ( high impedance ) - * @param sa - phase C state : active / disabled ( high impedance ) + * @param sc - phase C state : active / disabled ( high impedance ) */ virtual void setPhaseState(PhaseState sa, PhaseState sb, PhaseState sc) = 0; diff --git a/src/common/base_classes/CurrentSense.cpp b/src/common/base_classes/CurrentSense.cpp index ce96f85b5..989b4a180 100644 --- a/src/common/base_classes/CurrentSense.cpp +++ b/src/common/base_classes/CurrentSense.cpp @@ -148,7 +148,7 @@ void CurrentSense::disable(){ // 2 - success but pins reconfigured // 3 - success but gains inverted // 4 - success but pins reconfigured and gains inverted -// IMPORTANT, this function can be overriden in the child class +// IMPORTANT, this function can be overridden in the child class int CurrentSense::driverAlign(float voltage, bool modulation_centered){ int exit_flag = 1; diff --git a/src/common/base_classes/FOCMotor.cpp b/src/common/base_classes/FOCMotor.cpp index 214b74ce2..7b1785024 100644 --- a/src/common/base_classes/FOCMotor.cpp +++ b/src/common/base_classes/FOCMotor.cpp @@ -10,7 +10,7 @@ FOCMotor::FOCMotor() velocity_limit = DEF_VEL_LIM; // maximum voltage to be set to the motor voltage_limit = DEF_POWER_SUPPLY; - // not set on the begining + // not set on the beginning current_limit = DEF_CURRENT_LIM; // index search velocity @@ -455,7 +455,7 @@ float FOCMotor::angleOpenloop(float target_angle){ void FOCMotor::updateVelocityLimit(float new_velocity_limit) { velocity_limit = new_velocity_limit; if(controller != MotionControlType::angle_nocascade) - P_angle.limit = abs(velocity_limit); // if angle control but no velocity cascade, limit the angle controller by the velocity limit + P_angle.limit = abs(velocity_limit); // in cascaded angle control the angle controller outputs the velocity set point, so limit it by the velocity limit } // Update limit values in controllers when changed @@ -606,7 +606,7 @@ void FOCMotor::loopFOC() { // if open-loop do nothing if( controller==MotionControlType::angle_openloop || controller==MotionControlType::velocity_openloop ) - // calculate the open loop electirical angle + // calculate the open loop electrical angle electrical_angle = _electricalAngle((shaft_angle), pole_pairs); else // Needs the update() to be called first @@ -696,7 +696,7 @@ void FOCMotor::move(float new_target) { if(motor_status == FOCMotorStatus::motor_calibrating) return; // calculate the elapsed time between the calls - // TODO replace downsample by runnind the code at + // TODO replace downsample by running the code at // a specific frequency (or almost) updateMotionControlTime(); @@ -810,7 +810,7 @@ int FOCMotor::initFOC() { // aligning the current sensor - can be skipped // checks if driver phases are the same as current sense phases - // and checks the direction of measuremnt. + // and checks the direction of measurement. if(exit_flag){ if(current_sense){ if (!current_sense->initialized) { diff --git a/src/common/base_classes/FOCMotor.h b/src/common/base_classes/FOCMotor.h index fbac503ff..81731f583 100644 --- a/src/common/base_classes/FOCMotor.h +++ b/src/common/base_classes/FOCMotor.h @@ -129,7 +129,7 @@ class FOCMotor */ virtual float estimateBEMF([[maybe_unused]] float velocity){ return 0.0f; }; - // Methods that have a default behavior but can be overriden if needed + // Methods that have a default behavior but can be overridden if needed /** * Function initializing FOC algorithm @@ -240,7 +240,7 @@ class FOCMotor float current_limit; //!< Current limiting variable - global limit float velocity_limit; //!< Velocity limiting variable - global limit - // motor status vairables + // motor status variables int8_t enabled = 0;//!< enabled or disabled motor flag FOCMotorStatus motor_status = FOCMotorStatus::motor_uninitialized; //!< motor status @@ -262,13 +262,13 @@ class FOCMotor PIDController P_angle{DEF_P_ANGLE_P,0,0,0,DEF_VEL_LIM}; //!< parameter determining the position PID configuration LowPassFilter LPF_velocity{DEF_VEL_FILTER_Tf};//!< parameter determining the velocity Low pass filter configuration LowPassFilter LPF_angle{0.0f};//!< parameter determining the angle low pass filter configuration - unsigned int motion_downsample = DEF_MOTION_DOWNSMAPLE; //!< parameter defining the ratio of downsampling for move commad - unsigned int motion_cnt = 0; //!< counting variable for downsampling for move commad + unsigned int motion_downsample = DEF_MOTION_DOWNSMAPLE; //!< parameter defining the ratio of downsampling for move command + unsigned int motion_cnt = 0; //!< counting variable for downsampling for move command - // sensor related variabels + // sensor related variables float sensor_offset; //!< user defined sensor zero offset float zero_electric_angle = NOT_SET;//!< absolute zero electric angle - if available - Direction sensor_direction = Direction::UNKNOWN; //!< default is CW. if sensor_direction == Direction::CCW then direction will be flipped compared to CW. Set to UNKNOWN to set by calibration + Direction sensor_direction = Direction::UNKNOWN; //!< default is Direction::UNKNOWN; it is set during calibration. Direction::CCW flips the direction compared to CW. bool pp_check_result = false; //!< the result of the PP check, if run during loopFOC /** diff --git a/src/common/base_classes/StepperDriver.h b/src/common/base_classes/StepperDriver.h index 9864b2352..f0c884092 100644 --- a/src/common/base_classes/StepperDriver.h +++ b/src/common/base_classes/StepperDriver.h @@ -18,7 +18,7 @@ class StepperDriver: public FOCDriver{ /** * Set phase state, enable/disable * - * @param sc - phase A state : active / disabled ( high impedance ) + * @param sa - phase A state : active / disabled ( high impedance ) * @param sb - phase B state : active / disabled ( high impedance ) */ virtual void setPhaseState(PhaseState sa, PhaseState sb) = 0; diff --git a/src/common/defaults.h b/src/common/defaults.h index ca3d50030..1713bf068 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -17,7 +17,7 @@ #define DEF_PID_CURR_D 0.0f //!< default PID controller D value #define DEF_PID_CURR_RAMP 1000.0f //!< default PID controller voltage ramp value #define DEF_PID_CURR_LIMIT (DEF_POWER_SUPPLY) //!< default PID controller voltage limit -#define DEF_CURR_FILTER_Tf 0.01f //!< default velocity filter time constant +#define DEF_CURR_FILTER_Tf 0.01f //!< default current filter time constant #define DEF_CURR_BANDWIDTH 100.0f //!< current bandwidth #else // for stm32, due, teensy, esp32 and similar @@ -27,7 +27,7 @@ #define DEF_PID_CURR_RAMP 0 //!< default PID controller voltage ramp value #define DEF_PID_CURR_LIMIT (DEF_POWER_SUPPLY) //!< default PID controller voltage limit #define DEF_CURR_BANDWIDTH 300.0f //!< current bandwidth -#define DEF_CURR_FILTER_Tf 1/(_2PI*DEF_CURR_BANDWIDTH) //!< default currnet filter time constant +#define DEF_CURR_FILTER_Tf 1/(_2PI*DEF_CURR_BANDWIDTH) //!< default current filter time constant #endif // default current limit values #define DEF_CURRENT_LIM 2.0f //!< 2Amps current limit by default @@ -43,9 +43,9 @@ // index search #define DEF_INDEX_SEARCH_TARGET_VELOCITY 1.0f //!< default index search velocity // align voltage -#define DEF_VOLTAGE_SENSOR_ALIGN 3.0f //!< default voltage for sensor and motor zero alignemt +#define DEF_VOLTAGE_SENSOR_ALIGN 3.0f //!< default voltage for sensor and motor zero alignment // low pass filter velocity #define DEF_VEL_FILTER_Tf 0.005f //!< default velocity filter time constant // current sense default parameters -#define DEF_LPF_PER_PHASE_CURRENT_SENSE_Tf 0.0f //!< default currnet sense per phase low pass filter time constant +#define DEF_LPF_PER_PHASE_CURRENT_SENSE_Tf 0.0f //!< default current sense per phase low pass filter time constant diff --git a/src/common/lowpass_filter.cpp b/src/common/lowpass_filter.cpp index aabb77907..b0f7f6432 100644 --- a/src/common/lowpass_filter.cpp +++ b/src/common/lowpass_filter.cpp @@ -11,7 +11,7 @@ LowPassFilter::LowPassFilter(float time_constant, float sampling_time) float LowPassFilter::operator() (float x) { - // initalise the elapsed time with the fixed sampling tims Ts + // initialize the elapsed time with the fixed sampling time Ts float dt = Ts; // if Ts is not set, use adaptive sampling time // calculate the ellapsed time dt diff --git a/src/common/pid.cpp b/src/common/pid.cpp index 3bf3b491d..d5180553b 100644 --- a/src/common/pid.cpp +++ b/src/common/pid.cpp @@ -16,7 +16,7 @@ PIDController::PIDController(float P, float I, float D, float ramp, float limit, // PID controller function float PIDController::operator() (float error){ - // initalise the elapsed time with the fixed sampling tims Ts + // initialize the elapsed time with the fixed sampling time Ts float dt = Ts; // if Ts is not set, use adaptive sampling time // calculate the ellapsed time dt diff --git a/src/common/time_utils.cpp b/src/common/time_utils.cpp index 2acb47a3c..e7575d43c 100644 --- a/src/common/time_utils.cpp +++ b/src/common/time_utils.cpp @@ -5,7 +5,7 @@ void _delay(unsigned long ms){ #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328PB__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega32U4__) // if arduino uno and other atmega328p chips - // use while instad of delay, + // use while instead of delay, // due to wrong measurement based on changed timer0 unsigned long t = _micros() + ms*1000; while( _micros() < t ){}; diff --git a/src/communication/Commander.cpp b/src/communication/Commander.cpp index 1ddded8fe..d3d95711c 100644 --- a/src/communication/Commander.cpp +++ b/src/communication/Commander.cpp @@ -593,7 +593,7 @@ void Commander::target(FOCMotor* motor, char* user_cmd, char* separator){ vel= atof(strtok (user_cmd, separator)); motor->target = vel; - // allow for setting only the target velocity without chaning the torque limit + // allow for setting only the target velocity without changing the torque limit next_value = strtok (NULL, separator); if (next_value){ torque = atof(next_value); @@ -607,7 +607,7 @@ void Commander::target(FOCMotor* motor, char* user_cmd, char* separator){ pos= atof(strtok (user_cmd, separator)); motor->target = pos; - // allow for setting only the target position without chaning the velocity/torque limits + // allow for setting only the target position without changing the velocity/torque limits next_value = strtok (NULL, separator); if( next_value ){ vel = atof(next_value); @@ -627,7 +627,7 @@ void Commander::target(FOCMotor* motor, char* user_cmd, char* separator){ // set the target vel= atof(strtok (user_cmd, separator)); motor->target = vel; - // allow for setting only the target velocity without chaning the torque limit + // allow for setting only the target velocity without changing the torque limit next_value = strtok (NULL, separator); if (next_value ){ torque = atof(next_value); @@ -641,12 +641,12 @@ void Commander::target(FOCMotor* motor, char* user_cmd, char* separator){ pos= atof(strtok (user_cmd, separator)); motor->target = pos; - // allow for setting only the target position without chaning the velocity/torque limits + // allow for setting only the target position without changing the velocity/torque limits next_value = strtok (NULL, separator); if( next_value ){ vel = atof(next_value); motor->updateVelocityLimit(vel); - // allow for setting only the target velocity without chaning the torque limit + // allow for setting only the target velocity without changing the torque limit next_value = strtok (NULL, separator); if (next_value ){ torque = atof(next_value); diff --git a/src/communication/Commander.h b/src/communication/Commander.h index 24bd3fbe4..b6e2461fd 100644 --- a/src/communication/Commander.h +++ b/src/communication/Commander.h @@ -20,7 +20,7 @@ enum VerboseMode : uint8_t { }; -// callback function pointer definiton +// callback function pointer definition typedef void (* CommandCallback)(char*); //!< command callback function pointer /** @@ -94,7 +94,7 @@ class Commander void add(char id , CommandCallback onCommand, const char* label = nullptr); // printing variables - VerboseMode verbose = VerboseMode::user_friendly; //!< flag signaling that the commands should output user understanable text + VerboseMode verbose = VerboseMode::user_friendly; //!< flag signaling that the commands should output user understandable text uint8_t decimal_places = 3; //!< number of decimal places to be used when displaying numbers // monitoring functions @@ -131,8 +131,8 @@ class Commander * '2' - foc_current * 'E' - Motor status (enable/disable) * sub-commands: - * '0' - enable - * '1' - disable + * '0' - disable + * '1' - enable * 'R' - Motor resistance * 'S' - Sensor offsets * sub-commands: @@ -230,8 +230,8 @@ class Commander * '2' - foc_current * 'E' - Motor status (enable/disable) * sub-commands: - * '0' - enable - * '1' - disable + * '0' - disable + * '1' - enable * '' - Target setting interface * Depends of the motion control mode: * - torque : torque (ex. M2.5) diff --git a/src/communication/commands.h b/src/communication/commands.h index 90df9055b..423eb8d48 100644 --- a/src/communication/commands.h +++ b/src/communication/commands.h @@ -21,7 +21,7 @@ #define CMD_FOC_PARAMS 'F' //!< time parameters // commander configuration -#define CMD_SCAN '?' //!< command scaning the network - only for commander +#define CMD_SCAN '?' //!< command scanning the network - only for commander #define CMD_VERBOSE '@' //!< command setting output mode - only for commander #define CMD_DECIMAL '#' //!< command setting decimal places - only for commander diff --git a/src/current_sense/hardware_specific/esp32/esp32_mcu.h b/src/current_sense/hardware_specific/esp32/esp32_mcu.h index f6524d5c4..fe0176d0e 100644 --- a/src/current_sense/hardware_specific/esp32/esp32_mcu.h +++ b/src/current_sense/hardware_specific/esp32/esp32_mcu.h @@ -20,7 +20,7 @@ typedef struct ESP32CurrentSenseParams { void* pretrig_comparator = nullptr; // MCPWM comparator handle for ADC pre-trigger } ESP32CurrentSenseParams; -// macros for debugging wuing the simplefoc debug system +// macros for debugging using the simplefoc debug system #ifndef SIMPLEFOC_DISABLE_DEBUG #define SIMPLEFOC_ESP32_CS_DEBUG(str)\ SimpleFOCDebug::println( "ESP32-CS: "+ String(str)); diff --git a/src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp b/src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp index 8bd41966f..5b87ecb6d 100644 --- a/src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp @@ -151,7 +151,7 @@ ADC_TypeDef* _findBestADCForRegularPin(int pin, ADC_HandleTypeDef adc_handles[]) // if not possible it will return nullptr ADC_TypeDef* _findBestADCForInjectedPins(int numPins, int pins[], ADC_HandleTypeDef adc_handles[]) { - // assuning that there is at most 5 ADCs + // assuming that there is at most 5 ADCs uint8_t pins_at_adc[ADC_COUNT] = {0}; // check how many pins are there and are not set @@ -187,7 +187,7 @@ ADC_TypeDef* _findBestADCForInjectedPins(int numPins, int pins[], ADC_HandleType SimpleFOCDebug::print(" pins: "); SimpleFOCDebug::println(pins_at_adc[i]); if (adc_handles[i].Instance != NP) { - // check if ADC injeted is already in use + // check if ADC injected is already in use if(!LL_ADC_INJ_IsTriggerSourceSWStart(adc_handles[i].Instance)) { SimpleFOCDebug::print("STM32-CS: ADC"); SimpleFOCDebug::print(i+1); @@ -523,7 +523,7 @@ uint32_t _initTimerInterruptDownsampling(Stm32CurrentSenseParams* cs_params, STM if(!adc_interrupt_config.use_adc_interrupt){ // If the timer has no repetition counter, it needs to use the interrupt to downsample for low side sensing adc_interrupt_config.use_adc_interrupt = 1; - // remember that this timer does not have the repetition counter - need to downasmple + // remember that this timer does not have the repetition counter - need to downsample adc_interrupt_config.needs_downsample = 1; if(next_event_high_side) // Next event is high-side active @@ -543,7 +543,7 @@ uint8_t _handleInjectedConvCpltCallback(ADC_HandleTypeDef *AdcHandle, Stm32AdcIn return 0; // error: function not available #else - // if the timer han't repetition counter - downsample two times + // if the timer hasn't repetition counter - downsample two times if( adc_interrupt_config.needs_downsample && adc_interrupt_config.tim_downsample++ > 0) { adc_interrupt_config.tim_downsample = 0; return 1; @@ -651,7 +651,7 @@ float _readRegularADCVoltage(const int pin){ ADC_ChannelConfTypeDef sConfig = {0}; sConfig.Channel = last_channel[adc_index]; - // the shortes possible sampling time + // the shortest possible sampling time // this seems to be a constant in HAL - the shortest time enum is equal to 0 // G4 - 2.5 cycles // F1, H7 - 1.5 cycles diff --git a/src/current_sense/hardware_specific/stm32/stm32_adc_utils.h b/src/current_sense/hardware_specific/stm32/stm32_adc_utils.h index c930a42ac..704daaf8d 100644 --- a/src/current_sense/hardware_specific/stm32/stm32_adc_utils.h +++ b/src/current_sense/hardware_specific/stm32/stm32_adc_utils.h @@ -25,10 +25,10 @@ uint32_t _getADCChannel(uint8_t ind); uint32_t _getADCInjectedRank(uint8_t ind); uint32_t _getADCRegularRank(uint8_t ind); -// timer to injected TRGO - architecure specific +// timer to injected TRGO - architecture specific uint32_t _timerToInjectedTRGO(TIM_HandleTypeDef* timer); -// timer to regular TRGO - architecure specific +// timer to regular TRGO - architecture specific uint32_t _timerToRegularTRGO(TIM_HandleTypeDef* timer); // function returning index of the ADC instance diff --git a/src/current_sense/hardware_specific/teensy/teensy4_mcu.cpp b/src/current_sense/hardware_specific/teensy/teensy4_mcu.cpp index ff0cc7181..9811e1fb5 100644 --- a/src/current_sense/hardware_specific/teensy/teensy4_mcu.cpp +++ b/src/current_sense/hardware_specific/teensy/teensy4_mcu.cpp @@ -176,7 +176,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p if( _isset(pinC) ) pinMode(pinC, INPUT); // check if either of the pins are not set - // and dont use it if it isn't + // and don't use it if it isn't int pin_count = 0; int pins[3] = {NOT_SET, NOT_SET, NOT_SET}; if(_isset(pinA)) pins[pin_count++] = pinA; @@ -219,7 +219,7 @@ void* _driverSyncLowSide(void* driver_params, void* cs_params){ flexpwm->SM[submodule].TCTRL = FLEXPWM_SMTCTRL_OUT_TRIG_EN(1<<1); - // if needed the interrupt can be moved to some other point in the PWM cycle by using an addional val register example: VAL4 + // if needed the interrupt can be moved to some other point in the PWM cycle by using an additional val register example: VAL4 // setup the ADC_ETC trigger to be triggered by the FlexPWM channel 4 (val4) // flexpwm->SM[submodule].TCTRL = FLEXPWM_SMTCTRL_OUT_TRIG_EN(1<<4); // setup this val4 for interrupt on match for ADC sync diff --git a/src/drivers/hardware_api.h b/src/drivers/hardware_api.h index 7809233d5..946f1be4c 100644 --- a/src/drivers/hardware_api.h +++ b/src/drivers/hardware_api.h @@ -41,7 +41,7 @@ typedef struct GenericDriverParams { /** * Configuring PWM frequency, resolution and alignment - * - Stepper driver - 2PWM setting + * - Stepper driver - 1PWM setting * - hardware specific * * @param pwm_frequency - frequency in hertz - if applicable @@ -102,10 +102,10 @@ void* _configure4PWM(long pwm_frequency, const int pin1A, const int pin1B, const * @param dead_zone duty cycle protection zone [0, 1] - both low and high side low - if applicable * @param pinA_h pinA high-side bldc driver * @param pinA_l pinA low-side bldc driver - * @param pinB_h pinA high-side bldc driver - * @param pinB_l pinA low-side bldc driver - * @param pinC_h pinA high-side bldc driver - * @param pinC_l pinA low-side bldc driver + * @param pinB_h pinB high-side bldc driver + * @param pinB_l pinB low-side bldc driver + * @param pinC_h pinC high-side bldc driver + * @param pinC_l pinC low-side bldc driver * * @return -1 if failed, or pointer to internal driver parameters struct if successful */ diff --git a/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp b/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp index 349f03f44..c4d006b21 100644 --- a/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp +++ b/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp @@ -34,7 +34,7 @@ void _pinHighFrequency(const int pin){ // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void* _configure1PWM(long pwm_frequency,const int pinA) { // High PWM frequency // - always max 32kHz @@ -49,7 +49,7 @@ void* _configure1PWM(long pwm_frequency,const int pinA) { // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) { // High PWM frequency // - always max 32kHz @@ -65,7 +65,7 @@ void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) { // function setting the high pwm frequency to the supplied pins // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC) { // High PWM frequency // - always max 32kHz @@ -84,7 +84,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the pwm duty cycle to the hardware // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle1PWM(float dc_a, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -93,7 +93,7 @@ void _writeDutyCycle1PWM(float dc_a, void* params){ // function setting the pwm duty cycle to the hardware // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -102,7 +102,7 @@ void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -112,7 +112,7 @@ void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void* _configure4PWM(long pwm_frequency,const int pin1A, const int pin1B, const int pin2A, const int pin2B) { // High PWM frequency // - always max 32kHz @@ -130,7 +130,7 @@ void* _configure4PWM(long pwm_frequency,const int pin1A, const int pin1B, const // function setting the pwm duty cycle to the hardware // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_1a); @@ -214,7 +214,7 @@ void _setPwmPair(int pinH, int pinL, float val, int dead_time) // Function setting the duty cycle to the pwm pin (ex. analogWrite()) // - BLDC driver - 6PWM setting // - hardware specific -// supports Arudino/ATmega328 +// supports Arduino/ATmega328 void _writeDutyCycle6PWM(float dc_a, float dc_b, float dc_c, PhaseState *phase_state, void* params){ _setPwmPair(((GenericDriverParams*)params)->pins[0], ((GenericDriverParams*)params)->pins[1], dc_a*255.0f, ((GenericDriverParams*)params)->dead_zone*255.0f); _setPwmPair(((GenericDriverParams*)params)->pins[2], ((GenericDriverParams*)params)->pins[3], dc_b*255.0f, ((GenericDriverParams*)params)->dead_zone*255.0f); diff --git a/src/drivers/hardware_specific/due_mcu.cpp b/src/drivers/hardware_specific/due_mcu.cpp index 4397114b7..e30421ff8 100644 --- a/src/drivers/hardware_specific/due_mcu.cpp +++ b/src/drivers/hardware_specific/due_mcu.cpp @@ -341,7 +341,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max // save the pwm frequency _pwm_frequency = pwm_frequency; - // cinfigure pwm pins + // configure pwm pins initPWM(pinA, _pwm_frequency); initPWM(pinB, _pwm_frequency); initPWM(pinC, _pwm_frequency); @@ -366,7 +366,7 @@ void* _configure2PWM(long pwm_frequency, const int pinA, const int pinB) { else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max // save the pwm frequency _pwm_frequency = pwm_frequency; - // cinfigure pwm pins + // configure pwm pins initPWM(pinA, _pwm_frequency); initPWM(pinB, _pwm_frequency); // sync the timers if possible @@ -384,13 +384,13 @@ void* _configure2PWM(long pwm_frequency, const int pinA, const int pinB) { // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC, const int pinD) { if(!pwm_frequency || !_isset(pwm_frequency)) pwm_frequency = _PWM_FREQUENCY; // default frequency 50khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max // save the pwm frequency _pwm_frequency = pwm_frequency; - // cinfigure pwm pins + // configure pwm pins initPWM(pinA, _pwm_frequency); initPWM(pinB, _pwm_frequency); initPWM(pinC, _pwm_frequency); @@ -410,7 +410,7 @@ void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* param){ // transform duty cycle from [0,1] to [0,_max_pwm_value] GenericDriverParams* p = (GenericDriverParams*)param; @@ -423,7 +423,7 @@ void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* param){ // function setting the pwm duty cycle to the hardware // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, void* param){ // transform duty cycle from [0,1] to [0,_max_pwm_value] GenericDriverParams* p = (GenericDriverParams*)param; diff --git a/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp b/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp index da42d49b2..6afe6e388 100644 --- a/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp +++ b/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp @@ -433,7 +433,7 @@ void* _configurePinsMCPWM(long pwm_frequency, int mcpwm_group, int timer_no, int // save variables for later pwm_periods[mcpwm_group][timer_no] = pwm_config.period_ticks / 2; params->timers[0] = timers[mcpwm_group][timer_no]; - // if the numer of used channels it not pair skip one channel + // if the number of used channels it not pair skip one channel // the skipped channel cannot be used with the new timer // TODO avoid loosing channels like this if(group_pins_used[mcpwm_group] %2) group_pins_used[mcpwm_group]++; diff --git a/src/drivers/hardware_specific/esp8266_mcu.cpp b/src/drivers/hardware_specific/esp8266_mcu.cpp index 23d94110a..e73e6c234 100644 --- a/src/drivers/hardware_specific/esp8266_mcu.cpp +++ b/src/drivers/hardware_specific/esp8266_mcu.cpp @@ -20,7 +20,7 @@ void _setHighFrequency(const long freq, const int pin){ // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void* _configure1PWM(long pwm_frequency, const int pinA) { if(!pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -36,7 +36,7 @@ void* _configure1PWM(long pwm_frequency, const int pinA) { // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void* _configure2PWM(long pwm_frequency, const int pinA, const int pinB) { if(!pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -51,7 +51,7 @@ void* _configure2PWM(long pwm_frequency, const int pinA, const int pinB) { // function setting the high pwm frequency to the supplied pins // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC) { if(!pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -67,7 +67,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC, const int pinD) { if(!pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -84,14 +84,14 @@ void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the pwm duty cycle to the hardware // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle1PWM(float dc_a, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); } // function setting the pwm duty cycle to the hardware // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -99,7 +99,7 @@ void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ } // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -109,7 +109,7 @@ void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // function setting the pwm duty cycle to the hardware // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_1a); diff --git a/src/drivers/hardware_specific/generic_mcu.cpp b/src/drivers/hardware_specific/generic_mcu.cpp index b6bc2f063..4a745989a 100644 --- a/src/drivers/hardware_specific/generic_mcu.cpp +++ b/src/drivers/hardware_specific/generic_mcu.cpp @@ -1,15 +1,15 @@ #include "../hardware_api.h" -// if the mcu doen't have defiend analogWrite +// if the mcu doesn't have defined analogWrite #if defined(ESP_H) && defined(ARDUINO_ARCH_ESP32) && !defined(analogWrite) __attribute__((weak)) void analogWrite(uint8_t pin, int value){ }; #endif // function setting the high pwm frequency to the supplied pin // - Stepper motor - 1PWM setting -// - hardware speciffic -// in generic case dont do anything +// - hardware specific +// in generic case don't do anything __attribute__((weak)) void* _configure1PWM(long pwm_frequency, const int pinA) { GenericDriverParams* params = new GenericDriverParams { .pins = { pinA }, @@ -20,8 +20,8 @@ __attribute__((weak)) void* _configure1PWM(long pwm_frequency, const int pinA) { // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic -// in generic case dont do anything +// - hardware specific +// in generic case don't do anything __attribute__((weak)) void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) { GenericDriverParams* params = new GenericDriverParams { .pins = { pinA, pinB }, @@ -32,8 +32,8 @@ __attribute__((weak)) void* _configure2PWM(long pwm_frequency,const int pinA, co // function setting the high pwm frequency to the supplied pins // - BLDC motor - 3PWM setting -// - hardware speciffic -// in generic case dont do anything +// - hardware specific +// in generic case don't do anything __attribute__((weak)) void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC) { GenericDriverParams* params = new GenericDriverParams { .pins = { pinA, pinB, pinC }, @@ -45,8 +45,8 @@ __attribute__((weak)) void* _configure3PWM(long pwm_frequency,const int pinA, co // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic -// in generic case dont do anything +// - hardware specific +// in generic case don't do anything __attribute__((weak)) void* _configure4PWM(long pwm_frequency, const int pin1A, const int pin1B, const int pin2A, const int pin2B) { GenericDriverParams* params = new GenericDriverParams { .pins = { pin1A, pin1B, pin2A, pin2B }, @@ -74,7 +74,7 @@ __attribute__((weak)) void* _configure6PWM(long pwm_frequency, float dead_zone, // function setting the pwm duty cycle to the hardware // - Stepper motor - 1PWM setting -// - hardware speciffic +// - hardware specific __attribute__((weak)) void _writeDutyCycle1PWM(float dc_a, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -83,7 +83,7 @@ __attribute__((weak)) void _writeDutyCycle1PWM(float dc_a, void* params){ // function setting the pwm duty cycle to the hardware // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific __attribute__((weak)) void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -92,7 +92,7 @@ __attribute__((weak)) void _writeDutyCycle2PWM(float dc_a, float dc_b, void* pa // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific __attribute__((weak)) void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); @@ -102,7 +102,7 @@ __attribute__((weak)) void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc // function setting the pwm duty cycle to the hardware // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific __attribute__((weak)) void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, void* params){ // transform duty cycle from [0,1] to [0,255] diff --git a/src/drivers/hardware_specific/nrf52_mcu.cpp b/src/drivers/hardware_specific/nrf52_mcu.cpp index 3985ac15f..1f332100d 100644 --- a/src/drivers/hardware_specific/nrf52_mcu.cpp +++ b/src/drivers/hardware_specific/nrf52_mcu.cpp @@ -131,7 +131,7 @@ void _configureHwPwm(NRF_PWM_Type* mcpwm1, NRF_PWM_Type* mcpwm2){ // function setting the high pwm frequency to the supplied pins // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC) { if( !pwm_frequency || pwm_frequency == NOT_SET) pwm_frequency = PWM_FREQ; // default frequency 20khz for a resolution of 800 @@ -193,7 +193,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void* _configure4PWM(long pwm_frequency, const int pinA, const int pinB, const int pinC, const int pinD) { if( !pwm_frequency || pwm_frequency == NOT_SET) pwm_frequency = PWM_FREQ; // default frequency 20khz for a resolution of 800 @@ -257,7 +257,7 @@ void* _configure4PWM(long pwm_frequency, const int pinA, const int pinB, const i // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // transform duty cycle from [0,1] to [0,range] bldc_3pwm_motor_slots_t* p = ((NRF52DriverParams*)params)->slot.slot3pwm; @@ -273,7 +273,7 @@ void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // function setting the pwm duty cycle to the hardware // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, void* params){ stepper_motor_slots_t* p = ((NRF52DriverParams*)params)->slot.slotstep; diff --git a/src/drivers/hardware_specific/portenta_h7_mcu.cpp b/src/drivers/hardware_specific/portenta_h7_mcu.cpp index 16b1a7e28..0d01cbc4d 100644 --- a/src/drivers/hardware_specific/portenta_h7_mcu.cpp +++ b/src/drivers/hardware_specific/portenta_h7_mcu.cpp @@ -385,7 +385,7 @@ void _alignPWMTimers(pwmout_t *t1, pwmout_t *t2, pwmout_t *t3, pwmout_t *t4){ // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) { if( !pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -396,7 +396,7 @@ void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) { core_util_critical_section_enter(); _pwm_init(&(params->pins[0]), pinA, (long)pwm_frequency); _pwm_init(&(params->pins[1]), pinB, (long)pwm_frequency); - // allign the timers + // align the timers _alignPWMTimers(&(params->pins[0]), &(params->pins[1])); core_util_critical_section_exit(); return params; @@ -405,7 +405,7 @@ void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) { // function setting the high pwm frequency to the supplied pins // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC) { if( !pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -417,7 +417,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in _pwm_init(&(params->pins[0]), pinA, (long)pwm_frequency); _pwm_init(&(params->pins[1]), pinB, (long)pwm_frequency); _pwm_init(&(params->pins[2]), pinC, (long)pwm_frequency); - // allign the timers + // align the timers _alignPWMTimers(&(params->pins[0]), &(params->pins[1]), &(params->pins[2])); core_util_critical_section_exit(); @@ -428,7 +428,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC, const int pinD) { if( !pwm_frequency || !_isset(pwm_frequency) ) pwm_frequency = _PWM_FREQUENCY; // default frequency 25khz else pwm_frequency = _constrain(pwm_frequency, 0, _PWM_FREQUENCY_MAX); // constrain to 50kHz max @@ -441,7 +441,7 @@ void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const in _pwm_init(&(params->pins[1]), pinB, (long)pwm_frequency); _pwm_init(&(params->pins[2]), pinC, (long)pwm_frequency); _pwm_init(&(params->pins[3]), pinD, (long)pwm_frequency); - // allign the timers + // align the timers _alignPWMTimers(&(params->pins[0]), &(params->pins[1]), &(params->pins[2]), &(params->pins[3])); core_util_critical_section_exit(); @@ -452,7 +452,7 @@ void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the pwm duty cycle to the hardware // - Stepper motor - 2PWM setting -//- hardware speciffic +//- hardware specific void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ core_util_critical_section_enter(); _pwm_write(&(((PortentaDriverParams*)params)->pins[0]), (float)dc_a); @@ -462,7 +462,7 @@ void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting -//- hardware speciffic +//- hardware specific void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ core_util_critical_section_enter(); _pwm_write(&(((PortentaDriverParams*)params)->pins[0]), (float)dc_a); @@ -474,7 +474,7 @@ void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // function setting the pwm duty cycle to the hardware // - Stepper motor - 4PWM setting -//- hardware speciffic +//- hardware specific void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, void* params){ core_util_critical_section_enter(); _pwm_write(&(((PortentaDriverParams*)params)->pins[0]), (float)dc_1a); diff --git a/src/drivers/hardware_specific/stm32/stm32_mcu.cpp b/src/drivers/hardware_specific/stm32/stm32_mcu.cpp index 3f363c49d..928e65984 100644 --- a/src/drivers/hardware_specific/stm32/stm32_mcu.cpp +++ b/src/drivers/hardware_specific/stm32/stm32_mcu.cpp @@ -321,7 +321,7 @@ STM32DriverParams* _stm32_initHardware6PWMPair(long PWM_freq, float dead_zone, P // sanity check if (pinH==NULL || pinL==NULL) return (STM32DriverParams*)SIMPLEFOC_DRIVER_INIT_FAILED; -#if defined(STM32L0xx) // L0 boards dont have hardware 6pwm interface +#if defined(STM32L0xx) // L0 boards don't have hardware 6pwm interface return SIMPLEFOC_DRIVER_INIT_FAILED; // return nothing #endif @@ -426,7 +426,7 @@ void* _configure1PWM(long pwm_frequency, const int pinA) { // function setting the high pwm frequency to the supplied pins // - Stepper motor - 2PWM setting -// - hardware speciffic +// - hardware specific void* _configure2PWM(long pwm_frequency, const int pinA, const int pinB) { if (numMotorsUsed+1 > SIMPLEFOC_STM32_MAX_MOTORSUSED) { SIMPLEFOC_DEBUG("STM32-DRV: ERR: too many drivers used"); @@ -467,7 +467,7 @@ void* _configure2PWM(long pwm_frequency, const int pinA, const int pinB) { // function setting the high pwm frequency to the supplied pins // - BLDC motor - 3PWM setting -// - hardware speciffic +// - hardware specific void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC) { if (numMotorsUsed+1 > SIMPLEFOC_STM32_MAX_MOTORSUSED) { SIMPLEFOC_DEBUG("STM32-DRV: ERR: too many drivers used"); @@ -508,7 +508,7 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in // function setting the high pwm frequency to the supplied pins // - Stepper motor - 4PWM setting -// - hardware speciffic +// - hardware specific void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC, const int pinD) { if (numMotorsUsed+1 > SIMPLEFOC_STM32_MAX_MOTORSUSED) { SIMPLEFOC_DEBUG("STM32-DRV: ERR: too many drivers used"); diff --git a/src/drivers/hardware_specific/stm32/stm32_searchtimers.cpp b/src/drivers/hardware_specific/stm32/stm32_searchtimers.cpp index f07c9715d..654d1cbc7 100644 --- a/src/drivers/hardware_specific/stm32/stm32_searchtimers.cpp +++ b/src/drivers/hardware_specific/stm32/stm32_searchtimers.cpp @@ -154,7 +154,7 @@ int _stm32_findBestTimerCombination(int numPins, int index, int pins[], PinMap* #endif } if (score==-1) - return -1; // pin not connected to any timer, propagate driectly + return -1; // pin not connected to any timer, propagate directly if (score>=0 && scorepins[1], 255.0f*dc_b); } -// inital weak implementation of the center aligned 3pwm configuration +// initial weak implementation of the center aligned 3pwm configuration // teensy 4 and 3 have center aligned pwm implementation of this function __attribute__((weak)) void _writeCenterAligned3PMW(float dc_a, float dc_b, float dc_c, void* params){ _UNUSED(dc_a); diff --git a/src/sensors/Encoder.cpp b/src/sensors/Encoder.cpp index fa4b8e734..b2a6bcee6 100644 --- a/src/sensors/Encoder.cpp +++ b/src/sensors/Encoder.cpp @@ -89,7 +89,7 @@ void Encoder::handleIndex() { index_found = true; // align encoder on each index long tmp = pulse_counter; - // corrent the counter value + // correct the counter value pulse_counter = round((double)pulse_counter/(double)cpr)*cpr; // preserve relative speed prev_pulse_counter += pulse_counter - tmp; diff --git a/src/sensors/Encoder.h b/src/sensors/Encoder.h index ab494d13f..3576d7b0e 100644 --- a/src/sensors/Encoder.h +++ b/src/sensors/Encoder.h @@ -19,7 +19,7 @@ class Encoder: public Sensor{ public: /** Encoder class constructor - @param encA encoder B pin + @param encA encoder A pin @param encB encoder B pin @param ppr impulses per rotation (cpr=ppr*4) @param index index pin number (optional input) diff --git a/src/sensors/HallSensor.cpp b/src/sensors/HallSensor.cpp index 64c5e48c1..cbda111bd 100644 --- a/src/sensors/HallSensor.cpp +++ b/src/sensors/HallSensor.cpp @@ -67,7 +67,7 @@ void HallSensor::updateState() { // glitch avoidance #2 changes in direction can cause velocity spikes. Possible improvements needed in this area if (direction == old_direction) { - // not oscilating or just changed direction + // not oscillating or just changed direction pulse_diff = new_pulse_timestamp - pulse_timestamp; } else { pulse_diff = 0; diff --git a/src/sensors/HallSensor.h b/src/sensors/HallSensor.h index 94053e0f9..610e1b3b9 100644 --- a/src/sensors/HallSensor.h +++ b/src/sensors/HallSensor.h @@ -17,7 +17,6 @@ class HallSensor: public Sensor{ @param encB HallSensor B pin @param encC HallSensor C pin @param pp pole pairs (e.g hoverboard motor has 15pp and small gimbals often have 7pp) - @param index index pin number (optional input) */ HallSensor(int encA, int encB, int encC, int pp); @@ -29,7 +28,7 @@ class HallSensor: public Sensor{ * * @param doA pointer to the A channel interrupt handler function * @param doB pointer to the B channel interrupt handler function - * @param doIndex pointer to the Index channel interrupt handler function + * @param doC pointer to the Hall C channel interrupt handler function * */ void enableInterrupts(void (*doA)() = nullptr, void(*doB)() = nullptr, void(*doC)() = nullptr); diff --git a/src/sensors/MagneticSensorI2C.cpp b/src/sensors/MagneticSensorI2C.cpp index 9298413a2..ee8d642e6 100644 --- a/src/sensors/MagneticSensorI2C.cpp +++ b/src/sensors/MagneticSensorI2C.cpp @@ -99,7 +99,7 @@ int MagneticSensorI2C::getRawCount() { // read the angle register first MSB then LSB byte readArray[2]; uint16_t readValue = 0; - // notify the device that is aboout to be read + // notify the device that is about to be read wire->beginTransmission(_conf.chip_address); wire->write(_conf.angle_register); currWireError = wire->endTransmission(false); diff --git a/src/sensors/MagneticSensorPWM.cpp b/src/sensors/MagneticSensorPWM.cpp index 04b7cc75d..56082dd79 100644 --- a/src/sensors/MagneticSensorPWM.cpp +++ b/src/sensors/MagneticSensorPWM.cpp @@ -101,7 +101,7 @@ void MagneticSensorPWM::handlePWM() { pulse_timestamp = last_call_us; // angle was sampled at the rising edge of the pulse, so use that timestamp } - // save the currrent timestamp for the next call + // save the current timestamp for the next call last_call_us = now_us; is_interrupt_based = true; // set the flag to true } diff --git a/src/sensors/MagneticSensorSPI.cpp b/src/sensors/MagneticSensorSPI.cpp index baaab2de4..4ff8eb002 100644 --- a/src/sensors/MagneticSensorSPI.cpp +++ b/src/sensors/MagneticSensorSPI.cpp @@ -13,7 +13,7 @@ MagneticSensorSPIConfig_s AS5147_SPI = { }; // AS5048 and AS5047 share the same configuration as AS5147 -// we have to explicilty assign them anyway due to compiler issues +// we have to explicitly assign them anyway due to compiler issues // Ex. https://community.simplefoc.com/t/esp32s3-qtpy-platformio-spi-problem/7444 MagneticSensorSPIConfig_s AS5048_SPI = { .spi_mode = SPI_MODE1, @@ -61,9 +61,9 @@ MagneticSensorSPI::MagneticSensorSPI(int cs, int _bit_resolution, int _angle_reg clock_speed = _isset(_clock_speed) ? _clock_speed : 1000000; bit_resolution = _bit_resolution; - command_parity_bit = 15; // for backwards compatibilty - command_rw_bit = 14; // for backwards compatibilty - data_start_bit = 13; // for backwards compatibilty + command_parity_bit = 15; // for backwards compatibility + command_rw_bit = 14; // for backwards compatibility + data_start_bit = 13; // for backwards compatibility } MagneticSensorSPI::MagneticSensorSPI(MagneticSensorSPIConfig_s config, int cs, long _clock_speed){ @@ -78,9 +78,9 @@ MagneticSensorSPI::MagneticSensorSPI(MagneticSensorSPIConfig_s config, int cs, l clock_speed = _isset(_clock_speed) ? _clock_speed : config.clock_speed; bit_resolution = config.bit_resolution; - command_parity_bit = config.command_parity_bit; // for backwards compatibilty - command_rw_bit = config.command_rw_bit; // for backwards compatibilty - data_start_bit = config.data_start_bit; // for backwards compatibilty + command_parity_bit = config.command_parity_bit; // for backwards compatibility + command_rw_bit = config.command_rw_bit; // for backwards compatibility + data_start_bit = config.data_start_bit; // for backwards compatibility } void MagneticSensorSPI::init(SPIClass* _spi){