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

408 feature support for arduino esp32 v301 current sensing #414

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
93bcfe0
use current sensing only if mpcpwm used and force LEDC for now
askuric Jun 7, 2024
8e8ffb2
adde the center-aligend ledc driver - enables 6pwm
askuric Jun 7, 2024
ae4df18
forgotten star
askuric Jun 7, 2024
26d111d
added the 6wpm driver
askuric Jun 8, 2024
ee91e27
removed the forced ledc
askuric Jun 8, 2024
53624e4
added the inital support for new mcpwm driver
askuric Jun 10, 2024
e221e06
disable current sensing
askuric Jun 10, 2024
a7ed4ba
an initial implementation of the lowside and inline current sense wit…
askuric Jun 15, 2024
ab64524
forgotten import
askuric Jun 16, 2024
aa8591e
Revert "an initial implementation of the lowside and inline current s…
askuric Jun 16, 2024
5d4187a
added the current sensing + phase state for driver
askuric Jun 16, 2024
4c25ef0
forgotten mcpwm ifdef
askuric Jun 16, 2024
67248d8
forgotten return statement change in stm32
askuric Jun 16, 2024
69eb707
forgotten bluepill
askuric Jun 16, 2024
bbd8017
added the support for phase state for 6pwm in haredware-6pwm mode + r…
askuric Jun 20, 2024
63fda20
added workflow or s2
askuric Jun 20, 2024
52e8d9d
added the support for esp32s3 to read all the current phases in one i…
askuric Jun 21, 2024
910c24f
forgotten change for bg431
askuric Jun 21, 2024
2200504
s3 bugfix - it cannot read faster than 10us per adc sample
askuric Jun 21, 2024
e92567e
bugfix for #295 and #320 + added #346
askuric Jun 21, 2024
0b367c3
refactured esp32 fast adc driver - simplified a lot
askuric Jun 21, 2024
d89fa26
added the error debugging
askuric Jun 21, 2024
710edb4
more refactoring of the current sensing
askuric Jun 21, 2024
bc2f848
typo in debug macro
askuric Jun 21, 2024
a1bd20e
say the pin name if the generator fails
askuric Jun 22, 2024
8ce92e0
restructured imports
askuric Jun 22, 2024
a734d0d
typo in the defines
askuric Jun 22, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- esp32:esp32:esp32doit-devkit-v1 # esp32
- esp32:esp32:esp32s2 # esp32s2
- esp32:esp32:esp32s3 # esp32s3
- esp32:esp32:esp32c3 # esp32c3

include:

Expand All @@ -30,6 +31,10 @@ jobs:
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:esp32c3 # esp32c3
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, stepper_driver_2pwm_standalone.ino, stepper_driver_4pwm_standalone.ino

- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
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
Expand Down
15 changes: 15 additions & 0 deletions src/communication/SimpleFOCDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void SimpleFOCDebug::println(const __FlashStringHelper* str) {
}
}


void SimpleFOCDebug::println(const char* str, float val) {
if (_debugPrint != NULL) {
_debugPrint->print(str);
Expand Down Expand Up @@ -86,6 +87,20 @@ void SimpleFOCDebug::print(const __FlashStringHelper* str) {
}
}

void SimpleFOCDebug::print(const StringSumHelper str) {
if (_debugPrint != NULL) {
_debugPrint->print(str.c_str());
}
}


void SimpleFOCDebug::println(const StringSumHelper str) {
if (_debugPrint != NULL) {
_debugPrint->println(str.c_str());
}
}



void SimpleFOCDebug::print(int val) {
if (_debugPrint != NULL) {
Expand Down
4 changes: 3 additions & 1 deletion src/communication/SimpleFOCDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
**/


#ifndef SIMPLEFOC_DISABLE_DEBUG
#ifndef SIMPLEFOC_DISABLE_DEBUG

class SimpleFOCDebug {
public:
static void enable(Print* debugPrint = &Serial);

static void println(const __FlashStringHelper* msg);
static void println(const StringSumHelper msg);
static void println(const char* msg);
static void println(const __FlashStringHelper* msg, float val);
static void println(const char* msg, float val);
Expand All @@ -52,6 +53,7 @@ class SimpleFOCDebug {

static void print(const char* msg);
static void print(const __FlashStringHelper* msg);
static void print(const StringSumHelper msg);
static void print(int val);
static void print(float val);

Expand Down
3 changes: 2 additions & 1 deletion src/current_sense/LowsideCurrentSense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ int LowsideCurrentSense::init(){
// if init failed return fail
if (params == SIMPLEFOC_CURRENT_SENSE_INIT_FAILED) return 0;
// sync the driver
_driverSyncLowSide(driver->params, params);
void* r = _driverSyncLowSide(driver->params, params);
if(r == SIMPLEFOC_CURRENT_SENSE_INIT_FAILED) return 0;
// calibrate zero offsets
calibrateOffsets();
// set the initialized flag
Expand Down
5 changes: 4 additions & 1 deletion src/current_sense/hardware_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ float _readADCVoltageLowSide(const int pinA, const void* cs_params);
* function syncing the Driver with the ADC for the LowSide Sensing
* @param driver_params - driver parameter structure - hardware specific
* @param cs_params - current sense parameter structure - hardware specific
*
* @return void* - returns the pointer to the current sense parameter structure (unchanged)
* - returns SIMPLEFOC_CURRENT_SENSE_INIT_FAILED if the init fails
*/
void _driverSyncLowSide(void* driver_params, void* cs_params);
void* _driverSyncLowSide(void* driver_params, void* cs_params);

#endif
Loading
Loading