Commit Graph

364 Commits (82a9eaae436dc927ef71ed6293ceb4d58ef46824)

Author SHA1 Message Date
Alex Voinea 82a9eaae43 Fix selector noise. IRUN=31(VS=1), MRES=x8 2021-09-16 10:30:27 +02:00
Alex Voinea bec3f73864 Fix typo
typo
2021-09-16 10:30:27 +02:00
Alex Voinea 91f622fcdc Tighter TPWMTHRS at standstill 2021-09-16 10:30:27 +02:00
Alex Voinea e0babfa4ba Updated motor currents and added freewheeling 2021-09-16 10:30:27 +02:00
Yuri D'Elia ad096c9d14 Motion: make Motion::Step finally inline 2021-09-07 15:09:49 +02:00
Yuri D'Elia b7fcfa5cb5 Add tests for single and multi-axis AbortPlannedMoves()
This introduces a new #define UNITTEST_MOTION which is used to control
the testing scenario:

- Normal tests, we allow the stub to override the built-in definition.
- For motion tests, we stub the lower-level classes and test the
  effective implementation

We also repeat the prototype of the function, which IMHO is more
readable and more flexible: we need to use inline for the real
definition, which would require even more macros otherwise.
2021-09-07 15:09:49 +02:00
D.R.racer 37ff9b8a8f Fix unit tests for AbortPlannedMoves(axis) 2021-09-07 15:03:36 +02:00
D.R.racer a6800d491d Leverage the capability of aborting a move on just one axis 2021-09-07 15:03:36 +02:00
D.R.racer b1b5b9db84 Set better planned moves for homing + abort moves at StallGuard 2021-09-07 15:03:36 +02:00
D.R.racer 52a6d57704 Remove Motion::Home completely 2021-09-07 15:03:36 +02:00
D.R.racer dea41738a5 Add homing capability to Idler and Selector
MMU-73
2021-09-07 15:03:36 +02:00
Yuri D'Elia d18032b729 Motion: allow to abort movement on a single axis
This can be useful for things like faster homing in the future and comes
at no expense.
2021-09-07 14:48:06 +02:00
D.R.racer a380a698d9 Remove unnecessary #include 2021-09-07 14:17:03 +02:00
D.R.racer 3646b8b1c0 Change M0/M1 into a command
That implies changing motor's mode from SpreadCycle into StealtMode (or vice versa)
requires a stand still MMU with no other command (i.e. motor moves) being performed.
This elegantly solves the synchronization problem of TMC2130 mode change, as it results
in severe jerking while a motor is moving.

The change in protocol is minimal - M0/M1 first return `M0 A` (accepted) and another `Q0` then
returns `M0 F` (finished). The MK4 counterpart may ignore the additional report if necessary
as the mode change is done immediately (shortly after responding with `M0 A`)
2021-09-07 14:17:03 +02:00
Alan Dragomirecký 641b91f0cb git subrepo clone --branch=LUFA-210130 git@github.com:abcminiuser/lufa.git lib/lufa
subrepo:
  subdir:   "lib/lufa"
  merged:   "fa2cc3e1c"
upstream:
  origin:   "git@github.com:abcminiuser/lufa.git"
  branch:   "LUFA-210130"
  commit:   "fa2cc3e1c"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2021-09-06 15:56:43 +02:00
Alan Dragomirecký b842f58bc8 Add lufa to pre-commit's exception list 2021-09-06 15:56:43 +02:00
D.R.racer 09f81f8b33 Leverage the ability of motion to SetMode to all know axes 2021-09-02 12:27:41 +02:00
D.R.racer 852ca37e8f Add stealtMode flag into the global storage hive
May be used elsewhere to return to the desired motors' mode e.g. after homing
(which requires switching to normal mode)
2021-09-02 12:27:41 +02:00
D.R.racer 1e6194a9b9 Add support for M0/M1 messages
... route the messages into modules::motion's SetMode of all axes.
2021-09-02 12:27:41 +02:00
D.R.racer 315530ec16 Rebase onto main, reflect FINDA change (ADC->digital pin) in unit tests 2021-09-02 12:15:55 +02:00
D.R.racer 5a53acd802 Force Tool Change to load the filament if same slot but not loaded
MMU-63
2021-09-02 12:15:55 +02:00
Yuri D'Elia 6f3540a14d Fix Motion::SetMode(axis, mode) and introduce SetMode(mode)
Motion::SetMode(axis, mode) was incorrectly looping through all axes,
setting the same axis three times.

Fix this and introduce Motion::SetMode(mode) which actually loops
through all axes (see PR #110)
2021-09-02 12:04:59 +02:00
Yuri D'Elia e7cba346da Use relative paths for panic.h
Avoids adding the main directory as an include path
2021-09-02 12:00:59 +02:00
Yuri D'Elia ee8c80e5c4 Motion: Panic if queue is full
If the queue is full and a new move is queued, panic!

Introduce a new error code QUEUE_FULL to help diagnose situations where
the queue is handled improperly: likely one of the state machines not
waiting for the previous actions to finish.

PulseGen::PlanMove returns a boolean if the queue cannot be moved.
We could extend this to Motion::PlanMove, however all moves would then
have to check for this. Having a global check such as this ensures
we never ignore such situation.
2021-09-02 12:00:59 +02:00
D.R.racer ac78619b5b Cache TMC error flags inside movable_base class 2021-09-02 08:35:56 +02:00
D.R.racer 309d4704b7 Fix return value of TMC2130::Init 2021-09-02 08:35:56 +02:00
D.R.racer b708e67a19 Verify repeated calls to Step do not change from ERRTMCFailed 2021-09-02 08:35:56 +02:00
D.R.racer 161e46b09a Add unit tests for failing TMC
more stuff will follow as these situations seem to cause various issues
2021-09-02 08:35:56 +02:00
D.R.racer 1d884d9099 Make motion::QueueEmpty inline for non-UNITTEST builds 2021-09-02 08:35:56 +02:00
D.R.racer 712b67beb4 Add checking of TMC2130 error states for Idler and Selector
we shall think about the Pulley as well, it looks like it should get its
own class just like Idler and Selector as it behaves very similarly in terms
of stepping and error checking
2021-09-02 08:35:56 +02:00
D.R.racer ffe5bc2807 Make Idler and Selector only wait for their own axis
... and fix the unit tests for this
2021-09-02 08:35:56 +02:00
D.R.racer 5571e77809 Improve/fix some comments 2021-09-02 08:35:56 +02:00
D.R.racer 74629f0103 Fix reporting progress of running commands
The problem was the error state while running a command - we never used the RUNNING error state.
2021-09-02 08:35:56 +02:00
D.R.racer b4d4807971 Add globa Panic() function
The intent is to halt the firmware while retaining the reporting capabilities and blinking LEDs
2021-08-31 14:19:40 +02:00
D.R.racer dc3d8941f7 Fix formatting 2021-08-31 06:59:29 +02:00
3d-gussner 1c565ddc02 Update documentation 2021-08-31 06:59:29 +02:00
3d-gussner 59db864329 Clean up code findaADC.. 2021-08-31 06:59:29 +02:00
3d-gussner 763e33f79a Fix unit test: unload_filament 2021-08-31 06:59:29 +02:00
3d-gussner d5e473f9c9 Fix unit test: tool_change 2021-08-31 06:59:29 +02:00
3d-gussner 12cf25511a Fix unit test: load_filament 2021-08-31 06:59:29 +02:00
3d-gussner 3d121c1ca9 Fix unit test: unload_to_finda 2021-08-31 06:59:29 +02:00
3d-gussner 382a2c8dc0 Fix unit test: feed_to_finda 2021-08-31 06:59:29 +02:00
3d-gussner a7a55b4039 Fix unit test: cut_fillament 2021-08-31 06:59:29 +02:00
3d-gussner 003b2f6899 Change FINDA from ADC to digital
Fix rebase issues
2021-08-31 06:59:29 +02:00
D.R.racer 06c46b20a6 Turn off green LED after load/unload finished successfully
MMU-65
2021-08-30 17:34:46 +02:00
Yuri D'Elia e9e43f744d Correct pulley steps by experimentation
Test performed by moving 500mm of filament back&forth 5 times across 5
pulleys of a MMU2 unit.

The error with this factor is centered around +/- 1.5mm depending on the
pulley and tension on the idler.
2021-08-30 12:49:54 +02:00
Yuri D'Elia f77e426af1 Use the MK2 values for the Pulley 2021-08-30 12:49:54 +02:00
Yuri D'Elia a7d8953519 Fix stepsPerUnit for the Pulley
Also use the correct value multiplied by the current ustep resolution to
make the conversion obvious.
2021-08-30 12:49:54 +02:00
Yuri D'Elia bc36ea4566 PulseGen: fix speed types in functions
Type was incorrectly changed in the last commit while debugging
2021-08-30 12:49:34 +02:00
Yuri D'Elia 04631677cc Motion/PulseGen: implement move chaining and end-speed control
Allow to chain moves by adding one extra parameter to the PlanMove[to]
functions: ending speed.

A move will always be accelerated from the last speed towards end ending
speed. The following:

  PlanMove(100._mm, 50._mm_s, 50._mm_s);
  PlanMove(200._mm, 100._mm_s);

Will first move the axis 100mm, accelerating towards 50mm/s, then
accelerate again to 100mm/s. The move will for then decelerate towards a
full stop after reaching 300mm in total.

Acceleration can be changed for each segment, so that a custom
acceleration curve can be created:

  SetAcceleration(10._mm_s2);
  PlanMove(100._mm, 50._mm_s, 50._mm_s);
  SetAcceleration(100._mm_s2);
  PlanMove(100._mm, 50._mm_s, 50._mm_s);

The ending speed might not always be reached, depending on the current
acceleration settings. The new function "Rate()" will return the ending
feedrate of the last move, if necessary.

AbortPlannedMoves accepts a new "halt" parameter to control how moves
will be chanined when interrupting the current move. By default
(halt=true) the move is completely interrupted.

When halt=false is requested, a subsequent move will be chained starting
at the currently aborted velocity. This allows to chain moves in reponse
to events, for example to accelerate the pulley without stopping as soon
as the FINDA is triggered, it's sufficient to interrupt the current move
followed by a new one:

  PlanMove(maximum_loading_lenght, slow_feedrate);
  ... wait for PINDA trigger ...
  AbortPlannedMoves(true);
  PlanMove(bowden_lenght, fast_feedrate);

will seamlessy continue loading and transition to the fast feedrate.

Jerk control has been simplified. It now handles only the maximal
velocity change of the last segment, which doesn't require reverse
planning.
2021-08-30 12:49:34 +02:00