Skip to content

Commit 29cb4d0

Browse files
Merge pull request #330 from runger1101001/dev
Fix ESP32 compilation problems
2 parents 1a8296a + f39aa92 commit 29cb4d0

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

.github/workflows/ccpp.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ jobs:
5858
sketch-names: single_full_control_example.ino
5959

6060
- arduino-boards-fqbn: esp32:esp32:esp32s2 # esp32s2
61-
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
62-
sketch-names: bldc_driver_3pwm_standalone.ino, stepper_driver_2pwm_standalone.ino, stepper_driver_4pwm_standalone
61+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
62+
sketch-names: bldc_driver_3pwm_standalone.ino,stepper_driver_2pwm_standalone.ino,stepper_driver_4pwm_standalone.ino
6363

6464
- arduino-boards-fqbn: esp32:esp32:esp32s3 # esp32s3
65-
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
65+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
6666
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino
6767

6868
- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
69-
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
69+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
7070
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, esp32_current_control_low_side.ino, esp32_spi_alt_example.ino
7171

7272
- arduino-boards-fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 # bluepill - hs examples

src/common/foc_utils.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,10 @@ float _electricalAngle(float shaft_angle, int pole_pairs) {
8787
// https://reprap.org/forum/read.php?147,219210
8888
// https://en.wikipedia.org/wiki/Fast_inverse_square_root
8989
__attribute__((weak)) float _sqrtApprox(float number) {//low in fat
90-
// float x;
91-
// const float f = 1.5F; // better precision
92-
93-
// x = number * 0.5F;
94-
float y = number;
95-
long i = * ( long * ) &y;
96-
i = 0x5f375a86 - ( i >> 1 );
97-
y = * ( float * ) &i;
98-
// y = y * ( f - ( x * y * y ) ); // better precision
99-
return number * y;
90+
union {
91+
float f;
92+
uint32_t i;
93+
} y = { .f = number };
94+
y.i = 0x5f375a86 - ( y.i >> 1 );
95+
return number * y.f;
10096
}

src/current_sense/hardware_specific/esp32/esp32_adc_driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#include "freertos/task.h"
77
#include "rom/ets_sys.h"
88
#include "esp_attr.h"
9-
#include "esp_intr.h"
9+
//#include "esp_intr.h" deprecated
10+
#include "esp_intr_alloc.h"
1011
#include "soc/rtc_io_reg.h"
1112
#include "soc/rtc_cntl_reg.h"
1213
#include "soc/sens_reg.h"

src/current_sense/hardware_specific/esp32/esp32_mcu.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ void _driverSyncLowSide(void* driver_params, void* cs_params){
121121
mcpwm_isr_register(mcpwm_unit, mcpwm1_isr_handler, NULL, ESP_INTR_FLAG_IRAM, NULL); //Set ISR Handler
122122
}
123123

124+
static void IRAM_ATTR mcpwm0_isr_handler(void*) __attribute__ ((unused));
125+
124126
// Read currents when interrupt is triggered
125127
static void IRAM_ATTR mcpwm0_isr_handler(void*){
126128
// // high side
@@ -139,6 +141,7 @@ static void IRAM_ATTR mcpwm0_isr_handler(void*){
139141
// MCPWM0.int_clr.timer0_tez_int_clr = mcpwm_intr_status_0;
140142
}
141143

144+
static void IRAM_ATTR mcpwm1_isr_handler(void*) __attribute__ ((unused));
142145

143146
// Read currents when interrupt is triggered
144147
static void IRAM_ATTR mcpwm1_isr_handler(void*){

0 commit comments

Comments
 (0)