Well,
I think this is working. I've had a few dead ends
New features:
1. Sign on Screen moved to setup so it is not in the main menu (displays for 2 seconds)
2. Arbitrary input of # divisions
3. New feature Set/Goto Home
4. New feature Set speed
I've made massive changes to achieve this so there could be bugs
The setup code has changed significantly so study the code before configuring it again to suit your hardware. TIMER_DELAY is unchanged but is now a variable.
Code:
#define STEPPER_STEPS_REV 200 // The number of steps per stepper
#define MICRO_STEPS 10 // set to 1 if not not using a microstepper driver, otherwise set to # microsteps
#define DIVIDE_RATIO 90 // The Dividing table ratio (eg 40 or 90)
#define STEPS_PER_REV STEPPER_STEPS_REV * MICRO_STEPS * DIVIDE_RATIO
#define NUMBER_JOG_STEPS 10L
#define MAX_STEPPER_HZ 1000 // Maximum frequency for this stepper
#define MIN_STEPPER_HZ 400 // Minimum frequency for this stepper
long TIMER_DELAY = 80;
You can see I have added changes so the stepper speed parameters are defined in Hz.
<Set Speed>
picks a percentage range between
Code:
#define MAX_STEPPER_HZ 1000 // Maximum frequency for this stepper
#define MIN_STEPPER_HZ 400 // Minimum frequency for this stepper
and increments/decrements in 5% steps
There are procedures to convert between Hz and microseconds used internally to manage the frequency.
Default speed value (TIMER_DELAY = 80) is 37.5% of the default range I have set in the defaults
So when using speed control for the first time, it will be truncated to 37% and will change. I may change he way this is done so it is aligned with a 5% increment and specify the default in Hz.
<Home>
The code should take the shortest route to the home position as it tests to se if tests to see if the current position is < 180 degrees. (I hope) So it will turn clockwise or anticlockwise to get home the fastest.
The home position defaults to the starttup position so to test, use in conjunction with the jog feature.
Hope I've explained enough. I had a few unexpected compiler issues so it is possible we have a stack overflow but it seems to have settled down now.
I need to get this installed on my rotary table to debug the speed and stepper control as I am uncertain if I've got it done right