Commit Graph

200 Commits

Author SHA1 Message Date
gudnimg 0139cf6dde MMU: Fix printing uint8_t value onto serial
uint8_t values don't print correctly. Cast to 2-byte integer is required.
2023-09-30 14:06:38 +00:00
D.R.racer 0f1cb4f407 Fixup from review 2023-09-18 10:51:32 +02:00
D.R.racer ea01012026 Unify MMU operations' workflow 2023-09-18 10:51:32 +02:00
D.R.racer a02ff0651c Return try-load reporting to serial 2023-09-18 10:51:32 +02:00
D.R.racer 59e49c80f9 Sync MK3<->MK4 MMU2 Tune, Buttons, PowerPanic hooks refactoring 2023-09-18 10:51:32 +02:00
D.R.racer 9b48ab729a Sync MK3<->MK4 MMU2 TryLoadUnloadReporter 2023-09-18 10:51:32 +02:00
D.R.racer 7db7250773 Sync MK3<->MK4 MMU2 mmu2_mk4.cpp formatting 2023-09-18 10:51:32 +02:00
D.R.racer be5523187b Sync MK3<->MK4 MMU2 mmu2_mk4.h 2023-09-18 10:51:32 +02:00
D.R.racer 075858c9fa Sync MK3<->MK4 MMU2 reporting 2023-09-18 10:51:32 +02:00
D.R.racer b4b0bba11c Sync MK3<->MK4 MMU2 marlin interface 2023-09-18 10:51:32 +02:00
D.R.racer ec4740fe53 Clean-up ProgressCodes and ErrorCodes parameters throughout the code 2023-09-18 10:51:32 +02:00
gudnimg e0269d6f6a Explicitly using Buttons namespace
This change sync the code a little bit with the 32-bit FW

No change in memory
2023-09-03 12:41:39 +00:00
Guðni Már Gilbert 60534738d3 PFW-1522 Don't increment failure statistic on filament change 2023-08-18 14:27:39 +02:00
Guðni Már Gilbert fc18f4c5d7 PFW-1522 Implement filament change screen
Change in memory:
Flash: +116 bytes
SRAM: +1 byte
2023-08-18 14:27:39 +02:00
Guðni Már Gilbert 3766aadd99 PFW-1530 rename isErrorScreenSleeping to TuneMenuEntered 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert f0a48b11f7 PFW-1530 Refactor the menu to be non-blocking
The UI works much smoother now

Saves ~60 bytes of flash
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert efd85110a3 PFW-1530 minor optimisation
Don't inline WriteRegister

Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 1cda696e14 PFW-1530 Add Tune to Selector screen and more
- Rename "Idler" to "Sensitivity"
- Implement ReadRegisterInner() as a way to read register in blocking contexts such as manage_response()
This allows us to show the current EEPROM value on the printer's LCD
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 9e4fd08031 mmu2: cleanup: use Register enum 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 5f60eaff85 PFW-1530 Initial prototype
Add a 'Tune' option to HOMING_IDLER_FAILED error

This will open a menu which allows
the user to change the stallguard threshold
from the MMU error screen

Change in memory:
Flash: +334 bytes
SRAM: +1 byte
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 7e025894d1 Echo the result onto serial
Example:
MMU2:1111111111111110011
1 means filament present (solid block)
0 means otherwise (dash)

Change in memory:
Flash: +94 bytes
SRAM: 0 bytes
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert 63775dfabb PFW-1504 fix conflicting UI issues
Proposal to fix some of the issues with the initial implementation
it is safer to use the status line code to print the message so
there aren't any conflicts in the LCD cursor position.

Allow inserting a byte into any position in the LCD status message

Also, add a variable to control from which index in the array
should the message start printing. This is very useful for progress
bars and messages which continually update. I think we can save some
memory by applying this to Mesh Bed Leveling later.

Change in memory:
Flash: +106 bytes
SRAM: +1 byte
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert fa843a4a9b power panic: implement partial back up in RAM
A partial backup is needed in scenarios where the extruder may be
parked after a print is saved. For example during a blocking wait for the user in M600
Or during a MMU error screen.

A sudden power panic at this point would previously save the parked position
into EEPROM. When the print is recovered it would print in mid air.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 70ae3353ce MMU: Disable E-motor after Try-load-unload
The filament is never in the nozzle at this point so there
should be no oozing.

When a single material MMU print, I can hear audible noise
from the motor after executing Tx code. After some timeout
(while the heaters still heating up) I can hear the firmware
disable the E-motor. But we can safely disable it immediately
after the try-load-unload sequence.

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-07-13 10:04:20 +02:00
Guðni Már Gilbert 06c42bf85f MMU: Remove a call to Enable_E0
The planner enables the E-motor automatically
No need to do it manually

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-07-13 10:04:20 +02:00
Guðni Már Gilbert 4abdb0225d PFW-1527 FILAMENT_EJECTED should not increment fail statistic
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-07-13 10:01:27 +02:00
Guðni Már Gilbert ef4efc22c3 PFW-1528 Intercept register 0x14
This commit syncs the 8-bit firmware with the 32-bit

