Commit graph

316 commits

Author SHA1 Message Date
Scott Lahteine d1e6b0e21a Reduce STEP_PULSE_CYCLES code slightly 2017-03-24 00:50:05 -05:00
Roxy-3D b8e4a6970b Get UBL up and running again
All the changes to get the code into compliance with Marlin coding
standards made UBL sick.   This pretty much gets UBL back up and
running.
2017-03-23 16:08:37 -05:00
Sebastianv650 bf57eb2447 Protect Babystepping against other ISRs
Especialy against stepper ISR.
This is even more important when a minimum pulse width is set,
increasing the runtime of a babystep.
2017-03-21 18:05:44 +01:00
Sebastianv650 80830919dc Add MINIMUM_STEPPER_PULSE ability to babystepping 2017-03-21 17:50:38 +01:00
Scott Lahteine 45f949d833 TMC2130 Library: @teemuatlut replaces @makertum 2017-03-07 04:22:06 -06:00
Scott Lahteine fea0d3f20f Endstop and temp-isr general cleanup 2017-03-06 02:07:07 -06:00
Scott Lahteine bfb0007573 Patch DISTINCT_E_FACTORS bug 2017-03-05 23:19:31 -06:00
Scott Lahteine 97b6fb6381 Reduce / optimize LIN_ADVANCE code 2017-02-14 07:52:03 -06:00
Bob-the-Kuhn 0369f97ec1 guaranteed BLTouch detection
To guarantee that the 5mS pulse from a BLTouch is recognized you need to
have the endstops.update() routine run twice in that 5mS period.

At 200 steps per mm, my system has problems  below a feedrate of 120 mm
per minute.

Two things were done to guarantee the two updates within 5mS:
1) In interrupt mode, a check was added to the temperature ISR.  If the
endstop interrupt flag/counter is active then it'll kick off the endstop
update routine every 1mS until the flag/counter is zero.  This
flag/counter is decremented by the temperature ISR AND by the stepper
ISR.

2) In poling mode, code was added to the stepper ISR that will make sure
the ISR runs about every 1.5mS.  The "extra" ISR runs only check the
endstops.  This was done by grabbing the intended ISR delay and, if it's
over 2.0mS, splitting the intended delay into multiple smaller delays.
The first delay can be up to 2.0mS, the next ones 1.5mS (as needed) and
the last no less than 0.5mS.

=========================================

BLTouch error state recovery

If BLTouch already active when deploying the probe then try to reset it
& clear the probe.

If that doesn't fix it then declare an error.

Also added BLTouch init routine to startup section
2017-02-11 12:01:34 -06:00
Scott Lahteine 92dbeebf40 Define ADV_NEVER, ADV_RATE 2016-12-23 18:43:23 -08:00
Sebastianv650 84c685f8b5 First draft of Unified Stepper / E Advance ISR 2016-12-21 01:34:39 -08:00
esenapaj 069c6b38dd Remove unnecessary tabs and spaces 2016-12-16 00:21:32 +09:00
AnHardt d0e24e0876 Adaptive screen updates for all kinds of displays
The target here is to update the screens of graphical and char base
displays as fast as possible, without draining the planner buffer too much.

For that measure the time it takes to draw and transfer one
(partial) screen to the display. Build a max. value from that.
Because ther can be large differences, depending on how much the display
updates are interrupted, the max value is decreased by one ms/s. This way
it can shrink again.
On the other side we keep track on how much time it takes to empty the
planner buffer.
Now we draw the next (partial) display update only then, when we do not
drain the planner buffer to much. We draw only when the time in the
buffer is two times larger than a update takes, or the buffer is empty anyway.

When we have begun to draw a screen we do not wait until the next 100ms
time slot comes. We draw the next partial screen as fast as possible, but
give the system a chance to refill the buffers a bit.

