runger1101001 / Arduino-FOC-dcmotor

MIT License
4 stars 13 forks source link

build error #1

Open asjdf opened 2 years ago

asjdf commented 2 years ago

My board: ESP32

PlatformIO config:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
monitor_speed = 115200
lib_deps = askuric/Simple FOC@^2.2.2
lib_archive = false

Part of my code:

#include <SimpleFOC.h>
#include <sensors/Encoder.h>
#include <DCMotor.h>
#include <drivers/DCDriver2PWM.h>

Some error report I think is useful:

lib/Arduino-FOC-dcmotor/src/drivers/DCDriver1PWM.cpp:29:9: error: '_writeDutyCycle1PWM' was not declared in this scope
         _writeDutyCycle1PWM(U, params);
         ^~~~~~~~~~~~~~~~~~~
lib/Arduino-FOC-dcmotor/src/drivers/DCDriver1PWM.cpp:36:9: error: '_writeDutyCycle1PWM' was not declared in this scope
         _writeDutyCycle1PWM(U, params);
         ^~~~~~~~~~~~~~~~~~~
lib/Arduino-FOC-dcmotor/src/drivers/DCDriver1PWM.cpp:38:9: error: '_writeDutyCycle1PWM' was not declared in this scope
         _writeDutyCycle1PWM(threshold, params);
         ^~~~~~~~~~~~~~~~~~~
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp: In member function 'virtual int DCDriverSpeedDir::init()':
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp:22:14: error: '_configure1PWM' was not declared in this scope
     params = _configure1PWM(pwm_frequency, pinPWM);
              ^~~~~~~~~~~~~~
lib/Arduino-FOC-dcmotor/src/drivers/DCDriver1PWM.cpp:38:9: note: suggested alternative: '_writeDutyCycle6PWM'
         _writeDutyCycle1PWM(threshold, params);
         ^~~~~~~~~~~~~~~~~~~
         _writeDutyCycle6PWM
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp:22:14: note: suggested alternative: '_configure6PWM'
     params = _configure1PWM(pwm_frequency, pinPWM);
              ^~~~~~~~~~~~~~
              _configure6PWM
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp: In member function 'virtual void DCDriverSpeedDir::setPwm(float)':
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp:33:9: error: '_writeDutyCycle1PWM' was not declared in this scope
         _writeDutyCycle1PWM(U, params);
         ^~~~~~~~~~~~~~~~~~~
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp:38:9: error: '_writeDutyCycle1PWM' was not declared in this scope
         _writeDutyCycle1PWM(U, params);
         ^~~~~~~~~~~~~~~~~~~
lib/Arduino-FOC-dcmotor/src/drivers/DCDriverSpeedDir.cpp:41:9: error: '_writeDutyCycle1PWM' was not declared in this scope
asjdf commented 2 years ago

I temporarily solved the problem. There is only 2, 3, 4, 6 PWM in esp32_mcu.cpp And only 2, 3, 4 PWM in esp32_ledc_mcu.cpp

So I temporarily delete DCDriver1PWM.cpp,DCDriver1PWM.cpp,DCDriverSpeedDir.cpp and DCDriverSpeedDir.h

runger1101001 commented 2 years ago

Thanks for noting this.

Please note that to use this code at the moment you have to use the dev branch of SimpleFOC library, not the release version.

You are quite right, the 1-PWM mode used by most of the DC driver classes is not yet implemented on ESP32 MCPWM mode. But its implemented in the LEDC driver.

You can try using the dev branch of the SimpleFOC library, with the following option in your platformio.ini:

build_flags = -DSIMPLEFOC_ESP32_USELEDC

asjdf commented 2 years ago

Thanks for noting this.

Please note that to use this code at the moment you have to use the dev branch of SimpleFOC library, not the release version.

You are quite right, the 1-PWM mode used by most of the DC driver classes is not yet implemented on ESP32 MCPWM mode.

But its implemented in the LEDC driver.

You can try using the dev branch of the SimpleFOC library, with the following option in your platformio.ini:

build_flags = -DSIMPLEFOC_ESP32_USELEDC

Thanks for your reply and I will try it later.🥰