Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIKE: MMU3 feature in Prusa Firmware #2

Open
eoyilmaz opened this issue Dec 13, 2023 · 3 comments
Open

SPIKE: MMU3 feature in Prusa Firmware #2

eoyilmaz opened this issue Dec 13, 2023 · 3 comments

Comments

@eoyilmaz
Copy link
Owner

eoyilmaz commented Dec 13, 2023

Investigate the Prusa Firmware from the perspective of the MMU3.

  1. The main points are:
    1. Can we just keep everything in the same way in Marlin and make Marlin be able to talk with MMU3 without adding any new features (just a protocol update)?
    2. If we want all features, how much code can directly be transferred.
    3. Prusa source code structure:
      1. Prusa code base has everything in the same directory.
      2. The code needs to follow Marlin 2 module structure.
      3. Prusa keeps Marlin1 and Marlin2 in the same branch (?? is that true).
      4. Prusa uses namespaces, would it break anything if we keep the namespaces.
    4. Do we need to do any change to MMU3 firmware itself (not really).
    5. Custom GCode commands:
      1. MMU3 Information
      2. M704 gcode
      3. M707 gcode
      4. M708 gcode
      5. M709 gcode
    6. All the interactions with MMU3 is through the menus now, the buttons doesn't work as before.
    7. New error codes.
    8. Responses are like "L1 A18\n" for "Load Filament 1 Accepted", or "L3 R53\n" for "Load Filament 3 Rejected" etc. no "ok\n" or "0ok\n" any more.
    9. Spool join mode
@eoyilmaz eoyilmaz moved this to In Progress in MMU3 Project Dec 13, 2023
@eoyilmaz
Copy link
Owner Author

eoyilmaz commented Dec 15, 2023

Can we just keep everything in the same way in Marlin and make Marlin be able to talk with MMU3 without adding any new features (just a protocol update)?

This seems reasonable, but the new protocol is a little different, when a requrest is sent MMU respond with the same request code and adds a message code (ResponseMsgParamCodes).

Printer starts with requesting a respond to the S0 command:

Marlin: S0*c6
MMMU  : S0 A3*22

So, MMU3 says I received and accepted the S0 by adding an A there and also attaches the reply of 3. So it means that we have the major version 3 of the firmware.

Requesting an L0 goes as follows:

Marlin: L0*73
MMMU  : L0 A*37

So MMU3 accepts the L0 command, but interestingly it doesn't respond (as far as I see) with an secondary message when the filament load is succesfully finished. Instead we need to issue a Q0 command and MMU3 respond to that with a L0 P5 as follows:

Marlin: L0*73
MMMU  : L0 A*37

Marlin: Q0*ea
MMMU  : L0 P5*bf

Marlin: Q0*ea
MMMU  : L0 P5*bf

... and this repeats until the filament loaded
... then MMU3 respond with

Marlin: Q0*ea
MMMU  : L0 F0*21

We need to destruct the MMU response here, L0 P5*bf means "I've been requested an L0 and the current progress code is P5" in which P5 means FeedingToFinda (according to https://github.com/eoyilmaz/Prusa-Firmware-MMU/blob/main/src/logic/progress_codes.h).

If we request an L1 we still need to query it with Q0:

Marlin: L1*18
MMMU  : L1 A*1e

Marlin: Q0*ea
MMMU  : L1 P5*96

Marlin: Q0*ea
MMMU  : L1 P5*96

Marlin: Q0*ea
MMMU  : L1 F0*8

In general where MMU2s is responding with ok\n we have instead a more detailed response message with MMU3.

@eoyilmaz
Copy link
Owner Author

I was planing to start with the closest implementation we have in Marlin (which is based on MMU 1.0.6 or even older), so that with very little effort (only implement the expectation of the outputs of "Qx" responses instead of an "ok\n" message) we can move forwards. But I see that the protocol is not different in the MMU3 branch apart from the CRC8 addition. So, it is better if we continue with implementing the full MMU3 protocol.

@eoyilmaz
Copy link
Owner Author

I kind of started in the way that I didn't want to start tbh, and I moved all the MMU related code from Prusa to Marlin and made the required changes to made the code work with 2.1.x branch, and it is going very well...

@eoyilmaz eoyilmaz moved this from In Progress to Done in MMU3 Project Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant