Welcome! Log In Create A New Profile

Advanced

Marlin displays incorrect values for Zsteps and Esteps on LCD

Posted by jbernardis 
Marlin displays incorrect values for Zsteps and Esteps on LCD
September 24, 2012 10:25PM
I just build an LCD/encoder control panel for my Marlin/RAMPS1.4 prusa. It works great and I'm loving having it on my printer, but I couldn't help but notice that it displays incorrect values for the Z steps and E steps (X and Y are correct). I did a little analysis, and discovered that the issue is the integer precision of the Arduino.

I looked at the conversion routine ftostr52 that is used to format these values, and if I assume that the Arduino long integer is only 16 bits, then I can explain the values I get. The value I have for E steps is 699.897. Marlin presents this as +44.53. The value I have for Z steps is 2560.00 and marlin presents this as -61.44.

I can't believe I'm the only/first one to have experienced this issue. Does anyone know if there is a correction or work-around? I may not have the latest marlin, but I'm fairly recent.
Re: Marlin displays incorrect values for Zsteps and Esteps on LCD
September 24, 2012 11:28PM
Actually I kept searching after posting this and solved my own problem. I'll post my solution here in case it helps someone else.

The bottom line is that even though I was within a few months of current, marlin HAS changed in the interim and the math in questions was changed from using an int to using a long. I updated my marlin, and half the problem went away. I still had an issue with my Z steps. My value is 2560 (which I can't believe is uncommon since it's based on standard hardware), and the ftostr52 routine was formatting this as "+560.00". I had to make a change where the formatting routine was called; instead of using ftostr52, I changed to ftostr51. Now it properly displays as "+2560.0".
Sorry, only registered users may post in this forum.

Click here to login