usbcnc/grbl

Bug in homing when an axis uses a pin between 8 and 15 for as step pin

mstrens opened this issue · 2 comments

When I ask for a homing, Z and Y axis are moving but not the X axis
After looking to the code, I founded a bug.
In my setup, . I use pin 10 as step pin for X axis.
But in file limit.c, in function void limits_go_home(), there is a definition : uint8_t step_pin[N_AXIS];
and after you have : step_pin[idx] = step_pin_mask[idx];
The issue is that step_pin_mask is an array of uint16_t instead of uint__t.
In order to let code works for several cpu, best is ti change the delaration with:
PORTPINDEF step_pin[N_AXIS];
because PORTPINDEF is already uint8_t or uint16_t depending on cpu.

I just tested the solution proposed above but it is not enough.
2 more changes are required:

  • in the same function you must declare
    PORTPINDEF axislock ;
    instead of uint8_t

  • in file system.h, you must declare
    PORTPINDEF homing_axis_lock;
    instead of uint8_t homing_axis_lock;

Then I tested it and it works.

ok! I'll add it in 4axis branch