Close



Results 1 to 3 of 3
  1. #1

    Adding a Second Gantry to Marlin

    I am working on a project that requires an Azteeg x3 pro to run two separate gantries on a big 3D printer. Currently I am working on the marlin software and editing it to work with two gantries, this is posing a problem. Marlin has a nice dual_x_carriage option and I am basically duplicating all of the code for that but for the y and z axis as well. I have run in to a problem when trying to compile the stepper.cpp file after making some edits that has me confused, I am a programming novice.
    The error I am getting is "a function-definition is not allowed here before '{' token" while highlighting line 849, all this line has is a {
    If I remove the { I get a slew of more errors.

    Any advice on figuring out the error would be nice or just advice on a way to add a second gantry to marlin would also be nice
    I am also working to get two 3D printer controllers talking to one another, so any advice on that would also be nice.
    stepper.cpp

  2. #2
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    I think you have turned on (or off) #define's such that the function declaration structure is broken.

    Functions need to look like:

    Code:
    type  name(parameters) {
    ...
    }
    If you try to declare a new function in the middle of that sequence, you will get the type of errors you are seeing.

    This is kind of a lame cop-out. But if you start with the unaltered stepper.cpp file and start deleting thing you know you don't need, it will simplify the code. For example, if you know you are not going to use

    #ifdef CONFIG_STEPPERS_TOSHIBA

    Then delete the #ifdef and everything up to and including the #endif. Go through the diffrerent #ifdef's and anything you know you don't need, manually edit it out. Probably the code will become much simpler and you will be able to re-use it easier.

  3. #3
    Right now the function looks like:
    Code:
    void st_init(){
    ...
    }
    After diligently looking through the middle of the sequence I can not find another function definition I even made sure the { at the start lined up with the } at the end
    There were only a few #ifdef that I could delete, mostly the dual_z_stepper.

    After some more testing of the error I found that it wont happen if I comment out the
    //void st_init()
    but it would just occur at a later void function definition.
    For instance it is now giving me the same error here:
    Code:
    void finishAndDisableSteppers()
    {
      st_synchronize();
      disable_x();
      disable_y();
      disable_z();
      disable_e0();
      disable_e1();
      disable_e2();
    }
    Here is the full error

    stepper.cpp: In function 'void __vector_17()':
    stepper.cpp:831: error: a function-definition is not allowed here before '{' token
    {
    ^
    stepper.cpp:1372: error: expected '}' at end of input
    }
    ^
    a function-definition is not allowed here before '{' token

    Edit: After about an hour of checking everything I found the error.
    Last edited by WinstonPHz; 01-16-2016 at 08:33 PM.

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
  •