When we see, during drawing a screen, the screen contend has changed,
we stop the current draw and begin to draw the new content from the top.
2016-12-13 18:44:34 +01:00
Scott Lahteine 3f4c02e42f Merge pull request #5259 from Sebastianv650/Allow_UART-ISR_inside_Stepper
Allow UART ISRs inside the stepper ISR
2016-12-01 23:17:42 -06:00
Scott Lahteine 092e949b58 Merge pull request #5169 from thinkyhead/rc_core_inverted
Support for COREYX, COREZX, COREZY
2016-11-28 02:26:41 -06:00
Scott Lahteine e9e4208ff1 Merge pull request #5274 from Sebastianv650/improve_smooth_moves
Improvement for ENSURE_SMOOTH_MOVES
2016-11-28 02:22:08 -06:00
Scott Lahteine 14b74181f5 Merge pull request #5179 from thinkyhead/rc_TMC2130
TMC2130 "Silent StepStick" support
2016-11-21 14:10:52 -06:00
Scott Lahteine 9b96a4a53b Merge pull request #5246 from thinkyhead/rc_some_cleanup
Minor stepper cleanup
2016-11-21 13:55:25 -06:00
Sebastianv650 8190483eeb Improvement for ENSURE_SMOOTH_MOVES
Instead of waiting for a single long block, compare the complete block
buffer runtime for the long_move() check.
2016-11-21 17:58:24 +01:00
Moritz d67c1d825f Add TMC2130 support 2016-11-21 00:17:45 -06:00
Sebastianv650 50059690e0 Allow UART ISRs inside the stepper ISR
If the stepper ISR takes too long, chars are lost which leads to serial
communication errors like "Line number not +1" or "Wrong checksum". In
worst case, the printer can even do crazy moves.

With this changes, UART interrupts are handled inside the stepper ISR.
This way, no chars should be lost.
2016-11-20 13:09:12 +01:00
AnHardt 88b38eafd8 Endstop interrupt refinement
At the start of a move, check if the endstops are already triggered.
The 'change' interrupts will not see a change if already triggered.
2016-11-19 13:30:49 +01:00
Scott Lahteine eb120e518c Followup to new endstop interrupts feature
- Fix typos, verbiage
- Fix naming of `setup_endstop_interrupts`
- Some formatting, indentation, spacing
2016-11-18 21:53:45 -06:00
Scott Lahteine 98600e1433 Minor stepper cleanup 2016-11-18 01:15:57 -06:00
AnHardt f3eee02596 Introduce endstop interrupts
If ENDSTOP_INTERRUPTS_FEATURE is enabled this tries to set up interrupt routines
for all used endstop pins. If this worked without errors, `endstops.update()` is called
only if one of the endstops changed its state.

The new interrupt routines do not really check the endstops and react upon them. All what they
do, is to set a flag if it makes sense to call the endstop test we are used to.

