Topic: Hysteresis Fix
From the Google Groups forum, a simplified set of changes if you want to add hysteresis correction to your firmware.
I could apply the hysteresis changes directly to our Solidoodle code, but then that would make updating from the main Marlin code more complicated. It's better to apply complicated changes to the main Marlin code, so that the changes naturally trickle down to our Solidoodle code. We want to keep our Solidoodle alterations to a minimum to enjoy the benefits of easy and regular updates from the main Marlin code.
So here are the changes you need to make. You can make these changes to Lawsy's Solidoodle firmware or Solidoodles v4.2 firmware. If you've already added my previous alterations, then best roll back to Lawsy's firmware and then apply these...
Step 1. Add a define to configuration.h. I added the following line after the define for DEFAULT_MAX_ACCELERATION
#define DEFAULT_HYSTERESIS_MM 0, 0, 0, 0 // X, Y, Z, E hysteresis in mm. These are the extra distances that are performed when an axis changes direction to compensate for any mechanical hysteresis your printer has.
Step 2. Add some cases to the switch statement in process_commands in Marlin.pde. Search for "case 115: // M115" and insert the following lines before that line....
case 98: // M98
{
hysteresis.ReportToSerial();
}
break;
case 99: // M99
{
if(code_seen('X')) hysteresis.SetAxis( X_AXIS, code_value() );
if(code_seen('Y')) hysteresis.SetAxis( Y_AXIS, code_value() );
if(code_seen('Z')) hysteresis.SetAxis( Z_AXIS, code_value() );
if(code_seen('E')) hysteresis.SetAxis( E_AXIS, code_value() );
}
break;
Step 3. Insert an include in Marlin.pde. Add it near the top, after the other includes that are already there...
#include "Hysteresis.h"
Step 4. Do the same for planner.cpp. Add it near the top, after the other includes that are already there...
#include "Hysteresis.h"
Step 5. Insert a line in the plan_buffer_line function in planner.cpp. It should be the first line in the function, before "int next_buffer_head = ...."
hysteresis.InsertCorrection(x,y,z,e);
Step 6. Add the attached files (hysteresis.cpp and hysteresis.h) to the Marlin directory, the same directory that has Marlin.pde in it.
That's it. I've tried to simplify it as much as possible, the bulk of the code is in the new files and I've minimized the changes we need to make to the Marlin code while we wait for Erik to incorporate the changes directly. With the above changes made, you can now add a line like the following into you start code...
M99 X0 Y0.17 Z0 E0
This would add a 0.17mm hysteresis fix into your Y axis. Ian, be sure to change from steps to mm if you are already using the M99 command. Use M98 to see what your current hysteresis settings are. Post here if you have any problems.