2
$\begingroup$

I have an Elegoo Neptune 4 Pro (love it), and I'm trying to set up a Raspberry Pi with a camera to take a photo every time a layer is complete (to build a time-lapse).

This means I'll have to edit the G-code to move the print head to the X-axis maximum to press a button (shutter release).

I'm using the web interface and would like to know how to get the X-axis position using G-code commands.

I've found Klipper documentation: G-Codes and have tried to run a few of the commands.

M114 gives the following line:

14:58:56 X:141.000 Y:98.000 Z:11.090 E:0.000

However, when I try to send the print head to that location from somewhere else, I get errors.

$ G0 X:141.000 Y:98.000 Z:11.090 E:0.000
!! Unable to parse move 'G0 X:141.000 Y:98.000 Z:11.090 E:0.000'
$ G0 [X:141.000] [Y:98.000] [Z:11.090] [E:0.000]
// Unknown command:"G0 ["
$ G0 [141.000] [98.000] [11.090] [0.000]
// Unknown command:"G0 [141.000] [98.000] [11.090] [0.000]"
$ G0 141.000 98.000 11.090 E:0.000
// Unknown command:"G0 141.000 98.000 11.090"
$ G0 X:141.000 Y:98.000 Z:11.090 E:0.000

All of these tried with G1 as well as G0

Based on the error messages, it looks like the first line above is the way to go; But I'm not sure where to go from here.

$\endgroup$
2
  • $\begingroup$ Have you tried sending G0 X141.000 Y98.000 Z11.090 E0.000? $\endgroup$
    – agarza
    Commented Oct 8, 2023 at 3:04
  • $\begingroup$ G1 X141 F5000 will send the head to X=141 without touching Y and Z, and do it fast. [also, while G0 and G1 can be used pretty much equally, it is "traditional" to use G0 for printing/cutting/work in general, G1 for free movement between work points.] $\endgroup$
    – SF.
    Commented Oct 10, 2023 at 11:04

2 Answers 2

2
$\begingroup$

It seems that the commands are invalid due to improper syntax. The Klipper Documentation site does seem to be a bit confusing. The main list of G-codes can be found on the RepRap wiki.

The site provides the proper usage and examples:

Usage

G0 Xnnn Ynnn Znnn Ennn Fnnn Snnn 
G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn

...

Examples

G0 X12               ; move to 12mm on the X axis  
G0 F1500             ; Set the feedrate to 1500mm/min  
G1 X90.6 Y13.8 E22.4 ; Move to 90.6mm on the X axis and 13.8mm on the Y axis while extruding 22.4mm of material
$\endgroup$
1
$\begingroup$

The provided link shows the correct syntax, the ":" character is not in the Klipper G-code specification and remember the "[" and "]" characters imply that the parameter is optional and "<" and ">" imply: "insert a value here".

From the documentation:

Move (G0 or G1): G1 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>] [F<speed>]

A valid command would be:

G0 X141.000 Y98.000 Z11.090 E0.0001)


1) Note that this is an example based on the provided G-code in the question, the use of the E0.000 is not recommended, this can retract the filament all the way from the extruder based on the last position of E. If you want a move to a position, retract first (using a relative positioning of E), then move (using an absolute positioning of X, Y, Z), take a picture, move back and re-retract the same value (using a relative positioning of E).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .