Need help :( I cant get my marlin to compile after adding servo endstop

Need help :frowning: I cant get my marlin to compile after adding servo endstop (latest development).

It looks to be the row

#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles” thats the problem.

When compiling I get

“Marlin_main.cpp:2782:1: error: pasting “SWITCH_ENABLED_” and “{” does not give a valid preprocessing token
Marlin_main.cpp:2782:1: error: token “{” is not valid in preprocessor expressions”

This is the complete servo part

// Number of servos
//
// If you select a configuration below, this will receive a default value and does not need to be set manually
// set it manually if you have more servos than extruders and wish to manually control some
// leaving it undefined or defining as 0 will disable the servo subsystem
// If unsure, leave commented / disabled
//
#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command

// Servo Endstops
//
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
//
#define X_ENDSTOP_SERVO_NR 1
#define Y_ENDSTOP_SERVO_NR 2
#define Z_ENDSTOP_SERVO_NR 0
#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

// Servo deactivation
//
// With this option servos are powered only during movement, then turned off to prevent jitter.
//#define DEACTIVATE_SERVOS_AFTER_MOVE

#ifdef DEACTIVATE_SERVOS_AFTER_MOVE
// Delay (in microseconds) before turning the servo off. This depends on the servo speed.
// 300ms is a good value but you can try less delay.
// If the servo can’t reach the requested position, increase it.
SERVO_DEACTIVATION_DELAY 300

#endif

Make sure you are using Arduino IDE 1.0.6. Do not use the latest version.

@Keith_Applegarth
Out of interest why not the latest?

@The_Hozza
The latest version generates a lot of compiling errors.

Is it intentional that you defined an array with six integer entries (0, 0, 0, 0, 70, 0) and not three floats (0.0, 0.0, 70.0)?

(0, 0, 0, 0, 70, 0) Is the default values, I need (0, 0, 0, 0, 112, 30) but Im trying to go back to default to trouble shoot.
Im running arduino IDE 1.0.5-r2

Ok, the grouping made it look like a typical case of decimal comma vs point, hence my asking.

@foosel ​ It’s not an array, arrays use square bracket delimiters. In this context it is an initialiser list which can be used to assign values to an array. Looking at the associated comment the list appears to contain two sets of x,y,z values.

@Markus_Granberg ​ Check the usage of SERVO_ENDSTOP_ANGLES in the code. In particular ensure the statement that contains it has a semi-colon (:wink: following it.

@Neil_Darlow ​ Sorry, wrong choice of words (the exact data structure was not what I was focusing on) and comments can lie. I don’t know the relevant source code lines for servo stuff in Marlin, the odd grouping there struck me as odd however.

@foosel ​ I read it as three pairs of data for x, y and z to specify the extend and retract angles. It could have been expressed better and I would initialise a const struct instead of using an ambiguous #define.

Try compiling it with version 1.0.6.

Thanks for the input!

Here is my configH file if someone want to give it a try (its from the latest develop branch). The reason Im moving from release to develop branch is to get the z probe to lift before retracting. I cant get it to work!

https://drive.google.com/file/d/0B7kgdYk7GVumOElwNE12cmJIdDA/view?usp=sharing

And im downloading arduino ide 1.0.6 and latest now to try

@Markus_Granberg what version of Marlin are you going to? I would like that feature too.

@Keith_Applegarth Arduino 1.0.6 didnt work… I downloaded the latest marlin under development branch on github.

@Markus_Granberg I will take a look when I get home. Usually the error points the way…

Thanks!

@Markus_Granberg Sorry, but I did not get to it last night. My own machine decided to lose it’s mind. So that took priority. however, now that I know that there is a version of Marlin out there with the enhanced G29, I want it even more… As a thought, have you tried downloading a fresh copy and trying to compile it as is first? That way, at least you know you have a good download.

No problem. It compiles as it is when downloaded, but the servo funktion is disabled by default.

Ok. That is a start anyway. I also use a servo for autoleveling. Usually, the error is a decimal point some where.