Skip to content

Commit

Permalink
Merge pull request #330 from runger1101001/dev
Browse files Browse the repository at this point in the history
Fix ESP32 compilation problems
  • Loading branch information
runger1101001 authored Oct 30, 2023
2 parents 1a8296a + f39aa92 commit 29cb4d0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ jobs:
sketch-names: single_full_control_example.ino

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

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

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

- arduino-boards-fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 # bluepill - hs examples
Expand Down
16 changes: 6 additions & 10 deletions src/common/foc_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,10 @@ float _electricalAngle(float shaft_angle, int pole_pairs) {
// https://reprap.org/forum/read.php?147,219210
// https://en.wikipedia.org/wiki/Fast_inverse_square_root
__attribute__((weak)) float _sqrtApprox(float number) {//low in fat
// float x;
// const float f = 1.5F; // better precision

// x = number * 0.5F;
float y = number;
long i = * ( long * ) &y;
i = 0x5f375a86 - ( i >> 1 );
y = * ( float * ) &i;
// y = y * ( f - ( x * y * y ) ); // better precision
return number * y;
union {
float f;
uint32_t i;
} y = { .f = number };
y.i = 0x5f375a86 - ( y.i >> 1 );
return number * y.f;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "freertos/task.h"
#include "rom/ets_sys.h"
#include "esp_attr.h"
#include "esp_intr.h"
//#include "esp_intr.h" deprecated
#include "esp_intr_alloc.h"
#include "soc/rtc_io_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_reg.h"
Expand Down
3 changes: 3 additions & 0 deletions src/current_sense/hardware_specific/esp32/esp32_mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ void _driverSyncLowSide(void* driver_params, void* cs_params){
mcpwm_isr_register(mcpwm_unit, mcpwm1_isr_handler, NULL, ESP_INTR_FLAG_IRAM, NULL); //Set ISR Handler
}

static void IRAM_ATTR mcpwm0_isr_handler(void*) __attribute__ ((unused));

// Read currents when interrupt is triggered
static void IRAM_ATTR mcpwm0_isr_handler(void*){
// // high side
Expand All @@ -139,6 +141,7 @@ static void IRAM_ATTR mcpwm0_isr_handler(void*){
// MCPWM0.int_clr.timer0_tez_int_clr = mcpwm_intr_status_0;
}

static void IRAM_ATTR mcpwm1_isr_handler(void*) __attribute__ ((unused));

// Read currents when interrupt is triggered
static void IRAM_ATTR mcpwm1_isr_handler(void*){
Expand Down

0 comments on commit 29cb4d0

Please sign in to comment.