add M-Code

hi togehther,
how I can add a new (not used) M-Code to the firmware?

kind regards

Comments

  • Best solution is to use the Custom Event System.

    there are  some examples here:


    or an empty template for G- and M-Codes here:




  • edited October 2019
    HI RAyWB

    Thank you for your quick response and help and excuse my bad English!
    I do not understand the examples, sorry.
    I have started like this:

    CustomEvents.h:
    #define blower_fan

    CustomEventsImpl.h:
    #define blower_fan FAN2_PIN  // blower fan on/off  mit fan2_pin

    but how do I define the command like M336?


    //#########################################################################################
    //#### MCode addition/replacement
    //#########################################################################################


    bool Custom_MCode(GCode *com)
    {
     
      switch(com->M) {

            //XXXX is the number you want to generate
        case 336:
       
    //    break;   
      default:
         return false;
      }
      return true;
    }

    #endif




    kind regards
    goair








  • Quote "how do I define the command like M336?"

    at least you should have some programming skills , why don´t you look at the  original  commands implemented
    in Firmware?
  • I had look but you are right, I`m not a programmer and unfortunately I understand the composition too little.
    ...but who dares nothing, who gains nothing.

    I had found this
    case 355: // M355 S<0/1> - Turn case light on/off, no S = report status
            if (com->hasS()) {
                Printer::setCaseLight(com->S);
            } else {
                Printer::reportCaseLightStatus();
            }
            break;

    but how next...


  • may be you first should describe what you want to do exactly
  • Hi
    I would like to add a blower, which I control via fan1 output with a free M code.
    but it should also be controllable via the menu, such as the case light.

    regards
    goair

  • Just use the second fan. They can be controlled with P0 for first and P1 for second extruder with normal M106/M107. Repetier-Server will also offer control for both if you increase fan count to 2 in configuration.
Sign In or Register to comment.