Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compile errors for SimpleFOC 2.3.1 #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions firmware/src/motor_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ void MotorTask::run() {

PB_PersistentConfiguration c = configuration_.get();
motor.pole_pairs = c.motor.calibrated ? c.motor.pole_pairs : 7;
motor.initFOC(c.motor.zero_electrical_offset, c.motor.direction_cw ? Direction::CW : Direction::CCW);
motor.zero_electric_angle = c.motor.zero_electrical_offset;
motor.sensor_direction = c.motor.direction_cw ? Direction::CW : Direction::CCW;
motor.initFOC();

motor.monitor_downsample = 0; // disable monitor at first - optional

Expand Down Expand Up @@ -354,7 +356,9 @@ void MotorTask::calibrate() {

motor.controller = MotionControlType::angle_openloop;
motor.pole_pairs = 1;
motor.initFOC(0, Direction::CW);
motor.zero_electric_angle = 0;
motor.sensor_direction = Direction::CW;
motor.initFOC();

float a = 0;

Expand Down Expand Up @@ -397,10 +401,14 @@ void MotorTask::calibrate() {
log("Sensor measures positive for positive motor rotation:");
if (end_sensor > start_sensor) {
log("YES, Direction=CW");
motor.initFOC(0, Direction::CW);
motor.zero_electric_angle = 0;
motor.sensor_direction = Direction::CW;
motor.initFOC();
} else {
log("NO, Direction=CCW");
motor.initFOC(0, Direction::CCW);
motor.zero_electric_angle = 0;
motor.sensor_direction = Direction::CCW;
motor.initFOC();
}
snprintf(buf_, sizeof(buf_), " (start was %.1f, end was %.1f)", start_sensor, end_sensor);
log(buf_);
Expand Down
6 changes: 3 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_dir = firmware/test
data_dir = firmware/data

[base_config]
platform = espressif32@3.4
platform = espressif32@6.4.0
framework = arduino
monitor_speed = 921600
monitor_flags =
Expand All @@ -43,7 +43,7 @@ board = esp32doit-devkit-v1
board_build.partitions = default_ffat.csv
lib_deps =
${base_config.lib_deps}
askuric/Simple FOC @ 2.2.0
askuric/Simple FOC @ 2.3.1
bodmer/[email protected]
fastled/FastLED @ 3.5.0
bogde/HX711 @ 0.7.5
Expand Down Expand Up @@ -134,7 +134,7 @@ board = adafruit_feather_esp32s3
board_build.partitions = firmware/partitions-4MB-fat.csv
lib_deps =
${base_config.lib_deps}
askuric/Simple [email protected].0
askuric/Simple [email protected].1
bodmer/[email protected]

build_flags =
Expand Down