j-be / AutoBim

A bed tramming utility for OctoPrint using ABL
Other
29 stars 3 forks source link

[Doc] G30 macro now takes probe offsets into account #29

Closed datapaganism closed 2 years ago

datapaganism commented 2 years ago

Modified G30 macro to fix Issue 25

j-be commented 2 years ago

Thanks for the contribution.

Please indent the {% if %} {% else %} {% endif %} block with 2 spaces as well for consistency.

Is it safe to assume that printer.configfile.settings.bltouch.x_offset or printer.configfile.config.bltouch is always defined?

Finally: is it ok with you if I add you to the "Credits" section of the README.md?

datapaganism commented 2 years ago

I have double checked the Moonraker API that governs the printer object, printer.configfile.config pulls data from printer.cfg.

x_offset and y_offset must both be defined in one's printer.cfg

I have also added an else block to support other probe types however this is untested but should work.

And yes I don't mind being added to the credits section

j-be commented 2 years ago

Please add an {% else %} branch setting both x_offset and y_offset to 0 (= zero). Else they are undefined, and the calculation below may fail. Alternatively you can initialize them before the first {% if %}. Since people may just copy-and-paste this without knowing what it does it should be as resilient as possible.

Also, please correctly indent the following block for consistency:

    {% set y = y - y_offset | float %}
    {% set x = x - x_offset | float %}    

It is outside anything, so only 2 spaces.

datapaganism commented 2 years ago

Thanks, indents always catch me out as you can see, I believe this is good enough now to be released

j-be commented 2 years ago

Merged. Will add you to the Credits shortly. Thanks again and happy printing.