Commit Graph

844 Commits (ad03df4271ef0e573cddc177d44e2bdf151c7462)

Author SHA1 Message Date
D.R.racer 94d6795252 Add register for FSensorToNozzleFeedrate 2022-08-11 10:26:42 +02:00
D.R.racer 7bc9217cd7 Move register map into PROGMEM
hopefully the compiler understands...
2022-08-11 10:26:42 +02:00
D.R.racer 48dacd57bd Improve code style (constexpr + unions = avoid reinterpret_cast) 2022-08-11 10:26:42 +02:00
D.R.racer ad0b26c5ec Fix unit tests 2022-08-11 10:26:42 +02:00
D.R.racer a0bff0ef3a Introduce register map + use Read/Write register 2022-08-11 10:26:42 +02:00
D.R.racer 53f87c8755 Introduce generic Read/Write register operations 2022-08-11 10:26:42 +02:00
D.R.racer 5dffd32025 Introduce Idler::PartiallyDisengage
This is to solve a potential problem while feeding to printer's drive gears - while disengaging the Idler, the Pulley was still rotating to avoid grinding the filament (printer is pulling it).
Other filaments could have moved a bit when the Idler's bearings ran over them while the Pulley was still rotating slowly -> the filament could have been moved into the Selector's path causing trouble (especially when not used in the print).
Therefore, the Idler disengages partially now - moves into an intermediate position between the slots.
Then, the Pulley is completely stopped and after that the Idler does a full disengage like before.
2022-08-02 07:28:10 +02:00
D.R.racer 4964e9a781 Fixup unit tests due to new homing behavior 2022-08-02 07:16:54 +02:00
Alex Voinea 989b6e6191 homing changes to increase reliability 2022-08-02 07:16:54 +02:00
D.R.racer 7002e3b0c7 Avoid homing Idler and Selector at the same time
This PR is an experimental code to delay homing of the Selector after the Idler homes properly.

Unit tests are expected to fail at this moment...
2022-08-02 07:16:54 +02:00
3d-gussner 857b028baf Update vscode to avr-gcc 2022-07-27 17:04:52 +02:00
Yuri D'Elia 289eca1295 Drop irrelevant pre-commit exclude paths 2022-07-27 17:04:52 +02:00
Yuri D'Elia 8e6aa41299 Update Jenkins rules to match updated cmake/ninja versions 2022-07-27 17:04:52 +02:00
Yuri D'Elia 7c0548a62c README: Mention the correct output filename 2022-07-27 17:04:52 +02:00
Yuri D'Elia 392298c3da Uniform gcc-avr => avr-gcc for consistency 2022-07-27 17:04:52 +02:00
Yuri D'Elia 911b1c5e69 HexConcat: Silence a cmake 3.22 warning 2022-07-27 17:04:52 +02:00
Yuri D'Elia 05aba7141b Add the AvrGcc toolchain to lock gcc version
Substitute documentation to reference AvrGcc by default, which locks gcc
to the dependency folder.

AnyAvrGcc is inteded to use any system/external gcc version (as the name
implies).
2022-07-27 17:04:52 +02:00
Yuri D'Elia 2117ee12de Update boostrap.py from Buddy 2022-07-27 17:04:52 +02:00
Yuri D'Elia 186c07d771 Require cmake 3.22.5 for consistency with Buddy 2022-07-27 17:04:52 +02:00
Yuri D'Elia 534347151a Remove unused ARM cmakefiles 2022-07-27 17:04:52 +02:00
VintagePC 1bc5fdaec4 Fix filename passing to hex modifier 2022-07-27 17:04:52 +02:00
3d-gussner a241f55513 Update vscode
Remove fixed version in AnyAvrGcc.cmake
Update build.py to use current avr-gcc version defined in bootstrap.py
Attempt to change MM-control-01.hex to MMU2SR-<project version> like in buddy releases
2022-07-27 17:04:52 +02:00
3d-gussner d04e5e704b Update vscode settings
Update README and version
2022-07-27 17:04:52 +02:00
D.R.racer 858cd0349b Upgrade build system to gcc 7.3
based on PR#185 and https://github.com/wavexx/Prusa-Firmware-MMU-Private/pull/1
2022-07-27 17:04:52 +02:00
Yuri D'Elia d9355249a0 Enable LTO 2022-07-25 10:27:16 +02:00
Yuri D'Elia 4794cfea40 Convert illegal constexpr to static const pointers
We cannot get a constexpr definition of the register addresses, and any
reinterpret cast is currently illegal for a constexpr in c++17.

Change the SPI0, TIFR and TIMSK to volatile const pointers instead.

