-
Notifications
You must be signed in to change notification settings - Fork 734
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
dev2 - Z-probe sometimes ignored - crash into bed #910
Comments
There are some magic numbers in the code "Motion1::stopMask = 4; // z trigger is finished" that seem odd. It basically refers to A_AXIS and not ZPROBE_AXIS? |
Mask is a bit field, so 1 = x, 2 = y, 4 = z, 8 = E, 16 =a, ... What probe type are you using? In other thread you said type 2 but that is nozzle as probe which has no offset to activate. There only position is moved to valid region = bed minus safety border. I guess you use type 1 = default zprobe or 3 = BLtouch. |
Yes, sorry. I use type 1. There is the possibility though that the previous move to location triggers the endstop to snap to disabled and that this happens at the exact point the code switches over to probing. Since it checks the endstop only once before recalculating the path needed for the probe it could possibly end up not seeing the transition as it queues the move and starts to wait? |
Not sure I can follow here. Looking at float ZProbeHandler::runProbe() I see that it return without any move if probe is already triggered. Inside the for loop it does measurements and always moves back again to start position, so will in theory never stop at bottom. Then it is updated again. One problem are zprobes where high signal is only short like BLtouch. That is why we have that as special case to test also fro probe error state. That is the only probe I have for testing at the moment. Hope I can test soon - printer is not 100% functional at the moment a sit is a delta and I also need to check delta function working in parallel. Anyhow in this code segment
The head should always move back. What is your Z_PROBE_REPETITIONS value? On repeated moves it does not move full distance back and there could be miscount. BTW: What is your test script you are running here? Just to understand the condition under which the problem happens. |
I am running bed map from Repetier Host with 20x20 points. |
I only do single probes. No repeated with averages. |
My understanding is that only updateReal() in EndstopSwitchHardwareDriver will update correctly. My suggestion is to check the flag again before waiting, but after setting the states to probe. |
I am trying to add an error message right before the moveByPrinter() to catch this. |
What endstop type are you using? I currently always use ENDSTOP_SWITCH_HW which triggers an interrupt and stop move directly. The polling solution always calls update() to get updated state on each step. updateReal() is special case for hardware endstop. That is the function called by processor on signal change and updates state for later use in update(). Looking into it you would need to have the end stop for z probe defined as zaxis, false (dir -1) so it stops motion
as that is the only way it would tell it if you have |
Nope. Did not catch it... It crashed into bed again. This time I simplified my test. It just kept dinking into the same spot untill it suddently kept on going and crashed into bed. |
And yes, I use ENDSTOP_SWITCH_HW and that is the issue I think. |
Can you post your 2 configurations. Guess it might be important which exact settings you have here. |
I guess I don't home as often as I probe so statistics is in my favour there. |
Also great, just give me the link then and I check there. |
I will switch the z probe to polled and compare. |
Wow. Well, changing the z probe to a simple polled probe makes it just ignore it all together. Edit: I ofcource forgot to remove NO_SOFTWARE_AXIS_ENDSTOPS. Edit 2: Nope. Still ignores it... |
I think I found something. |
Could it be as simple as motion trying to move to next segment of travel while being interrupted by pin-change which sets flags to abort in the active segment. The active segment is then discarded when motion resumes and it can no longer see it should have stopped? |
WInterrupts.c is part of the core arduino framework by the way, so a workaround or safeguard would be needed in motion... |
I am using quite slow accelleration so it is possible that the move is split into multiple segments to handle the accelleration and the hig happens just as it runs activateNext()? This would allow the probe hit to affect the old segment and then upon continue the new segment replaces it. |
Well... I thought I could bypass it by removing #define NO_SOFTWARE_AXIS_ENDSTOPS and letting the code check as normal. This did not work. |
Motion3 should have highest priority, but I saw it was set to 3 in hal.cpp. Changing it to Looking into code I think skipParentId would be the crucial variable. It gets set to force Motion3 to finish line, but only activateNext changes it if the line is finished meaning z move is executed. So even if we missed the check it means 1 extra step until move is popped. I have tested it 100 times on my delta G1 P1 + 18x G30 P0 then G30 P2 no errors. That is on a stm32F4 board where interrupt priority is 0. So not sure if it priority, other speed or just luck. I also got no shift of position, but maybe I need to move xy in between to get that error. |
I think I discovered the reason for the shift. As for the priority, pin change interrupts appear to have higher priority than timer interrupts so even at equal priority ranking the pin change will win. Solution is to make sure the operation in timer3 is safe. |
The reproduction is very dependant on machine accelleration I think. I made my script like this: ` G91 G91 G91 The middle two repetitions would then be copied a LOT of times. (2-400) and it would probe same spot over and over. Starting with probe almost touching. I also want to repeat that it did not work even if I removed the NO_SOFTWARE_AXIS_ENDSTOPS which could mean the polled method is vulnerable too. |
There is an error in MotionLevel3.cpp line 166
I think it should be
Explains at least why polling for z probe does not work. Regarding interrupt - you are right as I understand the lowest vector is the tie braker here. So adding
to void HAL::setupTimer() should help here. When called it blocks interrupts
so we only need to prevent calling it while in motion3, also I still do not see how this can cause the side effect but it makes sense regarding the frequency it happens. Would be great if you can recheck. Will also try tomorrow if I can get it with my setup - but different processor alone could already prevent it from happening. Maybe I should test on my felix also it has other z probe type, but same timings. |
Very cool. I've been avoiding the bed map so far due to this and focusing on the tuning of the retracts etc. Later I will run direct extrusion but I need to design the extruder first... Here's a clip showing Repetier Firmware (with slight patch) run a real Core-XYZ! |
Hey! Back from a little absence. But one first bug:
I'm not entirely sure if it's related, though I had this issue as well. In MotionLevel1.cpp line 784, in the function: buf.length would occasionally already have something it was set to, affecting the planner's speed. As for the main bug, My fix was to attempt to skip to the next act via Motion3::activateNext() if it's a null pointer and we're also probing. A bit dirty but fixed it for the time being. In MotionLevel2.cpp, line 557
However:
Thanks! er, this fixes another issue I had assumed was just my configuration/HAL modifcations... software Z endstop works correctly now. And now: using software endstops seems to eliminate the problem, possibly confirming it's interrupt related. -- A side note: Once the bed probing problem was fixed, another issue I had was that distortion was being applied in "reverse". My printer's bed physically moves downwards whenever I "raise" the Z axis. |
I've just found it odd how we map from probe level to bed with probe. Makes the maps created by Repetier Host look odd and inverted. |
eat post. Regarding buf.length you are 100% right. Not only occasionally it is not zero but it just has the length 16 moves ago and then accumulates to that, so setting to 0 is a must. Regarding act = 0 is also a good hint. That in deed would lead to the hardware interrupt not triggering end stop. And at the end of each motion3 block you have: Just testing it and fixing delta problems as well to make G32 complete, so I can test the distrotion problem. No need to choose - it just should do it correct:-) |
Host just measures distances from given z and reports them. It is not a correction map. But I agree on sign in firmware correction it would be intuitive to have positive number for above bed. I think currently it is different but I'm as said struggling to get measurement complete. Computation of correct allowed region is somehow not as wanted so last row measures off bed. Special delta problem where not all points are reachable in a circle:-) |
Yes. Ideally such a probing would just be a circular or spiral pattern on a delta. We have noticed the correction done in development for the probing as it seems to improve things a lot. But still something is off with the extrapolated corners. Looking forward to testing the new tweaks to see if I can atleast circumvent the probing issue. Machine repeatability seems really good so far and I need the probing to determine where the machine has deviations vs where the bed is actually warped. Will be probing a granite straight-slab. That should show what is real... (Nice to have a machine you can actually put a 2' granite slab in btw. |
Ok, I think I have sorted out the problems. Only thing is with my delta I would never get the z-homing error since the update happens inside motion3 timer in that case due to delta special problems. So would be great if you can confirm that it is really working now. I also improved (i hope) the extrapolation of unknown points. Swapped distortion correction direction. Positive values are upwards bumps in bed. I also added M48 to check z probe repeatablility. Would be great if someone could test that as well and port the result. Somehow I get with my 3d touch a very worse repeatability with difference > 0.2mm which is not good. Since that is a new sensor I don't know if I missposition all the time or if the sensor is that bad. |
Merged/updated to the new changes. Thanks for the M48 function. Two quick bugs I spotted: M48 returns NAN if the bump distortion is disabled via EEPROM since Leveling::distortionAt returns weird/NAN values. In ZProbeHandler::runProbe() line 265, uncommenting the isDistortionEnabled check fixes it. In the Motion2::endstopTriggered bug fix: the buffer act pointer wasn't being updated after activateNext() so it'd firmware crash. After adding that line, no issues spotted so far! After running M48 I got: Running it a few times in different spots and the deviation hovers around the same (0.0008+/-). >0.2mm deviation seems crazy. Is that a clone? I remember reading that clones had poor accuracy compared, but never realized they were that bad... Unfortunately I don't own a delta printer so I can't test any delta related changes. :( |
Thanks for testing. Have updated github with fixes. Did remove the distortion adding in zprobe. I think it is better to not include it there. Before my update it was even forbidden, but now it just gives a warning. Problem is that the result depends on your starting height which might already compensate that error fully or partially or not at all. Your M48 look like what I'd expect. I've seen a comparison between bltouch and 3dtouch where bltouch was better but just maybe factor 2. I currently are way off. Unfortunately the bltouch I bought is kinda defect. On a head brush the pin was bent and now it does not reliable pull/push the pin any more. |
During large probing sessions the back move is apparantly not executed correctly and motion continues to bed. Popping probe up to inactive state. (In this state it reports H as if it was triggered.)
Instead of aborting and backing off and reporting an error, the fw continues to grind into bed.
If I deactivate the probe before a G30 to test it jiggles about and aborts with message to host about error, so this works as expected.
I have also noticed that some of the back-moves after probe hit is done at wrong speed and I suspect this is related.
The text was updated successfully, but these errors were encountered: