Where in the firmware do I store my M666 value?

Unfamiliar with the Marlin firmware, but I still want to store my correct value in my firmware so it wont get lost whenever I perform M502&M500.

1 Like

The instruction state that
" 4. Draw a fresh one to verify. If that is correct you should edit your firmware to make this change permanent in configuration.h Or add it to all of your Gcode."
in Dual Endstop -> Testing and Calibration

There are two ways to change values in the firmware. First, you can edit the configuration.h and configuration_Adv.h and then compile and reflash your board. The second way is to use g-codes to set firmware values. When you use g-codes like M666 to change a value, you need to follow it by an M500 to save that value. If you don’t execute an M500, your change will be lost when you turn your electronics off.

There is one other issue to be aware of. Once you’ve set a value using g-code, changing the values in the configuration.h and configuration_Adv.h will have no effect. In order for changes in the firmware files to be effective, you have to execute a M502 first to reset your board to factory settings.

Custom settings (ones set using g-code) are not overwritten. This behavior is to allow someone to upgrade their firmware to get new features without losing custom settings.

3 Likes

Yes, I’m aware of that, but what I’m wondering is which argument in the configuration.h should I change in order to have the same effect as running M666 with M500, is it the nozzle_to_probe_offset or something else?

You are looking for X_DUAL_ENDSTOP_ADJUSTMENT in configuration_adv.h. Here is a comment related to this value from that file:

 * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors
 * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error
 * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'.
 */
3 Likes

Just for the record I too always put any permanent adjustments into the config files. Because while M500 will save it to the eeprom on the board, I have yet to find a way to pull that info out. And God forbid your board dies, then you have to start all your tuning over again.

1 Like

Agreed. This is the way.

Although, M666 seems like it may not be the same in a few months.

@jeffeb3 Oh planned changes in the way marlin saves settings? I haven’t been following the marlin github. (I don’t know how you have time to keep track of it all).

No. I just mean that M666 is usually to fine tune the squareness, and stuff probably shifts a bit over time. I haven’t used M666, so I may be wrong.

1 Like

Ahhh sorry I misunderstood.