Feature request: $HOME directory location for g-code subroutines?

By default, the only search path for subroutines is inside the software install (which on Kinetic is on a read-only partition). I’m about to ask a number of people to install custom g-code subroutines to use a touch probe. I could have them also each add a .ini overlay to add an extra search path for subroutines, but it seems like it would be nice to just have a default search path in the home directory to make it easy to install new subroutines (and custom M codes) for everyone.

I think it would be as simple as updating each of the .ini files as per the below diff:

--- PocketNC.ini	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/PocketNC.ini	2022-01-31 21:33:16.647186686 +0000
@@ -262,8 +262,8 @@
 PRUCODE=prucode=/usr/lib/machinekit/prubin/pru_generic.bin
 
 [RS274NGC]
-USER_M_PATH=/opt/pocketnc/Settings/mcodes
-SUBROUTINE_PATH=/opt/pocketnc/Settings/subroutines
+USER_M_PATH=/opt/pocketnc/Settings/mcodes:/home/pocketnc/mcodes
+SUBROUTINE_PATH=/opt/pocketnc/Settings/subroutines:/home/pocketnc/subroutines
 REMAP=M654 modalgroup=6 ngc=tool-probe argspec=T
 REMAP=M428 modalgroup=10 ngc=428remap
 REMAP=M429 modalgroup=10 ngc=429remap

Is this something that seems reasonable?

@john

This sounds like a great idea. Having more ways to customize your machine is definitely on our list of improvements we’d like to make. Generally, I like to have a way to interact with those customizations through the UI, which would require a bit more work than simply adding those paths, but I could certainly make a simple change like this if people are up for ssh’ing into their machine or using scp to copy files.

Agreed that having UI is good, although this is a pretty low effort change to make at least some things easier.

If I may, instead of $HOME I’d suggest you follow the XDG base directory spec: XDG Base Directory Specification

The path to your namespace would look like $HOME/.config/pocketnc/ for config files ($XDG_CONFIG_HOME/pocketnc/), etc. Probably that G-Code should go in $XDG_DATA_HOME/pocketnc or some such.

I can’t say I care too much, although the current user gcode is already stored in /home/pocketnc/ncfiles, and this isn’t exactly a desktop system where using .config would give any specific benefits.

@jpieper, we added your suggested paths with one difference. We put the library path second in the list so that M codes can be overridden. There’s a bit more responsibility on the user to ensure custom M codes aren’t hiding system ones, but it allows you to copy over the system ones and modify them if necessary. It’s in v5.1.2.

@aybabtme, thanks for the suggestion! We could feasibly look for directories in this location, as well, but I agree with @jpieper that this software isn’t meant to be run on a generic system and the home directory is assumed to have user files relevant to Kinetic Control.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.