Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting N_AXIS in my_machine.h doesn't work properly #102

Open
qwertychouskie opened this issue Dec 17, 2024 · 3 comments
Open

Setting N_AXIS in my_machine.h doesn't work properly #102

qwertychouskie opened this issue Dec 17, 2024 · 3 comments

Comments

@qwertychouskie
Copy link
Contributor

When setting N_AXIS in my_machine.h, there are various compiler warnings about N_AXIS being redefined, and the resulting build only seems to support 3 axes. If I change the default N_AXIS definition in config.h (line 42), the resulting build supports the expected number of axes.

Is there a different way N_AXIS is supposed to be defined?

@terjeio
Copy link
Contributor

terjeio commented Dec 17, 2024

Is there a different way N_AXIS is supposed to be defined?

It has to be changed in config.h, from the compiler command line (e.g. -D N_AXIS=4) or for those who use PlatformIO - in platformio.ini.
The core does not use my_machine.h, this is a design choice made to keep the core isolated from driver implementations.

@qwertychouskie
Copy link
Contributor Author

If my_machine.h is not the correct place to set N_AXIS, it should probably be documented, ideally with a compiler error to catch the invalid configuration. Getting grblHAL up and running took much longer than it would have if this issue were documented.

Another big issue I ran into that took a long time to figure out was the *_DIRECTION_PIN definitions being silently ignored. Turned out the example config I copied from (generic_map_4axis.h) set DIRECTION_OUTMODE to GPIO_SHIFT6, resulting in the *_DIRECTION_PIN definitions being silently ignored. Defining *_DIRECTION_PIN while DIRECTION_OUTMODE is not GPIO_MAP should probably at least be a compile-time warning, ideally an error.

@terjeio
Copy link
Contributor

terjeio commented Dec 18, 2024

Getting grblHAL up and running took much longer than it would have if this issue were documented.

Perhaps a clue is that N_AXIS and other config options from grbl/config.h are not present in my_machine.h? And that grbl/config.h even exists?

Defining *_DIRECTION_PIN while DIRECTION_OUTMODE is not GPIO_MAP should probably at least be a compile-time warning, ideally an error.

There are limits to what can be catched compile time, it might not be possible or may take a lot of time to add and debug. So not a priority, at least not for me.

Ideally there should be a large team behind grblHAL, writing perfect code and add all sorts of documentation... The few that are working on grblHAL do it for free in their spare time, so sadly some that wants to use the code may waste their precious time on stuff like this issue. I am sorry for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants