G30

2»

Comments

  • Can you explain how to print strings and values in the Repetier Host console without generating errors ?

    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
  • 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.
  • edited March 2018
    I finished the implementation  :)

    You can check the following links  ;)

    https://github.com/sandro730/Repetier-Firmware/tree/DistortionCircular

    https://github.com/sandro730/Repetier-Firmware/wiki

    https://github.com/sandro730/Repetier-Firmware/wiki/Distortion-points

    During the tests I realized that after executing the G33 command
    hotend does not return to the starting position.
    If I move with the manual control, the values of the manual control are misaligned with respect to the real position.

    Is it wanted or do I have an error in the configuration?

    Thank you

  • 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) {
        fast8_t ix, iy;
        bool end = true;
        while ( end ) {
            end = false;
            for(iy=ceil(ciy); iy < DISTORTION_CORRECTION_POINTS; iy++) {
                for(ix=ceil(cix); ix < DISTORTION_CORRECTION_POINTS; ix++) {
                    if ( getMatrix(matrixIndex(ix, iy)) == ( DISTORTION_LIMIT_TO * Printer::axisStepsPerMM[Z_AXIS]) ) {
                        extrapolateCorners(ix, iy);
                        end = true;
                        break;
                    }
                }
            }
        }
    }

    extrapolateCorners should return true if a value was interpolated and only then end should be set true, remove break.
    3. extrapolateCorners

    void Distortion::extrapolateCorners(fast8_t ix, fast8_t iy) {
    const fast8_t icx = (DISTORTION_CORRECTION_POINTS - 1) - ix;
    const fast8_t icy = (DISTORTION_CORRECTION_POINTS - 1) - iy;
        extrapolateCorner(icx, icy,  1,  1);
        extrapolateCorner(icx, iy,   1, -1);
        extrapolateCorner(ix,  icy, -1,  1);
        extrapolateCorner(ix,  iy,  -1, -1);
    }

    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. 
    bool Distortion::isExternalRadiusPoint(fast8_t ix, fast8_t iy) const {
        return ( ((ix-cix)*(ix-cix) + (iy-ciy)*(iy-ciy)) > iradius );
    }
    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.
Sign In or Register to comment.