-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NUM_SERVOS > 1 compile time error #7734
Comments
Extend the array until big enough for NUM_SERVOS
|
Ah, of course. Thanks. |
I'd recommend placing something in the comment text & and/or assert message about that, something like "SERVO_DELAY should be comma separated list of values equal to NUM_SERVOS. For example, for a three servo configuration, you could use SERVO_DELAY { 300, 300, 300 }" |
In C, if you don't specify the full number of initialization numbers... It should just replicate through the array. int a[4] = {300}; should just fill the entire thing with 300's ???? |
Well, with this in configuration.h:
I get the issue described above. If I set servo_delay to:
It works. Likewise, if I set NUM_SERVOS to 1, but leave SERVO_DELAY with { 300, 300} the assert fails (as it should). So, I think it's working as advertised, it's just not very clear from the configuration.h comments that SERVO_DELAY is now an array. |
It should indeed be explained in the comments of configuration.h that SERVO_DELAY is a braced init list for an array. Since C++ now has uniform initialization, that fact is not obvious from the syntax. |
Alternatively, change line 150 in Marlin/src/HAL/shared/servo.cpp from: Then, in configurations.h, SERVO_DELAY could be either |
Last I checked, elements that are left out in an initializer list get initialized to 0, not to the single provided value. So this: constexpr uint16_t servo_delay[3] = { 300 }; …actually gives you this… constexpr uint16_t servo_delay[3] = { 300, 0, 0 }; |
Oops. Anyway, once the documentation (e.g. at http://marlinfw.org/docs/configuration/configuration.html#extras-2 ) is updated after Marlin 2.0 is stable, this won't be an issue. PS: Thanks for correcting me. I used too much Python recently. Marlin is great, I use it for my DIY lab robot (PipetBot-A8). |
Oy, yeah… The configuration documentation needs a major revision, and needs to be split up into several pages (most likely based on the |
I am new to these stuff . |
@Sidans regarding #7734 (comment).
After reading the very specific instructions for configurating Marlin1.1.x for BL Touch and the instructions for BL Touch found using google, you might realize that BL Touch is controlled in a similar way to an RC servo. (not to be confused with stepper motors). |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Compile Error
When I compile with
NUM_SERVOS > 1
I get an error:I believe commit e9c7297 is to blame; It added the following:
My C is rusty, but my understanding is that what is being asserted is not what was done to the array; shouldn't the array length be declared as NUM_SERVOS long if you're going to test against that?
I'm actually confused what this commit is trying to achieve; is the idea that each servo could have a separate delay (hence the array)? If so, there doesn't appear to be a way of setting them individually.
The text was updated successfully, but these errors were encountered: