Skip to content

Commit 05f458e

Browse files
Merge pull request #55 from simplefoc/feat_hybridstepper_to_main
Feat hybridstepper to main
2 parents 59fc94e + 6eba4b0 commit 05f458e

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/motors/HybridStepperMotor/HybridStepperMotor.cpp renamed to src/motors/HybridStepperMotorOld/HybridStepperMotorOld.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#include "HybridStepperMotor.h"
1+
#include "HybridStepperMotorOld.h"
22
#include "./communication/SimpleFOCDebug.h"
33

4-
// HybridStepperMotor(int pp)
4+
// HybridStepperMotorOld(int pp)
55
// - pp - pole pair number
66
// - R - motor phase resistance
77
// - KV - motor kv rating (rmp/v)
88
// - L - motor phase inductance [H]
9-
HybridStepperMotor::HybridStepperMotor(int pp, float _R, float _KV, float _inductance)
9+
HybridStepperMotorOld::HybridStepperMotorOld(int pp, float _R, float _KV, float _inductance)
1010
: FOCMotor()
1111
{
1212
// number od pole pairs
@@ -27,13 +27,13 @@ HybridStepperMotor::HybridStepperMotor(int pp, float _R, float _KV, float _induc
2727
/**
2828
Link the driver which controls the motor
2929
*/
30-
void HybridStepperMotor::linkDriver(BLDCDriver *_driver)
30+
void HybridStepperMotorOld::linkDriver(BLDCDriver *_driver)
3131
{
3232
driver = _driver;
3333
}
3434

3535
// init hardware pins
36-
int HybridStepperMotor::init()
36+
int HybridStepperMotorOld::init()
3737
{
3838
if (!driver || !driver->initialized)
3939
{
@@ -74,7 +74,7 @@ int HybridStepperMotor::init()
7474
}
7575

7676
// disable motor driver
77-
void HybridStepperMotor::disable()
77+
void HybridStepperMotorOld::disable()
7878
{
7979
// set zero to PWM
8080
driver->setPwm(0, 0, 0);
@@ -84,7 +84,7 @@ void HybridStepperMotor::disable()
8484
enabled = 0;
8585
}
8686
// enable motor driver
87-
void HybridStepperMotor::enable()
87+
void HybridStepperMotorOld::enable()
8888
{
8989
// disable enable
9090
driver->enable();
@@ -97,7 +97,7 @@ void HybridStepperMotor::enable()
9797
/**
9898
* FOC functions
9999
*/
100-
int HybridStepperMotor::initFOC()
100+
int HybridStepperMotorOld::initFOC()
101101
{
102102
int exit_flag = 1;
103103

@@ -132,7 +132,7 @@ int HybridStepperMotor::initFOC()
132132
}
133133

134134
// Encoder alignment to electrical 0 angle
135-
int HybridStepperMotor::alignSensor()
135+
int HybridStepperMotorOld::alignSensor()
136136
{
137137
int exit_flag = 1; // success
138138
SIMPLEFOC_DEBUG("MOT: Align sensor.");
@@ -226,7 +226,7 @@ int HybridStepperMotor::alignSensor()
226226

227227
// Encoder alignment the absolute zero angle
228228
// - to the index
229-
int HybridStepperMotor::absoluteZeroSearch()
229+
int HybridStepperMotorOld::absoluteZeroSearch()
230230
{
231231

232232
SIMPLEFOC_DEBUG("MOT: Index search...");
@@ -261,7 +261,7 @@ int HybridStepperMotor::absoluteZeroSearch()
261261

262262
// Iterative function looping FOC algorithm, setting Uq on the Motor
263263
// The faster it can be run the better
264-
void HybridStepperMotor::loopFOC()
264+
void HybridStepperMotorOld::loopFOC()
265265
{
266266

267267
// update sensor - do this even in open-loop mode, as user may be switching between modes and we could lose track
@@ -293,7 +293,7 @@ void HybridStepperMotor::loopFOC()
293293
// It runs either angle, velocity or voltage loop
294294
// - needs to be called iteratively it is asynchronous function
295295
// - if target is not set it uses motor.target value
296-
void HybridStepperMotor::move(float new_target)
296+
void HybridStepperMotorOld::move(float new_target)
297297
{
298298

299299
// set internal target variable
@@ -394,7 +394,7 @@ void HybridStepperMotor::move(float new_target)
394394
}
395395
}
396396

397-
void HybridStepperMotor::setPhaseVoltage(float Uq, float Ud, float angle_el)
397+
void HybridStepperMotorOld::setPhaseVoltage(float Uq, float Ud, float angle_el)
398398
{
399399
angle_el = _normalizeAngle(angle_el);
400400
float _ca = _cos(angle_el);
@@ -473,7 +473,7 @@ void HybridStepperMotor::setPhaseVoltage(float Uq, float Ud, float angle_el)
473473
// Function (iterative) generating open loop movement for target velocity
474474
// - target_velocity - rad/s
475475
// it uses voltage_limit variable
476-
float HybridStepperMotor::velocityOpenloop(float target_velocity)
476+
float HybridStepperMotorOld::velocityOpenloop(float target_velocity)
477477
{
478478
// get current timestamp
479479
unsigned long now_us = _micros();
@@ -509,7 +509,7 @@ float HybridStepperMotor::velocityOpenloop(float target_velocity)
509509
// Function (iterative) generating open loop movement towards the target angle
510510
// - target_angle - rad
511511
// it uses voltage_limit and velocity_limit variables
512-
float HybridStepperMotor::angleOpenloop(float target_angle)
512+
float HybridStepperMotorOld::angleOpenloop(float target_angle)
513513
{
514514
// get current timestamp
515515
unsigned long now_us = _micros();

src/motors/HybridStepperMotor/HybridStepperMotor.h renamed to src/motors/HybridStepperMotorOld/HybridStepperMotorOld.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* @file HybridStepperMotor.h
2+
* @file HybridStepperMotorOld.h
33
*
44
*/
55

6-
#ifndef HybridStepperMotor_h
7-
#define HybridStepperMotor_h
6+
#ifndef HybridStepperMotorOld_h
7+
#define HybridStepperMotorOld_h
88

99
#include "Arduino.h"
1010
#include "common/base_classes/FOCMotor.h"
@@ -17,17 +17,17 @@
1717
/**
1818
Stepper Motor class
1919
*/
20-
class HybridStepperMotor : public FOCMotor
20+
class HybridStepperMotorOld : public FOCMotor
2121
{
2222
public:
2323
/**
24-
HybridStepperMotor class constructor
24+
HybridStepperMotorOld class constructor
2525
@param pp pole pair number
2626
@param R motor phase resistance - [Ohm]
2727
@param KV motor KV rating (1/K_bemf) - rpm/V
2828
@param L motor phase inductance - [H]
2929
*/
30-
HybridStepperMotor(int pp, float R = NOT_SET, float KV = NOT_SET, float L = NOT_SET);
30+
HybridStepperMotorOld(int pp, float R = NOT_SET, float KV = NOT_SET, float L = NOT_SET);
3131

3232
/**
3333
* Function linking a motor and a foc driver
@@ -63,7 +63,7 @@ class HybridStepperMotor : public FOCMotor
6363
void loopFOC() override;
6464

6565
/**
66-
* Function executing the control loops set by the controller parameter of the HybridStepperMotor.
66+
* Function executing the control loops set by the controller parameter of the HybridStepperMotorOld.
6767
*
6868
* @param target Either voltage, angle or velocity based on the motor.controller
6969
* If it is not set the motor will use the target set in its variable motor.target

0 commit comments

Comments
 (0)