D.R.racer
fa4e687fdc
Fix chopping negative move values in PlanLongMove
...
+ use PlanLongMove in UnloadToFinda
+ fix comment in unit test
2021-11-03 10:13:03 +01:00
D.R.racer
5f1e3e018e
Workaround planning moves longer than 32K steps
2021-11-03 10:13:03 +01:00
D.R.racer
22522c253f
Update code after rebase onto main
2021-10-21 15:16:29 +02:00
D.R.racer
9438253106
Avoid trying to unload filament when not loaded
...
however, it looks like the EEPROM is not updated correctly, needs more testing
2021-10-21 15:16:29 +02:00
D.R.racer
63509af294
Fix cut filament unit tests
...
still, this may need some more work in relation to PR #128
2021-10-21 07:55:41 +02:00
D.R.racer
0fbcb9dac2
Tag all source files with @file for doxygen
2021-10-18 17:59:46 +02:00
D.R.racer
abe2567c84
Fixes for loading filament into nozzle
...
Slower speed once we reach the fsensor + avoid grind while disengaging the Idler
while the printer is already pulling the filament.
2021-10-18 07:29:13 +02:00
D.R.racer
d35bcd258a
Refactor after rebase onto main
2021-10-14 14:27:56 +02:00
3d-gussner
63aead0ab8
Update eject to use FilamentLoadState NotLoaded
2021-10-12 18:11:05 +02:00
3d-gussner
fb97e519aa
Feed slowly if FilamentLoadState is unknown
2021-10-12 18:11:05 +02:00
D.R.racer
206923598b
Fix error codes formatting
2021-10-12 18:11:05 +02:00
D.R.racer
e1af08b3d5
Fix unit tests
...
That includes:
- introduce pulley slow feedrate and fsensor-to-nozzle distance
in config necessary for slowly feeding the filament from fsensor into the nozzle.
(the constant is subject to extraction into some other config as it has to be used in the printer as well).
- update FeedToBondtech accordingly to perform a gentle push into the nozzle
after fsensor detects the filament + update its unit tests.
- slight cleanup of LoadFilament + fix its unit tests
- add FeedingToNozzle progress code, as it might be interesting
to inform the printer about this task in the future
- revert non-clean changes from RetractFromFinda - it should not disengage the idler
- revert incorrect + fix ToolChange
- clean-up UnloadFilament
2021-10-12 18:11:05 +02:00
Alex Voinea
0a1290102c
Actually fix retract filament from finda
2021-10-12 18:11:05 +02:00
Alex Voinea
6071257973
Fix unloading state machine
2021-10-12 18:11:05 +02:00
3d-gussner
221f40c7a1
Fix issue that all tool changes after first one fail to change to planned slot
...
Update Filament Load state
2021-10-12 18:11:05 +02:00
3d-gussner
33b467f1bc
Add debug to retract from finda
2021-10-12 18:11:05 +02:00
3d-gussner
62116b1283
Update debug
2021-10-12 18:11:05 +02:00
3d-gussner
82f2e8ec54
fix some debug output
2021-10-12 18:11:05 +02:00
3d-gussner
f9561e6cf7
Remove double operations
...
- feed to finda engages the idler so no need to do that before
- retract from finda disengages the idler, again avoid double operation
LEDs set mostly by feed to finda and retract from finda
2021-10-12 18:11:05 +02:00
3d-gussner
5cfb0887d0
Disengage Idler after retracted from FINDA
...
Add some dbg_logic output
2021-10-12 18:11:05 +02:00
3d-gussner
b752c5c4e7
Set FilamentLoaded state to InSelector if FINDA triggers
2021-10-12 18:11:05 +02:00
3d-gussner
abf875bda0
After Load Filament is compeleted the slot LED should be off
2021-10-12 18:11:05 +02:00
3d-gussner
dbf26d13ac
Make search for error codes easier
2021-10-12 18:11:05 +02:00
D.R.racer
c26cc30185
Add finer filament loaded states and improve unit tests
...
We need to know better where the filament is, a simple "filament loaded true/false"
does not correspond to the reality.
2021-10-12 18:11:05 +02:00
D.R.racer
5af0125672
LoadFilament should not set filament loaded (surprisingly)
...
because of the change of semantics of LoadFilament operation.
LoadFilament pushes the filament into FINDA and then retracts it back just to keep the
filament ready to be grabbed by the idler and pulley and loaded into the printer's nozzle.
So the selector is not blocked by the filament -> filament NOT loaded
2021-10-12 18:11:05 +02:00
D.R.racer
b13214b7f5
Fix debug sprintf variant
2021-10-12 18:11:05 +02:00
D.R.racer
5cf4a496e3
Introduce checking for enabled/disabled Pulley axis in unit tests
2021-10-12 18:11:05 +02:00
D.R.racer
236a40c6ef
Use dbg_logic logging
...
and improve the variadic version used to print formatted
text at some spots in previous commits
2021-10-12 18:11:05 +02:00
D.R.racer
bbd14ed217
Fix ToolChange operation + unit tests
2021-10-12 18:11:05 +02:00
D.R.racer
505930c576
Explain better final Idler state in FeedToFinda and FeedToBondtech
2021-10-12 18:11:05 +02:00
D.R.racer
e0d1fe3b73
Extract common ErrDisengagingIdler state's implementation
2021-10-12 18:11:05 +02:00
D.R.racer
6426295e32
Change the semantics of load filament
...
Load filament performs feed to FINDA and retract:
- engage idler
- feed normal to FINDA with config::feedToFinda distance until FINDA triggers
- retract normal and as soon FINDA un-triggers move back to PTFE config::cuttingEdgeToFindaMidpoint
- disengage the idler
That implied introducing another substate machine - RetractFromFinda, which does the opposite
of FeedToFinda while also checking for the FINDA switching off while retracting filament.
Still, ToolChange and CutFilament need fixing with this change
2021-10-12 18:11:05 +02:00
D.R.racer
5eedeb0968
Remove redundant ::Color and ::Mode for LED colors and modes
...
makes the code shorter and more readable, no identifier clashes revealed
2021-10-12 18:11:05 +02:00
D.R.racer
53b329941f
Keep constants start with lowercase letter
...
and remove a few warnings from the build
2021-10-12 18:11:05 +02:00
3d-gussner
0bead533df
clang-format
2021-10-12 18:11:05 +02:00
3d-gussner
15adeaa180
Add DEBUG_LOGIC
2021-10-12 18:11:05 +02:00
3d-gussner
b8259ac555
Fix some LED status
2021-10-12 18:11:05 +02:00
3d-gussner
b1f50d8789
Use constants
2021-10-12 18:11:05 +02:00
3d-gussner
645d0b55ed
Use constants
2021-10-12 18:11:05 +02:00
3d-gussner
c0938e41d5
Use constants
2021-10-12 18:11:05 +02:00
3d-gussner
ddcf24af43
Use constants
2021-10-12 18:11:05 +02:00
3d-gussner
5c44cf9ee0
Add UnloadingToFinda
2021-10-12 18:11:05 +02:00
3d-gussner
afe732d3ff
Use constants
2021-10-12 18:11:05 +02:00
3d-gussner
64bd2bb894
Use constants
2021-10-12 18:11:05 +02:00
D.R.racer
1a5cd52d58
Fix some doxygen comments
2021-09-29 13:28:34 +02:00
D.R.racer
8a5614844c
Add more error codes for the printer's perspective
2021-09-29 13:28:34 +02:00
3d-gussner
d3d992da5b
Cheange LED modes to be consistent.
2021-09-23 10:04:50 +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
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
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
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
06c46b20a6
Turn off green LED after load/unload finished successfully
...
MMU-65
2021-08-30 17:34:46 +02:00
D.R.racer
ccefe32ba1
Reset the error code for reusal of logic state machines
2021-08-12 10:30:40 +02:00
D.R.racer
9ba116e06e
Handle slot indices out of range correctly at top level
...
Besides Unload Filament, which only operates on active slot, all other
top level state machines check the validity of the command's parameter.
If the parameter is out of range for available slots, they return
ErrorCode::INVALID_TOOL now.
2021-08-12 10:30:40 +02:00
D.R.racer
2f5dff6c5b
Introduce short namespace aliases
...
especially for modules
2021-08-04 11:03:56 +02:00
D.R.racer
ef96d998a3
Link top level error reporting to TMC2130 error flags
2021-08-02 07:45:45 +02:00
D.R.racer
d94ad8b90e
Merge coil errors, fix bit masks
2021-08-02 07:45:45 +02:00
D.R.racer
f7c3d0b479
Fix axis bit masks
2021-08-02 07:45:45 +02:00
D.R.racer
751ee46450
Add bit masks for error codes for the TMC drivers
...
+ add common error handling for idler and selector
+ improve error handling in command_base
+ rename ERR1xxxx errors to ERRxxxx (remove the '1')
2021-08-02 07:45:45 +02:00
D.R.racer
df2c1ba7fe
Add prototype of unified handling of HW errors in the logic layer
2021-08-02 07:45:45 +02:00
D.R.racer
f5df642eb5
Improve error codes
...
- Distinguish among FINDA on/off failuje
- The same applies to newly introduced Filament sensor errors
- Add TMC init error
- Add a communication error ID - to be used on the printer
2021-08-02 07:45:45 +02:00
Yuri D'Elia
1abc8713bb
Fix ejectLength typo
2021-07-26 11:22:40 +02:00
Yuri D'Elia
49275b2cb2
Update eject_steps with the new unit API for demonstration
2021-07-25 17:25:37 +02:00
Yuri D'Elia
787c73ecff
Merge remote-tracking branch 'upstream/main' into motion_wip
2021-07-12 10:25:06 +02:00
Alan Dragomirecký
09819cb1aa
Split the main CMakeLists.txt into more files within subdirectories
2021-07-12 09:09:21 +02:00
Yuri D'Elia
7337e97765
Rename Motion::DisableAxis to Disable
...
Implement Motion::SetEnabled (for symmetry with TMC2130::SetEnabled).
Rename DisableAxis to Disable and use the new SetEnabled. This makes the
member names more consistent.
2021-07-11 21:38:01 +02:00
Yuri D'Elia
d87db1ff76
Revised WIP for the Motion API
...
- Remove the combined PlanMove(a,b,c,rate) call. If we allow the units
of the various motors to be changed at compile time, the unit of
rate can vary between axes.
- Build PlanMove on top of the absolute PlanMoveTo.
- Add required stubs for TMC2130.
- Allow each axis mode to be set independently, since we have this
feature for free anyway.
- Rework internals to use PulseGen data types and structs.
2021-07-07 16:59:39 +02:00
D.R.racer
9efb127acb
Explain and fix the LED states while cutting filament
...
now the test is correct including LEDs
2021-07-01 08:12:47 +02:00
D.R.racer
974c1ba6db
Verify Cut filament state machine + update unit tests
2021-07-01 07:03:39 +02:00
D.R.racer
9a8038ccb6
Add user_input module and use it instead of raw buttons
...
Encapsulates buttons and commands coming from the communication
2021-06-30 07:39:31 +02:00
D.R.racer
2c89b14de1
Add doxygen main page dox file
2021-06-30 07:39:31 +02:00
D.R.racer
3f98ec03ca
Fix doxygen documentation for the logic layer
2021-06-30 07:39:31 +02:00
D.R.racer
c15b1d59c4
Introduce Doxyfile + fix modules documentation
2021-06-30 07:39:31 +02:00
D.R.racer
f6e5d4ae76
Improve and verify Load filament alg and unit tests
2021-06-30 07:39:31 +02:00
D.R.racer
46a40f7488
Extend Unload filament unit tests
...
+ now error states are covered as well
+ greatly cleaned-up code
2021-06-30 07:39:31 +02:00
D.R.racer
ce20f0b001
Greatly improve unload filament unit test
...
+ relevant changes for other unit tests -> prepare for improving
of the other unit tests as well
2021-06-30 07:39:31 +02:00
D.R.racer
4d6d6fe0af
Add more checks (esp. positions of idler and selector)
...
that resulted in finding several weak spots and now Cut and Eject filament
do not pass the test (which is correct, they really have logical issues)
2021-06-21 10:28:56 +02:00
D.R.racer
317a486d1e
Logic layer Eject filament unit tests
...
initial setup, it compiles, but is blocked by Unload filament
2021-06-21 10:26:04 +02:00
D.R.racer
398181e26c
Feed to FINDA unit tests : green
2021-06-21 10:22:17 +02:00
D.R.racer
85910497f7
Unify buttons' API with other modules
...
- accepts millis() instead of doing the timing internally (which has
been a temporary solution just for the tests until now)
2021-06-21 10:22:17 +02:00
D.R.racer
b8f6bc9a4e
Tune Feed to FINDA state machine and its unit test
...
so that it works as expected
Still, there is a task of resetting all of the state machines just for
the next unit test to be run.
2021-06-21 10:22:17 +02:00
D.R.racer
f0a042c1b6
Add unit tests for Feed to FINDA state machine
...
+ improve infrastructure
2021-06-21 10:22:17 +02:00
D.R.racer
d6c9e58e66
Add global state hive
...
+ solve many TODO's in the code (active slot/extruder and filament loaded flag)
2021-06-16 06:43:20 +02:00
D.R.racer
dfb57bcae5
Add Load filament state machine
...
+ printer's fsensor (external) module
+ state machine for loading to bondtech
2021-06-14 07:34:59 +02:00
D.R.racer
7cab9dc915
Add Tool change operation
2021-06-14 07:34:59 +02:00
D.R.racer
ea65b75120
Add Eject filament operation
...
+ refactor other state machines a bit - Reset() now has the parameter which comes in the RequestMsg
2021-06-14 07:34:59 +02:00
D.R.racer
7bfc1bad97
Cut filament prototype state machine
2021-06-14 07:34:59 +02:00
D.R.racer
4a79b4b865
UnloadFilament - refactor for the new Idler API
2021-06-14 07:34:59 +02:00
D.R.racer
9caf680633
Add Feed to FINDA state machine
2021-06-14 07:34:59 +02:00
D.R.racer
05ff998c01
Lay out the other high-level commands/operations
...
- cut, eject, load filament, toolchange
- uncomment them in main.cpp
- their implementation is still empty
2021-06-14 07:34:59 +02:00
D.R.racer
5b4eb0cee3
Extract Unload filament into a separate file
...
+ cleanup the object structure
+ add no_command as the starting "operation" to simplify the rest of the command handling at runtime
2021-06-14 07:34:59 +02:00
D.R.racer
271a2dd7df
Minor tweaks after rebase onto main
2021-06-14 07:34:59 +02:00
D.R.racer
6f1624b718
Make logic prototype compilable
2021-06-14 07:34:59 +02:00
D.R.racer
2159558d88
Prototype of Unload Filament command/operation
...
+ related stuff:
- command decoding+processing+reporting in main.cpp
- slight refactoring of modules
2021-06-14 07:34:59 +02:00
D.R.racer
ca6de101c3
Logic - first try
2021-06-14 07:34:59 +02:00
D.R.racer
f848c8d550
Create basic FW structure
...
- Design API's based on our discussion and block diagrams
- Set doxygen rules/preferred syntax
2021-04-19 07:03:47 +02:00