[2.0.x] Split first planner move for better chaining#8611
[2.0.x] Split first planner move for better chaining#8611thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
Conversation
26d1511 to
8cb0898
Compare
4458d92 to
d343134
Compare
d343134 to
3a97de5
Compare
|
thanks for answering and reverting the commit. I'll try your suggestions soon... |
|
didn't know if you want me to test these together or separate so I tried all combinations. I enabled the debug outputs (had to change all to SERIAL_PAIR). One reproducible behavior is this: |
|
ah, when I reversed the direction (up) from there, the axis still moved down, but each move was shorter then the previous, until it stops at zero speed. |
|
If I home Y and move 100mm and 100mm back, I get this: I have 80 usteps/mm for X/Y and 400 for Z. |
[2.0.x] Revert PR #8611 — split first planner move
|
I also enabled another debug print section I found. So, now I homed and then moved Z down a bit to come out of the endstops. Now I moved 1mm down each and after the I also noticed, that you write |
|
narrowing the issue... I changed the debug output to see the position->target pairs in _buffer_line. BUT... as you can see here, it is different with X... X always moved correctly, only the first move was far to long. I guess it had a wrong start position. I wonder if it only effects corexy? or any kinematic printer? |
|
seems like COPY doesn't work for anyone but X: |
|
that's the reason: |
|
Great finding! |
|
this is one of the C relicts. You can declare the array parameter like this you can protect it by But I wonder if it should be solved generally... |
|
that's how it is done in ubl_motion, which cries out for a more general decision: |
so an i1 :-) called Murphy |
|
@thinkyhead (or who may change the pull request) here is a patch for planner.cpp and planner.h It uses the array parameter as reference. I am not sure, which compilers and versions are supported by Marlin, but this should work for most C++ compilers. It's quite standard for a long time. |
|
D'oh! |
A general principle is to define a macro for things we do often, to save on typing if nothing else. I believe that The subject of unit tests has come up a lot, including another new issue recently. If someone wants to "get on that" it seems like it would be a good thing! I'm not sure what a total application of unit tests would fully entail, but I think it's a good idea. To be completely thorough we'd want to insist that every function include some I've proposed a "simulation build" before, but better would be a "unit test build" that when booted doesn't run the main loop, but just runs internal tests on the firmware to test expected function behavior, where every function has —essentially— extra debugging added into it to (at minimum) check the inputs, and where the test code checks for expected output and/or other effects. That might be easier said than done, depending on what kinds of tests it runs. It could get fancy and ask for user input to test LCD functions, and so on. I guess then we're talking about a whole separate |
|
the whole unit test thing would be much easier if everything would be class based. |
|
should we start an issue for discussion? |
Contributors should feel free to consolidate code into singleton classes, as I've done with Marlin's first aim as an AVR-based firmware is to find ways to improve performance, keep the code small, and keep SRAM usage low. Classes in Marlin are used more as a convenience, to group related code, than for the benefits that classes are generally touted for — inheritance, easy instantiation, and so on. C++ code can be written in such a way that it doesn't sacrifice performance, but some principles have to be kept in mind.
I've got a lot of things on my plate right now trying to juggle the next 1.1 release with fielding issues, following up on bug reports, and keeping the 1.1 / 2.0 branches in sync. If we're going to start applying unit testing and all the rest, I suggest that this effort be delayed until the 2.0 release, whenever that is. There's no way I'm going to be able to take on the load of yet another overhaul to two separate branches. |
|
totally clear :-) |
Based on #8608
Addressing #8595.
Always split up the first move to an empty planner so that subsequent moves will be able to chain more easily.