gin66 / FastAccelStepper

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3 and Atmel SAM Due
MIT License
282 stars 67 forks source link

Improve documentation for stepper_command_s #270

Closed HalfVoxel closed 1 week ago

HalfVoxel commented 1 week ago

I spent the last 2 hours being confused about why my code didn't work, until I figured out that I had assumed that ticks was the total number of ticks in the command, not the spacing between the ticks. Hopefully, better documentation will ensure no other people fall into the same trap.

gin66 commented 1 week ago

Thanks for this improvement. Could you please retain this line in the patch ?

//  ticks is multiplied by (1/TICKS_PER_S) in s

BTW: Issue #86 is kept open for more detailed explanation. Perhaps can refer to that, too ?

HalfVoxel commented 1 week ago

I'm not quite sure what you mean to say with that comment? Does it just mean "there are TICKS_PER_S ticks each second"?

gin66 commented 1 week ago

TICKS_PER_S is for most uC 16.000.000 (using standard frequency with esp32) and is for Sam Due 21.000.000. Consequently, 16000 ticks for most uC translates into 1ms, but for Sam Due is 0.76ms. This statement just explains, how to translate ticks into time.

HalfVoxel commented 1 week ago

I improved the comments a bit.