Skip to content

Commit 9281dce

Browse files
committed
Merge branch 'dev' of https://github.com/simplefoc/Arduino-FOC into dev
2 parents 87ea185 + 538e59d commit 9281dce

30 files changed

+1650
-1830
lines changed

.github/workflows/esp32.yml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- esp32:esp32:esp32doit-devkit-v1 # esp32
2020
- esp32:esp32:esp32s2 # esp32s2
2121
- esp32:esp32:esp32s3 # esp32s3
22+
- esp32:esp32:esp32c3 # esp32c3
2223

2324
include:
2425

@@ -30,6 +31,10 @@ jobs:
3031
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
3132
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino
3233

34+
- arduino-boards-fqbn: esp32:esp32:esp32c3 # esp32c3
35+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
36+
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, stepper_driver_2pwm_standalone.ino, stepper_driver_4pwm_standalone.ino
37+
3338
- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
3439
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
3540
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, esp32_current_control_low_side.ino, esp32_spi_alt_example.ino

src/communication/SimpleFOCDebug.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void SimpleFOCDebug::println(const __FlashStringHelper* str) {
3838
}
3939
}
4040

41+
4142
void SimpleFOCDebug::println(const char* str, float val) {
4243
if (_debugPrint != NULL) {
4344
_debugPrint->print(str);
@@ -86,6 +87,20 @@ void SimpleFOCDebug::print(const __FlashStringHelper* str) {
8687
}
8788
}
8889

90+
void SimpleFOCDebug::print(const StringSumHelper str) {
91+
if (_debugPrint != NULL) {
92+
_debugPrint->print(str.c_str());
93+
}
94+
}
95+
96+
97+
void SimpleFOCDebug::println(const StringSumHelper str) {
98+
if (_debugPrint != NULL) {
99+
_debugPrint->println(str.c_str());
100+
}
101+
}
102+
103+
89104

90105
void SimpleFOCDebug::print(int val) {
91106
if (_debugPrint != NULL) {

src/communication/SimpleFOCDebug.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
**/
3434

3535

36-
#ifndef SIMPLEFOC_DISABLE_DEBUG
36+
#ifndef SIMPLEFOC_DISABLE_DEBUG
3737

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

4242
static void println(const __FlashStringHelper* msg);
43+
static void println(const StringSumHelper msg);
4344
static void println(const char* msg);
4445
static void println(const __FlashStringHelper* msg, float val);
4546
static void println(const char* msg, float val);
@@ -52,6 +53,7 @@ class SimpleFOCDebug {
5253

5354
static void print(const char* msg);
5455
static void print(const __FlashStringHelper* msg);
56+
static void print(const StringSumHelper msg);
5557
static void print(int val);
5658
static void print(float val);
5759

src/current_sense/LowsideCurrentSense.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ int LowsideCurrentSense::init(){
4747
// if init failed return fail
4848
if (params == SIMPLEFOC_CURRENT_SENSE_INIT_FAILED) return 0;
4949
// sync the driver
50-
_driverSyncLowSide(driver->params, params);
50+
void* r = _driverSyncLowSide(driver->params, params);
51+
if(r == SIMPLEFOC_CURRENT_SENSE_INIT_FAILED) return 0;
5152
// calibrate zero offsets
5253
calibrateOffsets();
5354
// set the initialized flag

src/current_sense/hardware_api.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ float _readADCVoltageLowSide(const int pinA, const void* cs_params);
5959
* function syncing the Driver with the ADC for the LowSide Sensing
6060
* @param driver_params - driver parameter structure - hardware specific
6161
* @param cs_params - current sense parameter structure - hardware specific
62+
*
63+
* @return void* - returns the pointer to the current sense parameter structure (unchanged)
64+
* - returns SIMPLEFOC_CURRENT_SENSE_INIT_FAILED if the init fails
6265
*/
63-
void _driverSyncLowSide(void* driver_params, void* cs_params);
66+
void* _driverSyncLowSide(void* driver_params, void* cs_params);
6467

6568
#endif

0 commit comments

Comments
 (0)