Commit Graph

52 Commits

Author SHA1 Message Date
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
D.R.racer 26126906ef Hardcode expected MMU FW version into the error message v2
This is an 80% solution to PFW-1488 which should be somewhat compatible with the existing languages/translations infrastructure.
I don't see a point in extending the infrastructure a great deal to support some compile-time replacement in order to patch just MSG_DESC_FW_UPDATE_NEEDED.

Related PR: https://github.com/prusa3d/Prusa-Firmware/pull/3993
2023-02-08 10:50:33 +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 ec1d12d929 Introduce FILAMENT_EJECTED + tune Eject operation + inc. MMU ver. 2.1.6 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 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
Guðni Már Gilbert eb8ec9f8b9 If an old firmware is detected, make sure the protocol is actually stopped
The printer shouldn't continue endlessly asking for a version if an old MMU is detected.
Also if the protocol is supposed to be turned off, it
shouldn't be sending S0 queries.
2022-12-16 16:23:19 +01:00
Yuri D'Elia 9f3f0baa47 mmu: Use strncpy when possible
Since tmp is always null-terminated we can save some time compared to a
memcpy call.
2022-12-16 16:21:59 +01:00
Yuri D'Elia b3b9778341 mmu: Silence repeated S0 requests
Update "S0" CRC on replies so that the message is properly silenced.
2022-12-16 16:21:59 +01:00
Yuri D'Elia 78cf51274f mmu: Embed the newline in MMU2_ECHO_MSG/MMU2_ERROR_MSG
This allows to redefine both macros to silence debugging messages, since
we can't redefine the base SERIAL_ECHO.
2022-12-16 16:21:59 +01:00
D.R.racer 541cd3ae94 Remove debug messages of Interrupted state 2022-11-20 17:27:36 +01:00
D.R.racer fe11b7a247 Tune Interrupted state based on unit tests
Now finally the printer can restart ToolChange if MMU restarted.
2022-11-20 17:27:36 +01:00
D.R.racer 10a9e0f0a0 Recover from MMU restart while performing a command
PFW-1427
2022-11-20 17:27:36 +01:00
D.R.racer 6059398004 Introduce MMU Error: INSPECT_FINDA (FINDA_FLICKERS) 2022-11-17 07:58:11 +01:00
D.R.racer 2c695f14be Increase required MMU version to 2.1.4.x 2022-10-12 07:45:13 +02:00
D.R.racer b0466ae20f Add infrastructure for MMU parametrization after comm start
For now, only the Extra loading distance is being sent, but the infrastructure can be easily extended for other registers as well.
2022-10-11 15:51:01 +02:00
D.R.racer 013ce588a5 Support reading/polling multiple registers
In Idle and Command mode it is now possible to specify a list of registers which shall be periodically read from the MMU.
To keep the code and RAM size down registers are intentionally separated into 8bit and 16bit sets.
Adding a register into the set is just a matter of parametrization, there is no need to change the state machines anymore.
2022-10-11 15:51:01 +02:00
Guðni Már Gilbert 16713aa25a Optimisation: scopeState is already set by SendReadRegister
Saves 2 bytes of flash
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 1010f23959 Fix an issue where findaPressed is never set
This caused instant FINDA runout when the print starts. Now fixed :)
2022-09-16 10:23:47 +02:00
D.R.racer 4d3a5433ad Implement read/write registers for M707/M708 2022-09-16 10:23:47 +02:00
D.R.racer 18423685b6 Cleanup ExpectsResponse usage 2022-09-16 10:22:39 +02:00
D.R.racer d5377c1781 Remove extra "scopeState = ScopeState::FINDAReqSent"
saves ~20B in total
2022-09-16 10:22:39 +02:00
D.R.racer e205d0ee2f Autoretry Idle scope: transf. into Finished, should stay in Processing 2022-09-16 10:22:39 +02:00
D.R.racer 78cbea08e6 Fix pgm_read* usage 2022-09-16 10:22:39 +02:00
D.R.racer 6c0d3b0b78 Optimize MMU protocol logic 2022-09-16 10:22:39 +02:00
D.R.racer 05ad1dc2f6 Refactoring of protocol logic to lower RAM consumption
Should also place the statistics request to the right spot in the state machine.
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert dfddf3eaa5 Initial commit for MMU statistics 2022-09-16 10:22:39 +02:00
D.R.racer 0e036b9d8a Save some more RAM in protocol_logic 2022-09-16 10:22:38 +02:00
D.R.racer 2f0ceabce5 Upgrade protocol to v2.1 - read/write registers + CRC 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 938fac4058 Remove old comment, button is acknowledged now 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert f717aa161c Remove TODO in ActivatePlannedRequest 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert b9d9308f9f Support 3x Retry in Idle state machine 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert ab32769487 Send button from current state machine 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 4f30cf0ba3 Add missing ProtocolError 2022-09-16 10:22:38 +02:00
D.R.racer 53e2d68183 Retry up to 6x in case of incorrect MMU FW version
Because it looks like the communication drop outs are caused by some electrical issues and we can loose even a byte from the version response, which is deadly for future operation.
2022-09-16 10:22:38 +02:00
D.R.racer 14b2befb7d Switch from Start Seq into Idle immediately + disable FS autoload on MMU 2022-09-16 10:22:38 +02:00
D.R.racer 1d2acb5bd6 Bump MMU FW version to 2.0.19 to match/enforce the necessary compatibility level 2022-09-16 10:22:38 +02:00
D.R.racer fa176c69db Fix protocol error recovery
Communication timeout and Protocol Errors are now distinguished.
In case of a Protocol Error, the printer waits for heartBeatTimeout to allow filling up the input UART buffer (we expect the MMU still produces some bytes).
Once the timeout elapsed, the input UART buffer is cleared and a new Start Sequence is initiated.
2022-09-16 10:22:38 +02:00
VintagePC 69c39e2281 An attempt at fixing the retry. Discussion needed. 2022-09-16 10:22:38 +02:00
D.R.racer a004273e8f Avoid drawing MMU Error screen while MMU moves manually 2022-09-16 10:22:38 +02:00
D.R.racer 98adcbaff2 Bump required MMU FW version to 2.0.18 2022-09-16 10:22:38 +02:00
D.R.racer dab26fe50b Report detected MMU version in the Support menu
It was just subtly broken, all the functionality had already been implemented.
2022-09-16 10:22:38 +02:00
VintagePC c07a5f396d Fix button enum 2022-09-16 10:22:38 +02:00
VintagePC f9bedc3c94 Button handling WIP 2022-09-16 10:22:38 +02:00
D.R.racer 236098dbca Make init MMU error screens send buttons (Idle mode) 2022-09-16 10:22:38 +02:00
D.R.racer b880559ba7 Reset MMU upon start + fix reporting its start errors 2022-09-16 10:22:38 +02:00
D.R.racer b6b265e371 Hack around old MMU FW's msgs 2022-09-16 10:22:38 +02:00
D.R.racer a0e9a302b8 Suppress communication drop-out < 8s (MMU in bootloader)
PFW-1327
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 11290c1123 Add a read function for mmu_print_saved
and remove the old extern value which is not used anymore

I had to remove "MMU2::" from mmu2_protocol_logic.cpp, otherwise the build failed.
2022-09-16 10:22:37 +02:00