Skip to content

Commit

Permalink
fix compile issues. Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
gin66 committed Dec 3, 2023
1 parent fc988a0 commit 90bf7f1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TODO:
- rename RampConstAcceleration to e.g. RampControl
- merge the two esp32 rmt drivers as soon as esp32c3 works

pre-0.30.8:
0.30.8:
- Implement `setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks)` as proposed by issue #210

0.30.7:
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ No issue with platformio. Check the [related issue](https://github.com/arduino/l
[![Build examples for Atmega32U4](https://github.com/gin66/FastAccelStepper/actions/workflows/build_examples_atmega32u4.yml/badge.svg)](https://github.com/gin66/FastAccelStepper/actions/workflows/build_examples_nanoatmega32u4.yml)

This is a high speed alternative for the [AccelStepper library](http://www.airspayce.com/mikem/arduino/AccelStepper/).
Supported are avr (ATmega 168/328/P, ATmega2560, ATmega32u4), esp32, esp32s2, esp32s3 and atmelsam due.
Supported are avr (ATmega 168/328/P, ATmega2560, ATmega32u4), esp32, esp32s2, esp32s3, esp32c3 and atmelsam due.

The stepper motors should be connected via a driver IC (like A4988) with a 1, 2 or 3-wire connection:
* Step Signal
Expand Down Expand Up @@ -150,6 +150,12 @@ Comments to pin sharing:
* supports up to four stepper motors using Step/Direction/Enable Control (Direction and Enable is optional)
* Steppers' command queue depth: 32

### ESP32C3

* allows up to 200000 generated steps per second ?
* supports up to two stepper motors using Step/Direction/Enable Control (Direction and Enable is optional)
* Steppers' command queue depth: 32

### Atmel SAM Due

* allows up to 50000 generated steps per second
Expand Down
3 changes: 1 addition & 2 deletions examples/Issue208/Issue208.ino
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ void setup() {
#ifndef SIMULATOR
if (pass) {
Serial.print("PASS");
}
else {
} else {
Serial.print("FAIL");
}
#endif
Expand Down
9 changes: 8 additions & 1 deletion extras/doc/FastAccelStepper_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ And the two directions of a move
#define RAMP_DIRECTION_COUNT_DOWN 64
```
A ramp state value of 2 is set after any move call on a stopped motor
and until the stepper task is serviced. The stepper task will then
and until the stepper task is serviced. The stepper task will then
control the direction flags
## Timing values - Architecture dependent
Expand Down Expand Up @@ -290,6 +290,13 @@ For the device's maximum allowed speed, the following calls can be used.
uint32_t getMaxSpeedInHz();
uint32_t getMaxSpeedInMilliHz();
```
For esp32, the device's maximum allowed speed can be overridden
This is absolutely untested. Use at your own risk.
```cpp
#if SUPPORT_UNSAFE_ABS_SPEED_LIMIT_SETTING == 1
void setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks);
#endif
```
Setting the speed can be done with the four `setSpeed...()` calls.
The new value will be used only after call of these functions:

Expand Down
2 changes: 2 additions & 0 deletions src/FastAccelStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,11 @@ uint32_t FastAccelStepper::getMaxSpeedInMilliHz() {
uint32_t speed_in_milli_hz = ((uint32_t)250 * TICKS_PER_S) / ticks * 4;
return speed_in_milli_hz;
}
#if SUPPORT_UNSAFE_ABS_SPEED_LIMIT_SETTING == 1
void FastAccelStepper::setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks) {
fas_queue[_queue_num].setAbsoluteSpeedLimit(max_speed_in_ticks);
}
#endif
int8_t FastAccelStepper::setSpeedInTicks(uint32_t min_step_ticks) {
if (min_step_ticks < getMaxSpeedInTicks()) {
return -1;
Expand Down
8 changes: 4 additions & 4 deletions src/FastAccelStepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class FastAccelStepperEngine {
#define RAMP_DIRECTION_COUNT_DOWN 64

// A ramp state value of 2 is set after any move call on a stopped motor
// and until the stepper task is serviced. The stepper task will then
// and until the stepper task is serviced. The stepper task will then
// control the direction flags

#include "RampGenerator.h"
Expand Down Expand Up @@ -332,9 +332,9 @@ class FastAccelStepper {
uint32_t getMaxSpeedInMilliHz();

// For esp32, the device's maximum allowed speed can be overridden
// This is absolutely untested and use at your own risk.
#if SUPPORT_UNSAFE_ABS_SPEED_LIMIT_SETTING==1
setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks);
// This is absolutely untested. Use at your own risk.
#if SUPPORT_UNSAFE_ABS_SPEED_LIMIT_SETTING == 1
void setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks);
#endif

// Setting the speed can be done with the four `setSpeed...()` calls.
Expand Down
4 changes: 2 additions & 2 deletions src/StepperISR.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class StepperQueue {
entry[read_idx & QUEUE_LEN_MASK].repeat_entry = 0;
}
#endif
#if SUPPORT_UNSAFE_ABS_SPEED_LIMIT_SETTING==1
setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks);
#if SUPPORT_UNSAFE_ABS_SPEED_LIMIT_SETTING == 1
void setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks);
#endif

int8_t addQueueEntry(const struct stepper_command_s* cmd, bool start);
Expand Down
4 changes: 2 additions & 2 deletions src/StepperISR_esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ void StepperQueue::adjustSpeedToStepperCount(uint8_t steppers) {
max_speed_in_ticks = 80; // This equals 200kHz @ 16MHz
}

void StepperQueue::setAbsoluteSpeedLimit(uint16_t max_speed_in_ticks) {
self->max_speed_in_ticks = max_speed_in_ticks;
void StepperQueue::setAbsoluteSpeedLimit(uint16_t ticks) {
max_speed_in_ticks = ticks;
}

void fas_init_engine(FastAccelStepperEngine *engine, uint8_t cpu_core) {
Expand Down

0 comments on commit 90bf7f1

Please sign in to comment.