Why would Repetier firmware throw Unknown command for M340

Im setting up a BLTouch and i followed the following  but when i go to test it by sending the command via terminal M340 P0 S700 on octoprint i get Unknown command followed by that command. 

What am i missing?

Comments

  • M340 controls a servo. If you get that message you have no servo support compiled in firmware.
  • Isn't this it?

    #define FEATURE_SERVO 1
    #define SERVO0_PIN 6
    #define SERVO1_PIN -1
    #define SERVO2_PIN -1
    #define SERVO3_PIN -1
    #define SERVO0_NEUTRAL_POS  -1
    #define SERVO1_NEUTRAL_POS  -1
    #define SERVO2_NEUTRAL_POS  -1
    #define SERVO3_NEUTRAL_POS  -1
    #define UI_SERVO_CONTROL 0
    #define FAN_KICKSTART_TIME  200
    #define MAX_FAN_PWM 255
  • Yes, that would be correct. If you look into commands.cpp you should see something like this:

    #if FEATURE_SERVO
    case 340: // M340
    if (com->hasP() && com->P < 4 && com->P >= 0) {
    ENSURE_POWER
    int s = 0;
    if (com->hasS())
    s = com->S;
    uint16_t r = 0;
    if (com->hasR()) // auto off time in ms
    r = com->R;
    HAL::servoMicroseconds(com->P, s, r);
    }
    break;
    #endif // FEATURE_SERVO

    Only if a case in the M list is empty you get the unknown command response. So check if there is another define setting it to 0. Servo support is already quite old so it should be in all 1.x versions.
  • Adding that does not get added to support, when i add the bellow commands it does not compile error at the case 340: // M340 line
  • I did not mean that you should add it. It should already be there - I meant more to check if it is there. If not question arises which firmware version you are using that it is not there.
  • its not there im using 1.0.3 from the configurator
  • It is there in 1.0.3. File commands.cpp line 2438 so please recheck. And then check your configuration if you have defined it twice somehow that it is 0. You can also modify the code to get a definitive error message 

    #if FEATURE_SERVO
    #error Servo support
    case 340: // M340
    if(com->hasP() && com->P < 4 && com->P >= 0) {
    ENSURE_POWER
    int s = 0;
    if(com->hasS())
    s = com->S;
    uint16_t r = 0;
    if(com->hasR()) // auto off time in ms
    r = com->R;
    HAL::servoMicroseconds(com->P, s, r);
    }
    break; #else #error No server support
    #endif // FEATURE_SERVO

    The #error lines will abort compilation, but you see if it compiles with FEATURE_SERVO 1 or 0 at that part.
Sign In or Register to comment.