Saturday, May 7, 2011

Adding M117 Support to Gen6 Firmware

This article details how I added support for the M117 GCode that I used for the Auto Bed Leveling approach. The standard Gen6 firmware doesn't support this GCode.


This is more for my own recollection in case I need to add it to future builds.


process_g_code.pde: Line 680 (in the switch statement after case 116)


Handle the M117 GCode and return the data in the appropriate format.



case 117:
Serial.print("C: X");
        Serial.print(zeroHit.x);
        Serial.print(" Y");
        Serial.print(zeroHit.y);
        Serial.print(" Z");
        Serial.print(zeroHit.z);
        Serial.print(" E");
        Serial.println(zeroHit.e);
break;


cartesian_dda.pde: Line 391 (in the if (read_switch(min_pin, inv) ) statement)

When an end-stop is hit, store the current step count.

   if (min_pin == X_MIN_PIN)
       zeroHit.x = current;
   if (min_pin == Y_MIN_PIN)
       zeroHit.y = current;
   if (min_pin == Z_MIN_PIN)
       zeroHit.z = current;

configuration.h: Line 329 (just before #endif)

Increase the variables scope.

extern LongPoint zeroHit;

FiveD-GCode_Interpreter.pde: Line 121 (after FloatPoint where_i_am;)

Variable declaration.

LongPoint zeroHit;


That's all there is to it, a quick recompile and upload later and the Gen6 hardware should now support M117.

4 comments:

  1. I have a question that has given me a lot of trouble. I have just started working on a 3D printer. I have assembled Mendel with Gen 6 board. I have connected Arduino with Gen 6 board and can communicate between them via I2C.

    I want to incorporate a powder dispenser to the printer and try printing with it. The dispenser needs 1 digital and 1 analogue signal to run. I need help in sending a signal from the Gen 6 board to the Arduino to turn the dispenser ON and OFF. So when there is 1 on the output, the dispenser is dispensing and when there is 0, it is not.

    Is it possible to send a signal when the motor of the extruder starts or something, any signal that can be used to turn the dispenser ON and OFF. Here is the link of the code that I am using.
    http://forums.reprap.org/read.php?13,92469

    ReplyDelete
  2. If you look at the circuit you will see the extruder step signal and direction signal are available on the RS485 connector. You have to bridge the pads SJ1 and SAj2 to get access to them. You can always use the PB5 and PB6 spare ports that are available on the ICSP connector CON 5

    ReplyDelete
  3. Hi James

    Could you give a pointer to the GEN6 source code that you used for the above mods. The line numbers do not seem to apply to the latest version of GEN6 f/w and my attempts to add them to that have failed.

    ReplyDelete
  4. Hi Barrule,

    I'm travelling at the moment so not near my dev machine. When I get back I'll look it up to see which version I used.

    ReplyDelete