Skip to content

Commit b0d7daa

Browse files
author
Richard Unger
committed
fix double constants to be floats
1 parent 76f0d56 commit b0d7daa

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/common/base_classes/Sensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void Sensor::update() {
1919
/** get current angular velocity (rad/s) */
2020
float Sensor::getVelocity() {
2121
// calculate sample time
22-
float Ts = (angle_prev_ts - vel_angle_prev_ts)*1e-6;
22+
float Ts = (angle_prev_ts - vel_angle_prev_ts)*1e-6f;
2323
if (Ts < 0.0f) { // handle micros() overflow - we need to reset vel_angle_prev_ts
2424
vel_angle_prev = angle_prev;
2525
vel_full_rotations = full_rotations;

src/common/defaults.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
// align voltage
4444
#define DEF_VOLTAGE_SENSOR_ALIGN 3.0f //!< default voltage for sensor and motor zero alignemt
4545
// low pass filter velocity
46-
#define DEF_VEL_FILTER_Tf 0.005 //!< default velocity filter time constant
46+
#define DEF_VEL_FILTER_Tf 0.005f //!< default velocity filter time constant
4747

4848
// current sense default parameters
4949
#define DEF_LPF_PER_PHASE_CURRENT_SENSE_Tf 0.0f //!< default currnet sense per phase low pass filter time constant

src/common/foc_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ __attribute__((weak)) float _sin(float a){
99
// 16 bit precision on sine value, 8 bit fractional value for interpolation, 6bit LUT size
1010
// resulting precision compared to stdlib sine is 0.00006480 (RMS difference in range -PI,PI for 3217 steps)
1111
static uint16_t sine_array[65] = {0,804,1608,2411,3212,4011,4808,5602,6393,7180,7962,8740,9512,10279,11039,11793,12540,13279,14010,14733,15447,16151,16846,17531,18205,18868,19520,20160,20788,21403,22006,22595,23170,23732,24279,24812,25330,25833,26320,26791,27246,27684,28106,28511,28899,29269,29622,29957,30274,30572,30853,31114,31357,31581,31786,31972,32138,32286,32413,32522,32610,32679,32729,32758,32768};
12-
unsigned int i = (unsigned int)(a * (64*4*256.0 /_2PI));
12+
unsigned int i = (unsigned int)(a * (64*4*256/_2PI));
1313
int t1, t2, frac = i & 0xff;
1414
i = (i >> 8) & 0xff;
1515
if (i < 64) {

0 commit comments

Comments
 (0)