Change in memory:
Flash: +56 bytes
SRAM: 0 bytes
2023-07-13 08:00:11 +02:00
3d-gussner b5bd9ebc63
MK3 sync Prusa-Error-Codes (#4238)
* Sync PEC `FINDA_DIDNT_GO_OFF` to `FINDA_FILAMENT_STUCK`

* Sync PEC `FSENSOR_DIDNT_GO_OFF` to `FSENSOR_FILAMENT_STUCK`

* Sync PEC `PULLEY_STALLED` to `PULLEY_CANNOT_MOVE`

* Sync PEC `SELECTOR_CANNOT_MOVE` update text

* Sync PEC `IDLER_CANNOT_MOVE` update text

* Sync PEC `PULLEY_WARNING_TMC_TOO_HOT` to `WARNING_TMC_PULLEY_TOO_HOT`

* Snyc PEC `RestartMMU` to `ResetMMU`
Also related text

* Sync PEC `SELECTOR_WARNING_TMC_TOO_HOT` to `WARNING_TMC_SELECTOR_TOO_HOT`

* Sync PEC `IDLER_WARNING_TMC_TOO_HOT` to `WARNING_TMC_IDLER_TOO_HOT`

* Sync PEC `PULLEY_TMC_OVERHEAT_ERROR` to `TMC_PULLEY_OVERHEAT_ERROR`

* Sync PEC `SELECTOR_TMC_OVERHEAT_ERROR` to `TMC_SELECTOR_OVERHEAT_ERROR`

* Sync PEC `IDLER_TMC_OVERHEAT_ERROR` to `TMC_IDLER_OVERHEAT_ERROR`

* Sync PEC `PULLEY_TMC_DRIVER_ERROR` to `TMC_PULLEY_DRIVER_ERROR`
Also releated text

* Sync PEC `SELECTOR_TMC_DRIVER_ERROR` to `TMC_SELECTOR_DRIVER_ERROR`
Also related text

* Sync PEC `IDLER_TMC_DRIVER_ERROR` to `TMC_IDLER_DRIVER_ERROR`
Also related text

* Sync PEC `PULLEY_TMC_DRIVER_RESET` to `TMC_PULLEY_DRIVER_RESET`

* Sync PEC `SELECTOR_TMC_DRIVER_RESET` to `TMC_SELECTOR_DRIVER_RESET`

* Sync PEC `IDLER_TMC_DRIVER_RESET` to `TMC_IDLER_DRIVER_RESET`

* Sync PEC `PULLEY_TMC_UNDERVOLTAGE_ERROR` to `TMC_PULLEY_UNDERVOLTAGE_ERROR`

* Sync PEC `SELECTOR_TMC_UNDERVOLTAGE_ERROR` to `TMC_SELECTOR_UNDERVOLTAGE_ERROR`

* Sync PEC `IDLER_TMC_UNDERVOLTAGE_ERROR` to `TMC_IDLER_UNDERVOLTAGE_ERROR`

* Sync PEC `PULLEY_TMC_DRIVER_SHORTED` to `TMC_PULLEY_DRIVER_SHORTED`
Also related text

* Sync PEC `SELECTOR_TMC_DRIVER_SHORTED` to `TMC_SELECTOR_DRIVER_SHORTED`
Also related text

* Sync PEC `IDLER_TMC_DRIVER_SHORTED` to `TMC_IDLER_DRIVER_SHORTED`
Also related text

* Sync PEC `PULLEY_SELFTEST_FAILED` to `MMU_PULLEY_SELFTEST_FAILED`
Also related text

* Sync PEC `SELECTOR_SELFTEST_FAILED` to `MMU_SELECTOR_SELFTEST_FAILED`
Also releated text

* Sync PEC `IDLER_SELFTEST_FAILED` to `MMU_IDLER_SELFTEST_FAILED`
Also related text

* Sync PEC fix MMU_MMU
Update MMU MCU UNDERPOWER

* Sync PEC `FIL_ALREADY_LOADED` to `FILAMENT_ALREADY_LOADED`
Also related text

* Add Prusa Error Codes check script

* Remove `:` at FINDA and FSENSOR as it is in other tiles

* Sync
FSENSOR_DIDNT_TRIGGER
MSG_DESC_SELECTOR_CANNOT_MOVE
MSG_DESC_IDLER_CANNOT_MOVE
MSG_DESC_FW_UPDATE_NEEDED
FILAMENT_ALREADY_LOADED

* Add MMU UNKOWN_ERROR PEC
2023-06-21 07:34:17 +02:00
Guðni Már Gilbert 02676fc888 Limit scope of is_mmu_error_monitor_active
Move the variable to mmu2_reporting

Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-05-22 08:04:22 +02:00
Guðni Már Gilbert 1f9fc4ef3f MMU: add UnloadInner and CutFilamentInner
Sync with the 32-bit side.
The ReportingRAII does not handle recursion.

Fixes an issue with the multiple calls to
BeginReport() and EndReport()

Change in memory:
Flash: +14 bytes
SRAM: 0 bytes
2023-05-22 08:00:42 +02:00
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