Skip to content

Commit 3068477

Browse files
committed
fix(esp_simplefoc): init local driver structs to avoid opt issue
close #499
1 parent 5150ca1 commit 3068477

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

components/motor/esp_simplefoc/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ChangeLog
22

3+
## v1.2.1 - 2025-4-15
4+
5+
### Bug Fix:
6+
* FOC:
7+
* Fix uninitialized local driver struct variables causing assignment issues under compiler optimization.
8+
39
## v1.2.0 - 2024-12-31
410
### Enhancements:
511
* FOC:

components/motor/esp_simplefoc/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1.2.0
1+
version: 1.2.1
22
targets:
33
- esp32
44
- esp32s2

components/motor/esp_simplefoc/port/angle_sensor/as5600.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ AS5600::~AS5600()
2727

2828
void AS5600::init()
2929
{
30-
i2c_config_t conf;
30+
i2c_config_t conf = {};
3131
conf.mode = I2C_MODE_MASTER;
3232
conf.sda_io_num = _sda_io;
3333
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;

components/motor/esp_simplefoc/port/esp/esp_hal_bldc_3pwm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ int BLDCDriver3PWM::init()
365365

366366
int pins[3] = {pwmA, pwmB, pwmC}; // save pins
367367

368-
ledc_channel_config_t ledc_channel;
368+
ledc_channel_config_t ledc_channel = {};
369369
for (int i = 0; i < 3; i++) {
370370
ledc_channel.speed_mode = _LEDC_MODE;
371371
ledc_channel.timer_sel = LEDC_TIMER_0;
@@ -524,7 +524,7 @@ int BLDCDriver3PWM::init(std::vector<int> _ledc_channels)
524524

525525
int pins[3] = {pwmA, pwmB, pwmC}; // save pins
526526

527-
ledc_channel_config_t ledc_channel;
527+
ledc_channel_config_t ledc_channel = {};
528528
for (int i = 0; i < 3; i++) {
529529
ledc_channel.speed_mode = _LEDC_MODE;
530530
ledc_channel.timer_sel = LEDC_TIMER_0;

components/motor/esp_simplefoc/port/esp/esp_hal_serial.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ HardwareSerial::HardwareSerial()
1616
_rtsPin = -1;
1717
_rxBufferSize = 256;
1818
_txBufferSize = 0;
19+
_uart_config = {};
1920
}
2021

2122
HardwareSerial::~HardwareSerial()

0 commit comments

Comments
 (0)