This can be used on:
* ARM (DUE) based boards - all pins can raise interrupts,
* RAMPS - all 6 endstop pins plus some other on EXT-2 can raise interrupts,
* RAMPS based boards - as long the designers did not change the pins for the endstops or at least left enough,
* all boards, if there are enough pins that can raise interrupts, and you are willing/able to swap with pins dedicated to other purpose.
2016-11-15 12:07:41 +01:00
Sebastianv650 cdc18f8c22 Remove useless line from stepper ISR
The flag is already set inside planner.get_current_block(). Doing it
twice isn't making it better..
2016-11-11 19:35:03 +01:00
Scott Lahteine 1864b282c5 Implement reversed CORE options 2016-11-05 23:47:51 -05:00
Scott Lahteine 00662b8635 Minor babystep cleanup patches 2016-11-03 23:31:45 -05:00
Scott Lahteine b23d255491 Move macros above Stepper::babystep 2016-11-03 23:31:45 -05:00
Scott Lahteine cc57d46158 Fix set_position for CoreYZ 2016-11-03 23:31:45 -05:00
Sebastianv650 f9bea7968f BugFix for incorrect E-speed calculation
The extrusion speed was wrong due to a not high enough precision of
esteps to XY steps, therefore now the target float values are used to
calculate the ratio between XY movement and extrusion speed.
The e_speed_multiplier8 was replaced by an absolute multiplier called
abs_adv_steps_multiplier8, therefore one multiplication and bitshift can
be saved inside the stepper ISR. Due to this, also extruder_advance_k is
better suited inside the planner and not the stepper files any more.
2016-11-01 08:08:47 +01:00
Scott Lahteine 43df9ace4e Merge pull request #5110 from thinkyhead/rc_z2_min_allowed
Support Z2 min in M119 report
2016-10-31 07:59:45 -05:00
Scott Lahteine 75dbb71dd7 Replace block.busy with a block.flag bit 2016-10-30 16:16:28 -05:00
Scott Lahteine 8cebd2a7db Arrange Z2 min before Z2 max 2016-10-29 01:54:19 -05:00
Scott Lahteine 083d41a2c2 Remove redundant estep rate code from LIN_ADVANCE
As noted by https://github.com/MarlinFirmware/Marlin/pull/4971#issuecomment-252503295
2016-10-22 02:19:14 -05:00
Scott Lahteine 2cb5df8a56 Merge pull request #4984 from esenapaj/Small-fix-for-PR-#4980
Small fix for the PR #4980 (LIN_ADVANCE bug fix and optimization)
2016-10-10 13:30:47 -05:00
Scott Lahteine f8199b2cc1 Merge pull request #4982 from thinkyhead/rc_abl_bugfix
Fix planner with kinematics, delta ABL
2016-10-10 13:24:22 -05:00
esenapaj cfb5c24bc9 Small fix for the PR #4980 (LIN_ADVANCE bug fix and optimization)
・Fix a comment about timer
2016-10-10 07:48:42 +09:00
Scott Lahteine c5cac486f5 Use a, b, c instead of lx, ly, lz 2016-10-09 14:34:24 -05:00
Scott Lahteine 3752d9aca8 Fix timer comments 2016-10-09 12:11:00 -05:00
Sebastianv650 a448cedbc5 LIN_ADVANCE bug fix and optimization
.) long to int: Extruder stalls at 10kHz / 20kHz step limits with long.
.) Take the delta_adv_steps calculation out of the step_loops loop. Wasted calculation performance if done inside.
.) >> 2 replaced by 3: Is divide by 8. Reason: Timer 0 runs at 16/8=2MHz, Timer 1 at 16/64=0.25MHz. ==> 2/0.25=8.
2016-10-09 11:55:02 -05:00
esenapaj f8df88f271 Move routine of direction signal of ADVANCE and LIN_ADVANCE from Stepper::isr() to Stepper::advance_isr() 2016-10-07 02:01:29 +09:00
Scott Lahteine ecf7cdde65 Augment planner/stepper getters/setters 2016-09-29 01:27:37 -05:00
Scott Lahteine 5fff8d148b Clean up digital pots and microsteps 2016-09-25 11:16:22 -05:00
Scott Lahteine cb48292338 Use fastio for literal pins 2016-09-25 06:33:38 -05:00
Scott Lahteine eabff30e75 Improve MINIMUM_STEPPER_PULSE 2016-09-24 02:23:43 -05:00
Scott Lahteine cc639d7d9c Less indentation in Stepper::isr 2016-09-23 03:03:14 -05:00
Scott Lahteine 7dec8071b2 Always synchronize in Stepper::set_position 2016-09-23 03:03:14 -05:00
esenapaj 954563d603 Adjust spacing 2016-09-20 19:35:44 +09:00
esenapaj 7e9576dc5b Extend the e_steps[] from int to long for allowing more than 32,767 E steps
Probably needed for long straight lines when using high microstepping
2016-09-20 19:35:44 +09:00