Skip to content

Commit 9c8cfda

Browse files
committed
fixing merge conflicts
2 parents e398f5b + a19e812 commit 9c8cfda

File tree

7 files changed

+49
-33
lines changed

7 files changed

+49
-33
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Therefore this is an attempt to:
1010
- Demystify FOC algorithm and make a robust but simple Arduino library: [Arduino *SimpleFOClibrary*](https://docs.simplefoc.com/arduino_simplefoc_library_showcase)
1111
- Develop a modular BLDC driver board: [Arduino *SimpleFOCShield*](https://docs.simplefoc.com/arduino_simplefoc_shield_showcase).
1212

13+
14+
> **DEV Features**<br>
15+
> - Teensy support by Christopher Parrott <br>
16+
> - Pull requests by [@cousinitt](https://github.com/cousinitt) - refactoring and c++11 improvements
17+
1318
<blockquote class="info"><p class="heading"><b>NEWS</b> 📢</p>New version of the Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span> is out! (<a href="https://github.com/askuric/Arduino-FOC/releases">version 1.5.0 <i class="fa fa-tag"></i></a>) <br> <b>New features</b>:<ul><li> Open-loop motor control</li><li> Support Hall sensors</li><li> Support for Analog interface Magnetic sensor</li><li> New alignment procedure <br>- automatic sensor direction detection<br> - possibility to avoid alignment completely</li><li> PI controller updated to PID controller</li><li>...</li></ul>Big thanks to <a href="https://github.com/owennewo">@owennewo</a> for awesome suggestions and pull-requests!</blockquote>
1419

1520

src/Encoder.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,31 @@ class Encoder: public Sensor{
5959

6060
// Abstract functions of the Sensor class implementation
6161
/** get current angle (rad) */
62-
float getAngle();
62+
float getAngle() override;
6363
/** get current angular velocity (rad/s) */
64-
float getVelocity();
64+
float getVelocity() override;
6565
/**
6666
* set current angle as zero angle
6767
* return the angle [rad] difference
6868
*/
69-
float initRelativeZero();
69+
float initRelativeZero() override;
7070
/**
7171
* set index angle as zero angle
7272
* return the angle [rad] difference
7373
*/
74-
float initAbsoluteZero();
74+
float initAbsoluteZero() override;
7575
/**
7676
* returns 0 if it has no index
7777
* 0 - encoder without index
7878
* 1 - encoder with index
7979
*/
80-
int hasAbsoluteZero();
80+
int hasAbsoluteZero() override;
8181
/**
8282
* returns 0 if it does need search for absolute zero
8383
* 0 - encoder without index
8484
* 1 - ecoder with index
8585
*/
86-
int needsAbsoluteZeroSearch();
86+
int needsAbsoluteZeroSearch() override;
8787

8888
private:
8989
int hasIndex(); //!< function returning 1 if encoder has index pin and 0 if not.

src/FOCutils.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ void _setPwmFrequency(const int pinA, const int pinB, const int pinC) {
5353
analogWrite(pinC, 0);
5454
analogWriteFrequency(50000); // set 50kHz
5555

56+
57+
#elif defined(__arm__) && defined(CORE_TEENSY) //if teensy 3x / 4x / LC boards
58+
analogWrite(pinA, 0);
59+
analogWriteFrequency(pinA, 50000); // set 50kHz
60+
analogWrite(pinB, 0);
61+
analogWriteFrequency(pinB, 50000); // set 50kHz
62+
analogWrite(pinC, 0);
63+
analogWriteFrequency(pinC, 50000); // set 50kHz
64+
5665
#elif defined(ESP_H) // if esp32 boards
5766

5867
motor_slots_t m_slot = {};

src/HallSensor.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ class HallSensor: public Sensor{
1010
public:
1111
/**
1212
HallSensor class constructor
13-
@param encA HallSensor B pin
13+
@param encA HallSensor A pin
1414
@param encB HallSensor B pin
15-
@param encC HallSensor B pin
15+
@param encC HallSensor C pin
1616
@param pp pole pairs (e.g hoverboard motor has 15pp and small gimbals often have 7pp)
1717
@param index index pin number (optional input)
1818
*/
@@ -51,31 +51,31 @@ class HallSensor: public Sensor{
5151

5252
// Abstract functions of the Sensor class implementation
5353
/** get current angle (rad) */
54-
float getAngle();
54+
float getAngle() override;
5555
/** get current angular velocity (rad/s) */
56-
float getVelocity();
56+
float getVelocity() override;
5757
/**
5858
* set current angle as zero angle
5959
* return the angle [rad] difference
6060
*/
61-
float initRelativeZero();
61+
float initRelativeZero() override;
6262
/**
6363
* set index angle as zero angle
6464
* return the angle [rad] difference
6565
*/
66-
float initAbsoluteZero();
66+
float initAbsoluteZero() override;
6767
/**
6868
* returns 0 if it has no index
6969
* 0 - HallSensor without index
7070
* 1 - HallSensor with index
7171
*/
72-
int hasAbsoluteZero();
72+
int hasAbsoluteZero() override;
7373
/**
7474
* returns 0 if it does need search for absolute zero
7575
* 0 - HallSensor without index
7676
* 1 - ecoder with index
7777
*/
78-
int needsAbsoluteZeroSearch();
78+
int needsAbsoluteZeroSearch() override;
7979

8080
// whether last step was CW (+1) or CCW (-1) direction
8181
Direction direction;

src/MagneticSensorAnalog.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class MagneticSensorAnalog: public Sensor{
1515
/**
1616
* MagneticSensorAnalog class constructor
1717
* @param _pinAnalog the pin to read the PWM signal
18-
* @param _pinAnalog the pin to read the PWM signal
1918
*/
2019
MagneticSensorAnalog(uint8_t _pinAnalog, int _min = 0, int _max = 0);
2120

@@ -30,23 +29,23 @@ class MagneticSensorAnalog: public Sensor{
3029

3130
// implementation of abstract functions of the Sensor class
3231
/** get current angle (rad) */
33-
float getAngle();
32+
float getAngle() override;
3433
/** get current angular velocity (rad/s) **/
35-
float getVelocity();
34+
float getVelocity() override;
3635
/**
3736
* set current angle as zero angle
3837
* return the angle [rad] difference
3938
*/
40-
float initRelativeZero();
39+
float initRelativeZero() override;
4140
/**
4241
* set absolute zero angle as zero angle
4342
* return the angle [rad] difference
4443
*/
45-
float initAbsoluteZero();
44+
float initAbsoluteZero() override;
4645
/** returns 1 because it is the absolute sensor */
47-
int hasAbsoluteZero();
46+
int hasAbsoluteZero() override;
4847
/** returns 0 maning it doesn't need search for absolute zero */
49-
int needsAbsoluteZeroSearch();
48+
int needsAbsoluteZeroSearch() override;
5049
/** raw count (typically in range of 0-1023), useful for debugging resolution issues */
5150
int raw_count;
5251
int min_raw_count;

src/MagneticSensorI2C.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,24 @@ class MagneticSensorI2C: public Sensor{
2525

2626
// implementation of abstract functions of the Sensor class
2727
/** get current angle (rad) */
28-
float getAngle();
28+
float getAngle() override;
2929
/** get current angular velocity (rad/s) **/
30-
float getVelocity();
30+
float getVelocity() override;
3131
/**
3232
* set current angle as zero angle
3333
* return the angle [rad] difference
3434
*/
35-
float initRelativeZero();
35+
float initRelativeZero() override;
3636
/**
3737
* set absolute zero angle as zero angle
3838
* return the angle [rad] difference
3939
*/
40-
float initAbsoluteZero();
40+
float initAbsoluteZero() override;
4141
/** returns 1 because it is the absolute sensor */
42-
int hasAbsoluteZero();
42+
int hasAbsoluteZero() override;
4343
/** returns 0 maning it doesn't need search for absolute zero */
44-
int needsAbsoluteZeroSearch();
44+
45+
int needsAbsoluteZeroSearch() override;
4546

4647
/* the speed of the i2c clock signal */
4748
long clock_speed;

src/MagneticSensorSPI.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,25 @@ class MagneticSensorSPI: public Sensor{
2626

2727
// implementation of abstract functions of the Sensor class
2828
/** get current angle (rad) */
29-
float getAngle();
29+
float getAngle() override;
3030
/** get current angular velocity (rad/s) **/
31-
float getVelocity();
31+
float getVelocity() override;
3232
/**
3333
* set current angle as zero angle
3434
* return the angle [rad] difference
3535
*/
36-
float initRelativeZero();
36+
float initRelativeZero() override;
3737
/**
3838
* set absolute zero angle as zero angle
3939
* return the angle [rad] difference
4040
*/
41-
float initAbsoluteZero();
41+
float initAbsoluteZero() override;
4242
/** returns 1 because it is the absolute sensor */
43-
int hasAbsoluteZero();
43+
int hasAbsoluteZero() override;
4444
/** returns 0 maning it doesn't need search for absolute zero */
45-
int needsAbsoluteZeroSearch();
45+
46+
int needsAbsoluteZeroSearch() override;
47+
4648
// returns the spi mode (phase/polarity of read/writes) i.e one of SPI_MODE0 | SPI_MODE1 | SPI_MODE2 | SPI_MODE3
4749
int spi_mode;
4850

0 commit comments

Comments
 (0)