Schildkroet / GRBL-Advanced

Grbl-Advanced is a no-compromise, high performance, low cost alternative for CNC milling. This version of Grbl runs on a STM32F411RE / STM32F446RE Nucleo Board. Now with backlash compensation, multi-axis and Tool Table support!
GNU General Public License v3.0
286 stars 84 forks source link

Abort/Hold pins #47

Closed LaurentLM closed 4 years ago

LaurentLM commented 4 years ago

Hi, Thanks for the good work, I have been using this for a mini mill for a while and it's great. I am using a Nucleo F401RE and when wiring new buttons recently, I noticed the abort/hold pins were inverted compared with standard Arduino GRBL. I have Abort on A1 & Hold on A0. I cannot find where this is defined in the code.

I also noticed they were not pulled up, but that's easy to change (line 187 of gpio.c). Not a huge deal, but I thought I'd report it.

Schildkroet commented 4 years ago

Hello, the control mask for inverting buttons is in https://github.com/Schildkroet/GRBL-Advanced/blob/48cd2aa65596d6a5345bc55f2344d25d993ab9e7/grbl/util.h#L81

The actual reading happens in https://github.com/Schildkroet/GRBL-Advanced/blob/f1df62453c11b7769aae0a6ac1416a0eba1c3b0c/grbl/System.c#L61-L89

Yes, it is a bit messy right now. Maybe i find some time to fix it

Schildkroet commented 4 years ago

I fixed the missing invert command. You can now invert your pins as you like. These are the corresponding bits https://github.com/Schildkroet/GRBL-Advanced/blob/69a3cb81a4d2d1876fe689bc3f9c87dfba74984b/grbl/Settings.h#L34-L40

You can set it with DEFAULT_SYSTEM_INVERT_MASK or $0=xxx

LaurentLM commented 4 years ago

Thanks for looking into it, $0=0 sorted the problem. Just out of curiosity, what happened to the "Step pulse, microseconds" setting that $0 used to control?

Also, would it make sense to change this: https://github.com/Schildkroet/GRBL-Advanced/blob/69a3cb81a4d2d1876fe689bc3f9c87dfba74984b/HAL/GPIO/GPIO.c#L187 into GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; ? That would match the standard GRBL behaviour.

Schildkroet commented 4 years ago

I set it to a fixed value. All common drivers work the same, so i don't think it is necessary.

LaurentLM commented 4 years ago

Makes sense. Thanks again or the great work!