-1
$\begingroup$

I want to write a couple of very simple G-code test cases in Marlin-Style to make sure my printer works properly. The idea is to test the movement system, then the end-stops, then the heating and ability to hold temperature. But Marlin already runs large, so I can't spare too many lines in the basic setup, if I want to integrate it into the firmware.

The test I have in mind is this order of operations, covering the basis of each axis and the thermal control:

  • The printhead shall move up 20 mm, then right and forward the same.
  • the printhead shall home.
  • the printhead shall rise again by 20 mm.
  • The preheating shall be done (50°C bed, 180°C head).
  • The printer shall do nothing for 2 minutes.
  • The printer shall cool down.
  • Beep twice to signal that the test is concluded.

What is the best way to set up such a test code in the least amount of lines? Did I forget a crucial test command?

$\endgroup$
5
  • $\begingroup$ I do not think this question is a good fit for stackexchange. It is basically a "do-my-homework" question and it shows no effort. It is also incredibly specific (and thus useless to anybody else), focussing on a very specific test script that you want. $\endgroup$ – Tom van der Zanden Jan 6 at 8:56
  • $\begingroup$ @TomvanderZanden you DO realize that a) I put it in knowledgebase - where BASICS are explained b) I wrote an answer, which took me a little longer than expected c) the extreme specificity here is wanted because it is a very specific test case: do the motors work, does homing work, does the heating work. d) the G-code could be ran on basically every printer, no matter the size. $\endgroup$ – Trish Jan 6 at 10:30
  • $\begingroup$ I did see you wrote an answer, but that doesn't change how the question should be evaluated. $\endgroup$ – Tom van der Zanden Jan 6 at 11:04
  • $\begingroup$ I think that for a "knowledge base" question "How to write G-code to do movement?" or "How to command the heated bed to warm?" or "How to pause a print?" might be more suitable as isolated question (even though these are still very basic questions, of course). $\endgroup$ – Tom van der Zanden Jan 6 at 11:05
  • $\begingroup$ I think that for a programming stackexchange, a question on "I want to write a program that does A, then B, then C" wouldn't be considered appropriate. But a question "How to do B?" might be. This seems to be the equivalent of that? $\endgroup$ – Tom van der Zanden Jan 6 at 11:07
2
$\begingroup$

I can get down to 13 lines using 6 commands: G1 movements, G28 homing, M140 setting the bed temperature without pause, M109 to set the hotend temperature, G4 dwell to pause, and M300 to beep.

G1 Z20 F1000
G1 X20
G1 Y20
G28
G1 Z20
M140 S50
M109 R180
G4 S60
M140 S0
M109 R20
M300 S440 P200
G4 P200
M300 S660 P200
$\endgroup$
1
  • $\begingroup$ ... and this could be put into one line, and added as a "Self-test" custom menu item for easy access. Maybe this was an origin of "in the least amount of lines" requirement. I like this idea :) it helps to implement PDCA cycle into printer improvements. This could be even built into Marlin, which is aware of current position (risk of gcode raise on start) and hardware (speaker vs buzzer). $\endgroup$ – octopus8 Jan 8 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.