Short-bus / pilomar

RaspberryPi based miniature observatory
https://shortbus.blog/
GNU General Public License v3.0
67 stars 14 forks source link

Simplify microstepping configuration for motors #57

Closed Short-bus closed 7 months ago

Short-bus commented 8 months ago

The original code for handling the stepper motors has support for microstepping, but it is quite old code. The configuration to support microstepping is hardcoded, and split across src/pilomar.py and circuitpython/code.py. Any changes have to be made in both programs. With experience it can be simplified. There are some builds underway which want to use microstepping so now is a good time to simplify the code.

  1. Consolidate all the microstepping related parameters into the parameter file. All programs then take their rules from there.
  2. Simplify the code for handling microstepping, the original version has more features than needed but is difficult to test.
  3. Make it easier for people to use alternative steppermotor driver boards. The current code expects DRV8825s but some people want to use alternatives.
Short-bus commented 8 months ago

New solution in the 2024-01-issues branch.

You can now change the stepper motor microstepping setting directly in the parameter file. AzimuthMicrosteppingRatio and AltitudeMicrosteppingRatio

By default these are '1' meaning FULL STEPS.

You can use 2,4,8,16 or 32 to increase microstepping.

Be sure to restart both the RPi software AND the microcontroller to force the new parameter values to be taken into use.

Short-bus commented 7 months ago

Done.