Skip to content

Commit

Permalink
Renamed function setDegreeForAllServos() to setIntegerDegreeForAllSer…
Browse files Browse the repository at this point in the history
…vos() and added function setFloatDegreeForAllServos()
  • Loading branch information
ArminJo committed Mar 5, 2023
1 parent b8f38eb commit d2bfb44
Show file tree
Hide file tree
Showing 25 changed files with 69 additions and 30 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/LibraryBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ jobs:
with:
library-manager: update

# See: https://github.com/codespell-project/actions-codespell/blob/master/README.md
- name: Spell check
uses: codespell-project/actions-codespell@master
with:
only_warn: 1

- name: Compile all examples using the arduino-test-compile action
uses: ArminJo/arduino-test-compile@master
with:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ This will print internal information visible in the Arduino *Serial Monitor* whi
<br/>

# Revision History
### Version 3.2.1
- Renamed function `setDegreeForAllServos()` to `setIntegerDegreeForAllServos()` and added function `setFloatDegreeForAllServos()`.

### Version 3.2.0
- ATmega4808 support added.
- Added function `getCurrentMicroseconds()`.
Expand Down
2 changes: 1 addition & 1 deletion examples/AsymmetricEasing/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/CatMover/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Note, that Back and Elastic are not totally visible at your servo, since they use angels above 180 and below 0 degree in this example.
* It uses a callback handler and specification arrays to generate the movement cycle.
*
* Copyright (C) 2022 Armin Joachimsmeyer
* Copyright (C) 2022-2023 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/ContinuousRotatingServo/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/EndPositionsTest/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/LightweightServoExample/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/OneServo/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/PCA9685_Expander/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/PCA9685_ExpanderAndServo/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/PrecisionEasing/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/Simple/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
4 changes: 2 additions & 2 deletions examples/Simple/Simple.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ void setup() {

void loop() {
Serial.println(F("Move to 135 degree with 40 degree per second blocking"));
Servo1.easeTo(135, 40); // Blocking call
Servo1.easeTo(135, 40); // Blocking call, runs on all platforms

Serial.println(F("Move to 45 degree with 40 degree per second blocking"));
Servo1.easeTo(45, 40); // Blocking call
Servo1.easeTo(45, 40); // Blocking call, runs on all platforms
delay(1000);
}

2 changes: 1 addition & 1 deletion examples/SimpleCallback/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/SpeedTest/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/SymmetricEasing/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/ThreeServos/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion examples/TwoServos/PinDefinitionsAndMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Contains SERVO*_PIN definitions for ServoEasing examples for various platforms
* as well as includes and definitions for LED_BUILTIN
*
* Copyright (C) 2020-2022 Armin Joachimsmeyer
* Copyright (C) 2020-20232 Armin Joachimsmeyer
* [email protected]
*
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/ArminJo/ServoEasing"
},
"version": "3.2.0",
"version": "3.2.1",
"exclude": "pictures",
"authors": {
"name": "Armin Joachimsmeyer",
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=ServoEasing
version=3.2.0
version=3.2.1
author=Armin Joachimsmeyer
maintainer=Armin Joachimsmeyer <[email protected]>
sentence=Enables smooth servo movement. <br/>Linear as well as other (Cubic, Circular, Bounce, etc.) ease movements for servos are provided. The Arduino Servo library or PCA9685 servo expanders are supported.<br/>
paragraph=Just use <b>myServo.easeTo()</b> instead of <b>myServo.write()</b> and you have smooth servo movement.<br/><b>Non blocking</b> movement for all servos attached to the Arduino Servo library is implemented by reusing the interrupts of the Arduino servo timer.<br/><b>All servos can move synchronized.</b><br/><br/>Includes the following <b>easing functions</b>:<ul><li><b>Linear</b>, <b>Quadratic</b>, <b>Cubic</b> and <b>Quartic</b></li><li><b>Sine</b>, <b>Circular</b>, <b>Back</b>, <b>Elastic</b> and <b>Bounce</b></li><li><b>Precision</b>, <b>Dummy</b> and <b>User defined</b></li></ul>Each function supports the <b>easing types</b> <b>In</b>, <b>Out</b>, <b>InOut</b> and <b>BouncingOutIn</b><br/>Trim and reverse operations are supported as well as continuous rotating servos.<br/><br/><b>New: </b>ATmega4808 support added.<br/><a href="https://github.com/ArminJo/ServoEasing#revision-history">Revision History</a><br/>
paragraph=Just use <b>myServo.easeTo()</b> instead of <b>myServo.write()</b> and you have smooth servo movement.<br/><b>Non blocking</b> movement for all servos attached to the Arduino Servo library is implemented by reusing the interrupts of the Arduino servo timer.<br/><b>All servos can move synchronized.</b><br/><br/>Includes the following <b>easing functions</b>:<ul><li><b>Linear</b>, <b>Quadratic</b>, <b>Cubic</b> and <b>Quartic</b></li><li><b>Sine</b>, <b>Circular</b>, <b>Back</b>, <b>Elastic</b> and <b>Bounce</b></li><li><b>Precision</b>, <b>Dummy</b> and <b>User defined</b></li></ul>Each function supports the <b>easing types</b> <b>In</b>, <b>Out</b>, <b>InOut</b> and <b>BouncingOutIn</b><br/>Trim and reverse operations are supported as well as continuous rotating servos.<br/><br/><b>New: </b>Added function setFloatDegreeForAllServos().<br/><a href="https://github.com/ArminJo/ServoEasing#revision-history">Revision History</a><br/>
category=Device Control
url=https://github.com/ArminJo/ServoEasing
architectures=avr,megaavr,sam,samd,esp8266,esp32,stm32,STM32F1,apollo3,mbed,mbed_nano,rp2040
Expand Down
10 changes: 8 additions & 2 deletions src/ServoEasing.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,13 @@ class ServoEasing
void writeAllServos(int aTargetDegreeOrMicrosecond);
void setSpeedForAllServos(uint_fast16_t aDegreesPerSecond);
#if defined(va_arg)
void setDegreeForAllServos(uint_fast8_t aNumberOfValues, va_list *aDegreeValues);
void setIntegerDegreeForAllServos(uint_fast8_t aNumberOfValues, va_list *aDegreeValues);
void setFloatDegreeForAllServos(uint_fast8_t aNumberOfValues, va_list *aDegreeValues);
#endif
#if defined(va_start)
void setDegreeForAllServos(uint_fast8_t aNumberOfValues, ...);
void setDegreeForAllServos(uint_fast8_t aNumberOfValues, ...) __attribute__ ((deprecated ("Please use setIntegerDegreeForAllServos().")));
void setIntegerDegreeForAllServos(uint_fast8_t aNumberOfValues, ...);
void setFloatDegreeForAllServos(uint_fast8_t aNumberOfValues, ...);
#endif

bool setEaseToForAllServos();
Expand Down Expand Up @@ -734,6 +737,9 @@ bool checkI2CConnection(uint8_t aI2CAddress, Stream *aSerial); // Print class ha
#endif

/*
* Version 3.2.1 - 03/2023
* - Renamed function `setDegreeForAllServos()` to `setIntegerDegreeForAllServos()` and added function `setFloatDegreeForAllServos()`.
*
* Version 3.2.0 - 02/2023
* - ATmega4808 support added.
* - Added function `getCurrentMicroseconds()`.
Expand Down
34 changes: 29 additions & 5 deletions src/ServoEasing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2293,23 +2293,47 @@ void setSpeedForAllServos(uint_fast16_t aDegreesPerSecond) {

#if defined(va_arg)
/**
* Sets the ServoEasingNextPositionArray[] of the first aNumberOfServos to the specified values
* Sets the ServoEasingNextPositionArray[] of the first aNumberOfServos to the specified integer values
*/
void setDegreeForAllServos(uint_fast8_t aNumberOfServos, va_list *aDegreeValues) {
void setIntegerDegreeForAllServos(uint_fast8_t aNumberOfServos, va_list *aDegreeValues) {
for (uint_fast8_t tServoIndex = 0; tServoIndex < aNumberOfServos; ++tServoIndex) {
ServoEasing::ServoEasingNextPositionArray[tServoIndex] = va_arg(*aDegreeValues, int);
}
}
/**
* Sets the ServoEasingNextPositionArray[] of the first aNumberOfServos to the specified float values
*/
void setFloatDegreeForAllServos(uint_fast8_t aNumberOfServos, va_list *aDegreeValues) {
for (uint_fast8_t tServoIndex = 0; tServoIndex < aNumberOfServos; ++tServoIndex) {
ServoEasing::ServoEasingNextPositionArray[tServoIndex] = va_arg(*aDegreeValues, double);
}
}
#endif

#if defined(va_start)
/**
* Sets the ServoEasingNextPositionArray[] of the first aNumberOfServos to the specified values
* Sets the ServoEasingNextPositionArray[] of the first aNumberOfServos to the specified integer values
*/
void setDegreeForAllServos(uint_fast8_t aNumberOfServos, ...) {
va_list aDegreeValues;
va_start(aDegreeValues, aNumberOfServos);
setDegreeForAllServos(aNumberOfServos, &aDegreeValues);
setIntegerDegreeForAllServos(aNumberOfServos, &aDegreeValues);
va_end(aDegreeValues);
}

void setIntegerDegreeForAllServos(uint_fast8_t aNumberOfServos, ...) {
va_list aDegreeValues;
va_start(aDegreeValues, aNumberOfServos);
setIntegerDegreeForAllServos(aNumberOfServos, &aDegreeValues);
va_end(aDegreeValues);
}
/**
* Sets the ServoEasingNextPositionArray[] of the first aNumberOfServos to the specified float values
*/
void setFloatDegreeForAllServos(uint_fast8_t aNumberOfServos, ...) {
va_list aDegreeValues;
va_start(aDegreeValues, aNumberOfServos);
setFloatDegreeForAllServos(aNumberOfServos, &aDegreeValues);
va_end(aDegreeValues);
}
#endif
Expand Down Expand Up @@ -2706,7 +2730,7 @@ bool ServoEasing::InitializeAndCheckI2CConnection(Stream *aSerial) // Print has
#if defined(__AVR__)
bool checkI2CConnection(uint8_t aI2CAddress, Print *aSerial) // Print instead of Stream saves 95 bytes flash
#else
bool checkI2CConnection(uint8_t aI2CAddress, Stream *aSerial) // Print has no flush()
bool checkI2CConnection(uint8_t aI2CAddress, Stream *aSerial) // Print has no flush(), so we must take Stream
#endif
{

Expand Down

0 comments on commit d2bfb44

Please sign in to comment.