Close



Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    Technologist
    Join Date
    Oct 2014
    Posts
    114
    I am trying the same thing I think. I would like to store the matrix in eeprom so I don't have to run a g29 with every print.

    If I enter the "EEPROM_WRITE_VAR(i,plan_bed_level_matrix[0][0]);", I get an error compiling.

  2. #12
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    My mistake... They take a one dimensional array and effectively turn it into a 2 dimensional array by doing this to the sub-scripts:
    Code:
    void vector_3::apply_rotation(matrix_3x3 matrix)
    {
        float resultX = x * matrix.matrix[3*0+0] + y * matrix.matrix[3*1+0] + z * matrix.matrix[3*2+0];
        float resultY = x * matrix.matrix[3*0+1] + y * matrix.matrix[3*1+1] + z * matrix.matrix[3*2+1];
        float resultZ = x * matrix.matrix[3*0+2] + y * matrix.matrix[3*1+2] + z * matrix.matrix[3*2+2];
    
        x = resultX;
        y = resultY;
        z = resultZ;
    }
    EEPROM_WRITE_VAR(i, plan_bed_level_matrix[2][1] );

    becomes:

    EEPROM_WRITE_VAR(i, plan_bed_level_matrix[2*3 + 1] );

  3. #13
    Technologist
    Join Date
    Oct 2014
    Posts
    114
    Thanks Roxy.

    Does anyone have all the necessary changes to the FW to get this to work?

    Also, are there any changes to the gcode necessary? M500/M501?

  4. #14
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    The EEPROM (if enabled) is automatically read when the Arduino board is reset. Any important value in it is read and stored in the local variables for use. If you add the code to save and restore the plan_bed_level_matrix[] it will happen automatically.

    At that point, you would just need to do a little bit more. You still want to use and have available the G28 command. I would delete the line of code at the start of it that sets the plan_bed_level_matrix[] to unity. You don't want that changing anymore from what the EEPROM says it is.

    And the other operational difference is you would have to manually do a G29, and save the results with a M500.

    You also might want to move that line of code that sets the plan_bed_level_matrix[] to unity in the G28 command into the M502 code block. I don't know. That one could be argued. The reason I'm suggesting this is you need a way to get the plan_bed_level_matrix[] reset to something usable when 'restoration of default settings' is requested.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •