Yes, that way I do it all the time for debugging. Just do not use strings having special meaning like T: B: A: X: Y: Z: used for position or temperature parsing. And finish with a newline. Writes should be done in main thread of firmware and not in interrupts as this is the only way to guarantee they get not mixed with output.
Had a first look and think there are a few problems 1. if ( getMatrix(matrixIndex(ix, iy)) == ( DISTORTION_LIMIT_TO * Printer::axisStepsPerMM[Z_AXIS]) ) { You should not compute the magic number DISTORTION_LIMIT_TO * Printer::axisStepsPerMM[Z_AXIS] - better use a fixed value that can never be reached normally #define DISTORTION_UNSET 2000000000 2. In this void Distortion::extrapolateCornersCircular(void) {
should not blindly extraplate. Special cases to catch: left/right/top/bottom row. There you can not extrapolate from the sides. Also you should not extrapolate from points with magic number, that returns garbage. But first value could be surrounded by magic numbers if resolution is high enough. I also do not really understand this function at all. Upper function goes over all points and here you update 4 different points while only one update is needed - the one for the point you was given.
So basically most is fine but I think here you need to fix it. Test only for one point. Try to check if you can interpolate. If all surroundings are magic number, return false. Then calling loop will continue and try other points and in next loop it might have non magic numbers so you can proceed. For best results you need to consider all known neighbour points.
} I think this is too simple. Also we can reach an exact circle but you need to consider the offset of the z probe as well and ciy/cix only work for uneven number of grid points. I think it would be better to compute the coordinates as float and add offset and then check for radius.
G33 will stop at the last measured point. There is real rule where it should end so we can stop it anywhere. But hosts might be confused about position afterwards causing unexpected moves. So going back to start position might be a good idea.
Also we might disable z probe in the middle to get no problems hitting a boundary.
Comments
Or which method can I use ?
For example, can I use these functions ?
Com :: printF (PSTR ("Y"), y, 2);
Com :: printFLN (PSTR ("radiusCorr:"), radiusCorrectionSteps);
Com :: printFLN (PSTR ("steps:"), step);
Thank you
https://github.com/sandro730/Repetier-Firmware/tree/DistortionCircular
https://github.com/sandro730/Repetier-Firmware/wiki
https://github.com/sandro730/Repetier-Firmware/wiki/Distortion-points
1. if ( getMatrix(matrixIndex(ix, iy)) == ( DISTORTION_LIMIT_TO * Printer::axisStepsPerMM[Z_AXIS]) ) {
You should not compute the magic number DISTORTION_LIMIT_TO * Printer::axisStepsPerMM[Z_AXIS] - better use a fixed value that can never be reached normally
#define DISTORTION_UNSET 2000000000
2. In this void Distortion::extrapolateCornersCircular(void) {
extrapolateCorners should return true if a value was interpolated and only then end should be set true, remove break.
3. extrapolateCorners
should not blindly extraplate. Special cases to catch:
left/right/top/bottom row. There you can not extrapolate from the sides.
Also you should not extrapolate from points with magic number, that returns garbage. But first value could be surrounded by magic numbers if resolution is high enough.
I also do not really understand this function at all. Upper function goes over all points and here you update 4 different points while only one update is needed - the one for the point you was given.
So basically most is fine but I think here you need to fix it. Test only for one point. Try to check if you can interpolate. If all surroundings are magic number, return false. Then calling loop will continue and try other points and in next loop it might have non magic numbers so you can proceed.
For best results you need to consider all known neighbour points.
4.
I think this is too simple. Also we can reach an exact circle but you need to consider the offset of the z probe as well and ciy/cix only work for uneven number of grid points. I think it would be better to compute the coordinates as float and add offset and then check for radius.
G33 will stop at the last measured point. There is real rule where it should end so we can stop it anywhere. But hosts might be confused about position afterwards causing unexpected moves. So going back to start position might be a good idea.
Also we might disable z probe in the middle to get no problems hitting a boundary.