thinbits
Posts: 3
Joined: Tue Dec 30, 2014 5:35 pm

How to insert GCode before the temperature commands?

I'm using a Lulzbot Taz 4 and have had issues with Simplify3D and OctoPrint waiting forever to start the print because the factory PID values for bringing the bed temperature to the set point are off. As the bed temperature gets closer and closer to 60 (PLA in this instance), the rate at which it increases gets smaller and smaller, never quite hitting 60.0.

The solution on the Lulzbot forums was to run the PID calibration command to generate new PID values for my environment. Problem is, the new calibration values don't stick past a power cycle, so I need to send them down at the beginning of the print, before the commands that set the bed temperature.

I've tried adding the additional GCode to Scripts - Starting GCode section of my Process, but the resulting GCode file has my additions after the temperature commands.

Is there any way to get custom GCode inserted earlier into the file?

Even better, is there a way to always have this GCode prepended to any print I make?
User avatar
KeyboardWarrior
Posts: 480
Joined: Thu Jun 19, 2014 5:02 pm

Re: How to insert GCode before the temperature commands?

thinbits wrote:I'm using a Lulzbot Taz 4 and have had issues with Simplify3D and OctoPrint waiting forever to start the print because the factory PID values for bringing the bed temperature to the set point are off. As the bed temperature gets closer and closer to 60 (PLA in this instance), the rate at which it increases gets smaller and smaller, never quite hitting 60.0.

The solution on the Lulzbot forums was to run the PID calibration command to generate new PID values for my environment. Problem is, the new calibration values don't stick past a power cycle, so I need to send them down at the beginning of the print, before the commands that set the bed temperature.

I've tried adding the additional GCode to Scripts - Starting GCode section of my Process, but the resulting GCode file has my additions after the temperature commands.

Is there any way to get custom GCode inserted earlier into the file?

Even better, is there a way to always have this GCode prepended to any print I make?
Yes, there is a way! :D

In the starting G-Code,

G28; home all
PID COMMAND
M140 S[bed1_temperature]
M190 S[bed1_temperature]
M104 S[extruder0_temperature]
M109 S[extruder0_temperature]


Also, for other users who may find this post, if you have a stock bed on your Taz, please post the PID values and command that way they'll have it for future reference.
dsegel
Posts: 159
Joined: Tue Sep 30, 2014 5:37 pm

Re: How to insert GCode before the temperature commands?

The Taz 4 uses a RAMBo board running Marlin, doesn't it? I'd look at why the PID settings aren't saving instead of sending the values before every print. Have you contacted Lulzbot support? Are you issuing an M500 command to save the values after running the PID process?
thinbits
Posts: 3
Joined: Tue Dec 30, 2014 5:35 pm

Re: How to insert GCode before the temperature commands?

KeyboardWarrior wrote: Yes, there is a way! :D

In the starting G-Code,

G28; home all
PID COMMAND
M140 S[bed1_temperature]
M190 S[bed1_temperature]
M104 S[extruder0_temperature]
M109 S[extruder0_temperature]
Doing what you suggested (see attached screenshot) yields GCode that sets the bed temp, tries to wait for the bed temp, adjusts the PID, and then tries to re-set and wait for the temp.
Settings
Settings
...

Code: Select all

G90
M82
M106 S0
M140 S60
M190 S60
M104 S190 T0
M109 S190 T0
G28 ; home all axes
M304 P178.76 I20.06 D398.33 ; Reset Bed PID
M140 S60
M190 S60
M104 S190 T0
M109 S190 T0
Am I doing it wrong?
thinbits
Posts: 3
Joined: Tue Dec 30, 2014 5:35 pm

Re: How to insert GCode before the temperature commands?

dsegel wrote:The Taz 4 uses a RAMBo board running Marlin, doesn't it? I'd look at why the PID settings aren't saving instead of sending the values before every print. Have you contacted Lulzbot support? Are you issuing an M500 command to save the values after running the PID process?
According to this post on the Lulzbot forums https://forum.lulzbot.com/viewtopic.php ... 8030679602 the default PID values aren't being read from EEPROM, the only workaround is to re-compile the firmware. I'll file a bug with them.

This matches what I'm seeing. I can set the new PID values with M304 P178.76 I20.06 D398.33, read them back with M304, issue a M500 (or do a Save Memory from the LCD), power cycle, and the values I wrote have been lost.

So, my choices are:
- Figure out if there is way to correctly prepend the new PID values in Simplify3D (not working yet).
- Issue the PID command from the control panel on each power up (error prone).
- Re-compile my firmware with better values. I'm a software engineer, I've done Arduino work before, just not sure I want to go there yet... :)
User avatar
jimc
Posts: 1124
Joined: Wed Aug 28, 2013 11:02 pm
Location: mullica, nj
Contact: Website

Re: How to insert GCode before the temperature commands?

x2

for any commands or changes to stay in your firmware you need to save them to eeprom which is as desgel said the m500 command

Return to “General Discussion and Tips”