SPI0 has volatile members instead of marking the entire struct as
volatile, which is probably not a good idea as it technically drops the
volatile from the original pointer.
2022-07-25 10:27:16 +02:00
Yuri D'Elia d34b79b087 Update standard to c++17 2022-07-25 10:27:16 +02:00
VintagePC 7418e3643e Add cmake code to prepend the Prusa Magic™ 2022-07-25 09:09:22 +02:00
D.R.racer a7587d737a Bump version to 2.0.19
since we introduced a breaking change (extension) of protocol in commit 32ad80e
2022-07-22 16:00:44 +02:00
D.R.racer 3c3e625f39 Unit test ErrDisengageIdler: make sure it never sets error while disengaging 2022-07-20 16:23:43 +02:00
D.R.racer 4e44447762 Change the unit tests to follow the new spec 2022-07-20 16:23:43 +02:00
D.R.racer 32ad80e283 Confirm Button "commands" as well (send B0 A) 2022-07-20 16:23:43 +02:00
D.R.racer 7688554581 Defer setting error until ErrDisengagingIdler finishes 2022-07-20 16:23:43 +02:00
D.R.racer 26151fb176 Only restart the feed phase when FINDA NOT pressed 2022-06-22 09:45:02 +02:00
D.R.racer a01ff57ea3 Improve restart ToolChange -> FeedToFINDA
It looks like we don't have to reset the whole ToolChange state machine when resolving an error with the middle button (Retry) - but jump straight into the feeding phase.
The reasons are multiple:
- If an error happens during the unload phase, it is handled separately in the UnloadFilament state machine
- If an error happens during the feeding phase, the unload has been already successfully completed.
  And when restarted from the very beginning, the ToolChange does the last retract sequence from the UnloadFilament phase
  -> that is not healthy, because the filament gets pushed away from the Pulley and causes another error.
2022-06-22 09:45:02 +02:00
D.R.racer f70c3ed5ec Bump MMU FW version to 2.0.18 2022-06-21 14:30:16 +02:00
D.R.racer 40e9e5df7c Fix unit tests 2022-06-20 17:03:40 +02:00
D.R.racer bc298ab114 Add unit test for empty event queue 2022-06-20 17:03:40 +02:00
D.R.racer b82ffe8db9 Add missing ResponseParamCode Button support + unit test 2022-06-20 17:03:40 +02:00
D.R.racer d80a58cfdb Fix unit tests 2022-06-20 17:03:40 +02:00
D.R.racer 5a636529ca "Printer in Charge" mode: report buttons into the printer for processing
Sets the UI module into a mode when the printer is in charge of processing the buttons (from all sources).
That means the MMU will detect its buttons but it will not react upon them.
This mode is important for error recovery when the printer needs to do some stuff before the MMU (like preheating the nozzle).
2022-06-20 17:03:40 +02:00
D.R.racer 2874dd3bc9 Make sure the selector never moves if FINDA is pressed
It looks we have some kind of leak when filament sensor state is not completely coherent with FINDA state.
This is yet to be discovered and fixed with some unit tests.
2022-06-20 14:20:31 +02:00
D.R.racer d2ba215580 Increment MMU error count with every new error ocurred 2022-06-20 13:54:07 +02:00
D.R.racer cecb659564 Reject LoadFilament if filament state > AtPulley
If the MMU receives a command LoadFilament with a slot number SL we reject
the command to avoid moving the selector (effectively cutting the piece of filament present in FINDA).

That includes the scenario when the selector is standing at the very same slot SL, because the filament could be held by the printer (i.e. loaded in the nozzle).

There is one special case though - same slot AND filament load state == InSelector (it MUST NOT be anywhere farther)
2022-06-20 13:53:35 +02:00
Yuri D'Elia f8080bc73b Avoid runtime floats in Pulley::PlanMove
Using U_mm inside a compilation unit will force the compiler to generate
a runtime copy of the function, and we don't want that.

But there seems also to be an optimization problem with gcc <= 7.x where
even when declaring an inline function constexpr, if called enough
times, the compiler will choose _not_ to evaluate the function at
compile time and thus avoid our compile-time float->integer
conversions...

For this reason, split the body of the function in two parts: the actual
function that uses AxisUnits at runtime for calling motion.PlanMove, and
a wrapper that forces the conversion. By marking this function as
always_inline, the body is correctly evaluated at compile time at each
call site.
2022-06-18 09:07:03 +02:00
D.R.racer de8a2f35ae Fix setup/FINDA init state
It turned out FINDA needs running timer to perform BlockingInit() correctly.
Therefore setup() was split into setup() (no IRQ) and setup2() (IRQ enabled).

Then, finally, the check for FINDA state became reliable upon start of the FW.
2022-06-14 07:32:08 +02:00
D.R.racer 7ae9c9019c Clear EEPROM filament state upon start when FINDA is off
Complement to PR#176
2022-06-14 07:32:08 +02:00
D.R.racer b4f9924013 Improve robustness of unit tests 2022-06-14 07:31:51 +02:00
D.R.racer 750e83c5e9 Tune debounce timeout of buttons 2022-06-14 07:31:51 +02:00
D.R.racer fbb46e5951 Distinguish fast and slow feed stage
Originally, only FeedingToBondtech was reported to the printer.
With PR#173 we have this operation separated into a fast and a slow stage (for MK3S with the chimney).
It looks like the printer could benefit from knowing if the MMU is still pushing fast
or when it entered the slow stage (to prevent ramming hard the Bondtech gears)

Along with this new state being reported, we also introduce a new ErrorCode::FSENSOR_TOO_EARLY
which basically means that the fsensor triggered in the fast feeding stage.
2022-05-23 07:41:54 +02:00