From 0252d307a1c04e19bffa6b7634c869be2d1b9112 Mon Sep 17 00:00:00 2001 From: Richard Unger Date: Sun, 21 Jul 2024 23:23:45 +0200 Subject: [PATCH 1/2] make DCMotor.init() return int indicating success --- src/DCMotor.cpp | 7 ++++--- src/DCMotor.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/DCMotor.cpp b/src/DCMotor.cpp index 451e13a..e5491ce 100644 --- a/src/DCMotor.cpp +++ b/src/DCMotor.cpp @@ -15,16 +15,16 @@ void DCMotor::linkDriver(DCDriver* driver) { }; -void DCMotor::init() { +int DCMotor::init() { if (!driver || !driver->initialized) { motor_status = FOCMotorStatus::motor_init_failed; SIMPLEFOC_DEBUG("MOT: Init not possible, driver not initialized"); - return; + return 0; } if (!sensor) { motor_status = FOCMotorStatus::motor_init_failed; SIMPLEFOC_DEBUG("MOT: Init not possible, sensor not initialized"); - return; + return 0; } motor_status = FOCMotorStatus::motor_initializing; @@ -62,6 +62,7 @@ void DCMotor::init() { } motor_status = FOCMotorStatus::motor_ready; + return 1; }; diff --git a/src/DCMotor.h b/src/DCMotor.h index 2adec5a..9d4a7ef 100644 --- a/src/DCMotor.h +++ b/src/DCMotor.h @@ -31,7 +31,7 @@ class DCMotor : public FOCMotor { DCDriver* driver; /** Motor hardware init function */ - void init() override; + int init() override; /** Motor disable function */ void disable() override; /** Motor enable function */ From 0d2b68ce50ff80609272ca3f9677dd354ec84ffa Mon Sep 17 00:00:00 2001 From: Richard Unger Date: Sun, 21 Jul 2024 23:25:41 +0200 Subject: [PATCH 2/2] updates for 1.0.3 release --- README.md | 2 +- library.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98d5e76..cbe9b43 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![Release](https://www.ardu-badge.com/badge/SimpleDCMotor.svg?) -Release 1.0.2 for SimpleFOC 2.3.1 or later +Release 1.0.3 for SimpleFOC 2.3.4 or later :warning: code in development! Please help us test it! diff --git a/library.properties b/library.properties index 4754ea2..2a70046 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SimpleDCMotor -version=1.0.2 +version=1.0.3 author=Simplefoc maintainer=Simplefoc sentence=A library enabling DC motor control with SimpleFOC.