-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Planner: Acceleration parity with 1.1.0 and some optimizations #15
Conversation
Scott, I appreciate another pair of hands looking into the changes I have made to
You made a plenty of cosmetic changes to the code, it is quite difficult to Currently we do not see any issues with the speed of our firmware on the Thanks, Vojtech On Tue, Oct 11, 2016 at 10:53 AM, Scott Lahteine [email protected]
|
I meant a pair of eyes, naturally :-) On Tue, Oct 11, 2016 at 11:25 AM, bubnikv . [email protected] wrote:
|
This link will hide all the whitespace edits so changes are easier to see:
The code block pasted in the original post is one example. That's a case where a
Here's the Ultimaker issue in which the change was raised… Ultimaker/Marlin#7
I'm sure it performs very well! Cartesian is ideal because it puts the least amount of stress on the CPU, so everything can run more smoothly. I mention in passing that there's an optimization or two, but my point is more to pass on any useful changes or fixes I happen to find while I'm in the process of adapting your innovations to the Marlin 1.1 codebase. This change in the acceleration code was an interesting fix. Actually, while the main Marlin branch has adopted the adjustment, I'm not sure Ultimaker ever committed the change themselves. |
eab67c0
to
dde3944
Compare
I actually ended up reverting part of that patch of acceleration code, as it's too likely to overflow. It's still more likely to overflow now, because it's using not using #define LIMIT_ACCEL(AXIS) do{ \
- const uint32_t comp = max_acceleration_steps_per_s2[AXIS] * block->step_event_count; \
- if (accel * block->steps[AXIS] > comp) accel = comp / block->steps[AXIS]; \
+ if (max_acceleration_steps_per_s2[AXIS] < (accel * block->steps[AXIS]) / block->step_event_count) \
+ accel = (max_acceleration_steps_per_s2[AXIS] * block->step_event_count) / block->steps[AXIS]; \
}while(0) I like the option of moving towards more "fixed point" maths, although as long as the values are expressed in stepper steps, plain old integer maths will cover most cases. As an intermediate option, we might consider doing some 40-bit integer maths using inline assembler – adding in just enough extra bits to catch those overflows, but requiring neither |
The stack usage may be a problem indeed. For example, when the menu system is called from the planner when waiting and then when calling something from the menu, which calls the planner. These kinds of recursions are deadly and I have fixed one long standing Marlin crash due to this stack overflow, when moving axis from the menu. You may look into my changes in the menu system, where I have reduced the usage of static variables by using unions. Look into ultralcd.cpp, union MenuData. |
Of course, I refer to the overflow of a 32-bit integer value, not stack overflow…
Oh yeah. Those were fixed as soon as I spotted them, so the current Marlin code (1.1.0-RC) is much better. (In fact, literally hundreds of bugs have been addressed since Marlin 1.0.x.)
I will, thanks! We're definitely trying to move towards more encapsulation. No doubt, |
Maybe we shall look into the current Marlin code base after all :-) On Fri, Oct 21, 2016 at 2:54 AM, Scott Lahteine [email protected]
|
@thinkyhead FYI Pavel has implemented a stack overflow check into our firmware. This is extremely useful if your stack usage is at the limits and / or if you have some unexpected recursion going on eating up the stack. The stack check sets a guard variable at the end of the static variables block and the guard is tested regularly for a change of its value. |
A good thing to have! A while ago, @Roxy-3D added an Today I started to incorporate your Multiplexer! If you have a look at MarlinFirmware/Marlin#6938 you'll see that it was really easy to incorporate the basic hardware part under the new codebase compared to the old Marlin code. The next thing I'm doing to the firmware code —this weekend— is to break it up into a proper file hierarchy and putting every G-code handler in its own file. It will look pretty much like this. That will be released as Marlin 1.2.0 as soon as it's ready. Version 1.2.0 will also incorporate a Hardware Abstraction Layer so that Marlin can run on 32-bit boards like the Due and Re-ARM I have sitting on my desk. There have been a lot of requests for that. |
Scott, do you have any idea what the following is for?
Thanks, Vojtech |
Linear Advance
It's for SD card procedures. You can have one SD file start another one, and when it's done, continue where it left off. There were bugs in that code which I fixed earlier this year. Now it works very well! |
Additionally: |
Another code comment that I wrote after getting intimate with the issue: * M32 - Select file and start SD print: "M32 [S<bytepos>] !/path/file.gco#". (Requires SDSUPPORT)
* Use P to run other files as sub-programs: "M32 P !filename#"
* The '#' is necessary when calling from within sd files, as it stops buffer prereading |
shouldn't this be closed already? |
PFW-1312 Define layout of LCD for MMU error screens
@thinkyhead I gonna close this PR thanks. MK2 branch isn't maintained anymore. |
As I'm working on integrating improvements to the planner Speed and Jerk code in the main Marlin project (See MarlinFirmware/Marlin#4997), I find it useful to cross-pollinate and bring some of the updates over to this branch, which is my reference.
So this PR's main change is: Apply the acceleration technique adopted into Marlin based on Ultimaker's fork… Optimize the maths to remove most division, using multiplication where possible.
Additionally:
steps_x
,y
,z
,e
into an arrayaxis_steps_per_sqr_second
=>max_acceleration_steps_per_s2
planner.cpp