Commit Graph

170 Commits

Author SHA1 Message Date
Guðni Már Gilbert 90322a7181 optimisation: always inline ReportingRAII
Tested on MK3S+ using the LCD.

Change in memory:
Flash: -80 bytes
SRAM: 0 bytes
2023-05-13 18:07:13 +00:00
Guðni Már Gilbert 62991c8e67 Fix issue where Tx gcode doesnt reset custom_message_type
We need to call BeginReport and EndReport
otherwise the SD filename is not shown when printing

This only affects single material MMU gcodes

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-04-23 09:52:11 +00:00
Guðni Már Gilbert 4b54cd1f30 Remove unused LoadingToNozzleRAII
The variable is not used anywhere.

Change in memory:
Flash: -14 bytes
SRAM: -1 byte
2023-04-16 17:23:28 +00:00
Guðni Már Gilbert 138654e207 Add comment
Note we cannot use too long extrusions
2023-03-26 09:16:07 +00:00
Guðni Már Gilbert 6bdc3c5cfb Improve MMU toolchange when E-cool mode is enabled
Currently we are queuing many small 2 mm E-moves until the filament
sensor triggers. We do this because we never abort any queued moves,
so making small 2 mm moves ensures we do not move the E-motor more than
2 mm past the filament sensor.

Unfortunately, when E-cool mode is enabled, the E-motor will create
audible clicking sounds (similar one hears during jam or a loose grub
screw). A workaround for this is to queue one or more very long moves.
Where very long is something of the order of hundreds of millimeters. I
have it set to 350 mm but it's just a random constant really. Keep in
mind the firmware will block too large E-moves, if I recall correctly
it was anything above > 450 mm (see PREVENT_LENGTHY_EXTRUDE)

In order to use very long moves, we must somehow stop the E-motor from
moving once the filament sensor triggers. In other words, throw away
what's left of the current E-motor move. For this simple purpose we can
use planner_abort_hard() but we must set planner_aborted to false
afterwards because the code architecture does not allow the main loop()
to run until the Toolchange command is done processing.

Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-03-26 08:57:59 +00:00
Guðni Már Gilbert 466a6a8fc3 Add M600 into PROGMEM
Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2023-03-18 16:33:13 +00:00
Guðni Már Gilbert ebf94c572f PFW-1504 Minor optimisation
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 42878341af PFW-1504 More correct solution to the pixel count issue
The fact that the relationship between
machine position and pixel index is not linear
means we cannot simply rely on comparing
the previous position to the next machine position. i.e derivative of E_AXIS
Because around the max amplitude of the triangle wave
the slope will suddenly change sign and will create a deadzone
which has width 2*mm_per_pixel.
For MMU2S this is ~10mm (or two pixels).

Instead we should split the moves.
And only plan the 2nd move once we're
at the top of the triangle wave. That way we don't really care about the position delta.

Now we just calculate the current y(x)
position relative to current position and divide by mm_per_pixel.
If there is a delta measured with unit 'pixel' then that means
 its time to render the next pixel.

 This solution seems to work well so far on my end.

 Change in memory:
 Flash: +2 bytes
 SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert b5e323e67c PFW-1504 rename length_step_mm to mm_per_pixel
Its more descriptive
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 9865d4a38a PFW-1504 Add precision error
This fixes an issue where sometimes
not all 20 pixels are rendered.

It is better to render 1 too many pixels (sometimes), rather than rendering too few.

Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert c518bfdb73 PFW-1504 Set cursor position each time to be safe
Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 59e1ac0396 PFW-1504 implement stepper_get_machine_position_E_mm()
This function should be used when reading the current machine
position while a move is ongoing

No change in memory
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 690d83a94a fixup 2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 9145c8f59f PFW-1504 too much?
I'm not happy with the current solution, I think we can improve it
by using the fact that this is a triangle wave. Need to think about it.
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 73c76579af PFW-1504 Add init for progress bar
In case we are running a retry, the firmware
should clear the old rendering before
starting on a new one

Change in memory:
Flash: +6 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 51f1aa14a5 PFW-1504 Update last position as quickly as possible
0.1mm extrusion may happen while updating the LCD

No change in memory
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert bbfc4b9f78 PFW-1504 initial commit
Change in memory:
Flash: +162 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
3d-gussner ba41b2bb0b Fix M706 lcd message stuck 2023-03-09 07:00:40 +01:00
D.R.racer 303a67cd6f Introduce MMU EEPROM reset feature
This new feature requires MMU FW v 2.1.7 (which brings some more small changes)
2023-02-24 15:26:07 +01:00
Guðni Már Gilbert 074057c110 Fix an issue where LCD freezes during loading test
It may be useful to view the Sensors menu
while the toolchange loading test is taking
place. For example to see if the reading is flickering

