From b0d7daafbfb8589ed0d92795dd82d6c3f9ff3a85 Mon Sep 17 00:00:00 2001 From: Richard Unger Date: Sun, 17 Dec 2023 11:13:34 +0100 Subject: [PATCH 1/2] fix double constants to be floats --- src/common/base_classes/Sensor.cpp | 2 +- src/common/defaults.h | 2 +- src/common/foc_utils.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/base_classes/Sensor.cpp b/src/common/base_classes/Sensor.cpp index b0a8f4db..db17e92e 100644 --- a/src/common/base_classes/Sensor.cpp +++ b/src/common/base_classes/Sensor.cpp @@ -19,7 +19,7 @@ void Sensor::update() { /** get current angular velocity (rad/s) */ float Sensor::getVelocity() { // calculate sample time - float Ts = (angle_prev_ts - vel_angle_prev_ts)*1e-6; + float Ts = (angle_prev_ts - vel_angle_prev_ts)*1e-6f; if (Ts < 0.0f) { // handle micros() overflow - we need to reset vel_angle_prev_ts vel_angle_prev = angle_prev; vel_full_rotations = full_rotations; diff --git a/src/common/defaults.h b/src/common/defaults.h index c0a46182..ac57daa1 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -43,7 +43,7 @@ // align voltage #define DEF_VOLTAGE_SENSOR_ALIGN 3.0f //!< default voltage for sensor and motor zero alignemt // low pass filter velocity -#define DEF_VEL_FILTER_Tf 0.005 //!< default velocity filter time constant +#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 diff --git a/src/common/foc_utils.cpp b/src/common/foc_utils.cpp index 233bd246..fa937d15 100644 --- a/src/common/foc_utils.cpp +++ b/src/common/foc_utils.cpp @@ -9,7 +9,7 @@ __attribute__((weak)) float _sin(float a){ // 16 bit precision on sine value, 8 bit fractional value for interpolation, 6bit LUT size // resulting precision compared to stdlib sine is 0.00006480 (RMS difference in range -PI,PI for 3217 steps) 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}; - unsigned int i = (unsigned int)(a * (64*4*256.0 /_2PI)); + unsigned int i = (unsigned int)(a * (64*4*256/_2PI)); int t1, t2, frac = i & 0xff; i = (i >> 8) & 0xff; if (i < 64) { From 5f259f7944cc55fe389fffb72b62c3b58e69ec0f Mon Sep 17 00:00:00 2001 From: Richard Unger Date: Sun, 17 Dec 2023 11:13:58 +0100 Subject: [PATCH 2/2] prepare files for next release version --- README.md | 13 ++----------- library.properties | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 75475bec..7d8150d0 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,8 @@ Therefore this is an attempt to: - *Medium-power* BLDC driver (<30Amps): [Arduino SimpleFOCPowerShield ](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield). - See also [@byDagor](https://github.com/byDagor)'s *fully-integrated* ESP32 based board: [Dagor Brushless Controller](https://github.com/byDagor/Dagor-Brushless-Controller) -> NEW RELEASE 📢 : SimpleFOClibrary v2.3.2 -> - Improved [space vector modulation code](https://github.com/simplefoc/Arduino-FOC/pull/309) thanks to [@Candas1](https://github.com/Candas1) -> - Bugfix for stepper motor initialization -> - Bugfix for current sensing when only 2 phase currents available - please re-check your current sense PID tuning -> - Bugfix for teensy3.2 - [#321](https://github.com/simplefoc/Arduino-FOC/pull/321) -> - Added teensy3/4 compile to the github CI using platformio -> - Fix compile issues with recent versions of ESP32 framework -> - Add ADC calibration on STM32 MCUs -> - Bugfix for crash when using ADC2 on ESP32s - [thanks to @mcells](https://github.com/simplefoc/Arduino-FOC/pull/346) -> - Bugfix for renesas PWM on UNO R4 WiFi - [thanks to @facchinm](https://github.com/simplefoc/Arduino-FOC/pull/322) -> - And more bugfixes - see the complete list of 2.3.2 [fixes and PRs](https://github.com/simplefoc/Arduino-FOC/milestone/9?closed=1) +> NEW RELEASE 📢 : SimpleFOClibrary v2.3.3 +> - And more bugfixes - see the complete list of 2.3.3 [fixes and PRs](https://github.com/simplefoc/Arduino-FOC/milestone/10?closed=1) ## Arduino *SimpleFOClibrary* v2.3.2 diff --git a/library.properties b/library.properties index 7242d57c..0a2606b2 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Simple FOC -version=2.3.2 +version=2.3.3 author=Simplefoc maintainer=Simplefoc sentence=A library demistifying FOC for BLDC motors