Skip to content

Release 0.3.0

Compare
Choose a tag to compare
@theelims theelims released this 15 Jan 22:38
· 10 commits to main since this release

Changes

  • set and get functions for maximum speed and maximum acceleration. Allows to change these limits during runtime.
  • Renamed #define DEBUG_VERBOSE to #define DEBUG_TALKATIVE to make StrokeEngine play nice with WifiManager.
  • Removed state ERROR from state machine. After tests with the servo this has become pointless. disable() and homing will clear any error state.
  • Fixed bug with missing implementation of inverted direction signal: #3
  • Added an improved pause handling mechanism to pattern:
    • removed void patternDelay(int milliseconds) function as unfit for the purpose.
    • Pattern-Class has 3 private functions void _startDelay(), void _updateDelay(int delayInMillis) and bool _isStillDelayed() to add an internal delay function based on comparing millis().
    • A pattern can request StrokeEngine to skip the current motion command by returning _nextMove.skip = true;.
  • Steps per mm, speed and acceleration limits are available inside pattern, now.
  • Refactored code to improve thread safety:
    • Pinned the working threads to the application core 1.
    • During state PATTERN only the _stroking()-Thread communicates with the FastAccelStepper library. Mid-stroke parameter updates only set a flag for the _stroking()-Thread to query the pattern for an updated motion calculation.
    • All accesses to a pattern that influence it's internal states (set-functions & nextTarget()) are made thread safe and guarded by a mutex.
    • Function applyNewSettingsNow() had to disappear. Set-functions got an additional bool applyNow to apply the changes immediately. Value defaults to false which means changes take effect only with the next stroke.
  • It is now possible to receive telemetry information's about each trapezoidal motion a pattern generates. You may register a callback function void registerTelemetryCallback(void(*callbackTelemetry)(float, float, bool)) with the following signature void callbackTelemetry(float position, float speed, bool clipping).
  • New pattern available:
    • Stop'n'Go
    • Insist
    • Jack Hammer
    • Stroke Nibble

Update Notes

Mid-Stroke Parameter Updates

The function applyNewSettingsNow() had to disappear to make the code thread safe. However, all set-functions got an additional parameter applyNow of type bool to apply the changes immediately. This parameter defaults to false which means changes take effect only with the next stroke. To get the same functionality as calling applyNewSettingsNow() append true as the last parameter in all set-function calls.

Stroker.setSpeed(float speed, bool applyNow);          // Speed in Cycles (in & out) per minute, constrained from 0.5 to 6000
Stroker.setDepth(float depth, bool applyNow);          // Depth in mm, constrained to [0, _travel]
Stroker.setStroke(float stroke, bool applyNow);        // Stroke length in mm, constrained to [0, _travel]
Stroker.setSensation(float sensation, bool applyNow);  // Sensation (arbitrary value a pattern may use to alter its behavior), 
                                                       // constrained to [-100, 100] with 0 being neutral.
Stroker.setPattern(int index, bool applyNow);          // Pattern, index must be < Stroker.getNumberOfPattern()