The firmware needs to call lcd_update(0) to update the screen rendering.

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-02-18 13:16:40 +01:00
Guðni Már Gilbert 8db2fbc97f Improve sound handling for MMU error screen
Change in memory:
Flash: -174 bytes
SRAM: +4 bytes
2023-02-11 15:54:33 +01:00
D.R.racer 296b0414af Optimize execute_extruder_sequence
Save 64B by refactoring of execute_extruder_sequence.
2023-02-08 06:47:50 +01:00
Guðni Már Gilbert e34ed479ef PFW-831 Add single buzzer beep when an MMU error screen is shown for the first time
If the user has the sound settings set to 'Silent' then this beep should be silent

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-02-06 08:35:08 +01:00
D.R.racer ed80defc2c Shorten the Try-Load-Unload sequence
... and allow easier future tweking in case of need
Also, save ~30B of code by returning the previous E-motor position.
2023-02-01 06:38:19 +01:00
D.R.racer d2f3835b2c Fixup after review 2023-01-31 09:35:22 +01:00
D.R.racer 43ae2c78e5 Fix cmake build 2023-01-31 09:35:22 +01:00
D.R.racer 528abcb8d8 clang-format 2023-01-31 09:35:22 +01:00
D.R.racer 0555376502 Refactor mmu2.cpp and related interfaces
The general idea is to keep platform specific implementation away from the MMU state machines as much as we can.
That would enable unit testing the top level MMU state machine and integration into other project as well (if needed).
2023-01-31 09:35:22 +01:00
D.R.racer 6298722f9a Disable E-motor before the MMU starts doing something
It may seem counterintuitive to disable the E-motor, but it gets enabled in the planner whenever the E-motor is to move.
The idea behind disbling the E-motor when it won't be needed for some time is to save power and lower the heat of the motor.
Therefore it is especially important to disable the motor before the printer pauses a print due to some MMU error screen.
2023-01-18 09:42:57 +01:00
D.R.racer 472f84e46a Avoid FullScreenMsg "Eject/Cut Filament" when called inside a toolchange
CutFilament and EjectFilament got a flag: enable/disable FullScreenMsg
2023-01-16 09:25:04 +01:00
D.R.racer 48ce22d41f Fix blank LCD while err. Load to Extr. Failed
Because this error is not an MMU error but a printer one, the existing infrastructure has been bent to support such a scenario.
During testing it turned out, that some machines fail to draw the error screen due to previous internal states.
This PR resets the internal states so that the conditions for drawing the error screen are met.
2023-01-16 09:25:04 +01:00
D.R.racer 58bed7e388 MMU: Make sound after the hotend reaches temp, not while waiting 2023-01-16 07:19:11 +01:00
Guðni Már Gilbert 5582114628 optimisation: re-use delay_keep_alive() in a few places
Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2023-01-15 19:21:55 +01:00
Guðni Már Gilbert d3aa40a575 Fix blank LCD issue 2023-01-14 13:51:10 +01:00
D.R.racer 85d27e6e5e Address 3 different start scenarios 1st lay cal + MMU
This PR tries to address the 3 different startup scenarios for 1st layer calibration with the MMU:

- 1st lay cal started with correct filament already loaded in the nozzle - we should continue, but skip the first 58mm (first 2 g-codes in the hard coded sequence) of purge line extrusion
- 1st lay cal started with other filament already loaded in the nozzle - we should unload and then issue a toolchange with no extra unload
- 1st lay cal started without loaded filament - we should just do a toolchange with no extra unload

PFW-1457
2022-12-30 15:04:45 +01:00
D.R.racer 52a3beb931 Cut & Eject: avoid preheat if no filament loaded
and add fullscreen messages for Cut & Eject (messages intentionally reused to save space)
2022-12-30 14:23:44 +01:00
D.R.racer 43f3865d7c Tune UI CutFilament & EjectFilament 2022-12-30 14:23:44 +01:00
D.R.racer 58ff0efb30 Silence nodiscard attribute at one spot
... where it is really irrelevant
2022-12-30 14:23:44 +01:00
D.R.racer 5e103cc24e Fixup: restoring temp. while Load2ExtrFailed 2022-12-30 14:23:44 +01:00
D.R.racer d4f0f363cd Fixes from tests
- introduce Cut Filament
- limit retries try-unload
- fix waiting in "Load to extruder failed" error screen
- add LOAD_TO_EXTRUDER_FAILED error definition
2022-12-30 14:23:44 +01:00
D.R.racer a30ea1c5ab Rename error: Load to Extruder Failed
as per request from the Content team
2022-12-30 14:23:44 +01:00
D.R.racer 0a3517e8b2 Show an error screen when try-unload fails to push filament into nozzle
This is a prototype implementation of having the ability to show an MMU error screen even for printer's errors (during an MMU operation).
Also, the retry count of unloads after failed load the extruder tube is now limited to ~3 attempts.

Technically, since this very error is not an MMU's one (MMU is just fine at this stage) but a printer's one I tried to hack the existing error-reporting infrastructure to handle such a case.
The original idea of this approach was suggested by @vintagePC
2022-12-30 14:23:44 +01:00
D.R.racer b2b7990cfc Allow tweaking try-unload feedrates
It looks like MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE can get much higher that the original 20mm/s.
50mm/s is the default now, can be tweaked further.
2022-12-30 14:23:44 +01:00
Alex Voinea 62ea78d46e Handle configurable distance past gears 2022-12-19 23:49:12 +01:00
Alex Voinea 70356b71df Handle filament sensor position that is not 0 2022-12-19 23:41:43 +01:00
Guðni Már Gilbert c72ae8a2f3 PFW-1439 Remove parameters from execute_load_to_nozzle_sequence 2022-12-19 21:12:12 +00:00
Guðni Már Gilbert 6ee5f08505 PFW-1439 Compensate load to nozzle extruder sequence for Extra Loading Distance
The Extra Loading Distance is configurable by the user.
We need to compensate the hardcoded sequence
such that it does not extrude too much or
too little. Currently the firmware
extrudes too little.
2022-12-19 21:12:11 +00:00
Alex Voinea 97ddcc66bb
Merge pull request #3839 from leptun/MMU2_split_variant_config
MMU2 split variant config
2022-12-19 20:31:01 +01:00
Alex Voinea ba0f051f72 Revert accidental removal of check 2022-12-18 15:55:48 +01:00
Guðni Már Gilbert 4c32e8b403 PFW-1457 make CHECK_FSENSOR into a function 2022-12-18 12:23:20 +00:00