Skip to content

Commit d752f29

Browse files
author
Richard Unger
committed
seems the WEAK macro isn't declared on all archs
1 parent c857bd8 commit d752f29

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/common/foc_utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// ~50us (int array)
77
// precision +-0.005
88
// it has to receive an angle in between 0 and 2PI
9-
WEAK float _sin(float a){
9+
__attribute__((weak)) float _sin(float a){
1010
// int array instead of float array
1111
// 4x200 points per 360 deg
1212
// 2x storage save (int 2Byte float 4 Byte )
@@ -37,15 +37,15 @@ WEAK float _sin(float a){
3737
// ~56us (int array)
3838
// precision +-0.005
3939
// it has to receive an angle in between 0 and 2PI
40-
WEAK float _cos(float a){
40+
__attribute__((weak)) float _cos(float a){
4141
float a_sin = a + _PI_2;
4242
a_sin = a_sin > _2PI ? a_sin - _2PI : a_sin;
4343
return _sin(a_sin);
4444
}
4545

4646

4747
// normalizing radian angle to [0,2PI]
48-
WEAK float _normalizeAngle(float angle){
48+
__attribute__((weak)) float _normalizeAngle(float angle){
4949
float a = fmod(angle, _2PI);
5050
return a >= 0 ? a : (a + _2PI);
5151
}
@@ -58,7 +58,7 @@ float _electricalAngle(float shaft_angle, int pole_pairs) {
5858
// square root approximation function using
5959
// https://reprap.org/forum/read.php?147,219210
6060
// https://en.wikipedia.org/wiki/Fast_inverse_square_root
61-
WEAK float _sqrtApprox(float number) {//low in fat
61+
__attribute__((weak)) float _sqrtApprox(float number) {//low in fat
6262
// float x;
6363
// const float f = 1.5F; // better precision
6464

0 commit comments

Comments
 (0)