Commit Graph

931 Commits (9e3b300b2e5bbbd5c9b8cb90110b10ee9539abff)

Author SHA1 Message Date
D.R.racer 8b55b25028 Allow cutting current >31
Needs reinitialization of the axis (Selector) because the TMC driver needs to set another register to double the current level.
2023-03-07 21:07:52 +01:00
D.R.racer 9b43b61939 Idler+Selector homing speeds: writeable registers 2023-03-02 19:54:50 +01:00
D.R.racer b573fb1da3 Fix indentation 2023-03-02 12:20:06 +01:00
D.R.racer d2a2014b89 Cleanup HoldOn-Resume code in movables 2023-03-02 12:20:06 +01:00
D.R.racer e089a84f48 Turn off Idler and Selector motors before entering an error screen
That should prevent overheating and allow servicing during and error state.

MMU-216
2023-03-02 12:20:06 +01:00
D.R.racer ea41fd6b83 Update unit tests 2023-03-02 12:20:06 +01:00
D.R.racer d75119c8d6 Suspend all moves of Idler and Selector when entering an Error screen 2023-03-02 12:20:06 +01:00
D.R.racer 436ebcbeee Add HW EEPROM reset
Now the whole functionality takes +196B

As noted by @leptun, we cannot reliably check for >1 buttons pressed at once.
Since the left button is the least used, let's use it for invoking the HW EEPROM clear upon MMU start.
2023-02-25 17:59:35 +01:00
D.R.racer e2ee6f6ff1 Add X42 as EEPROM reset command + handling + visualization
MMU-193
2023-02-25 17:59:35 +01:00
D.R.racer 7e2375deee Introduce TMC2130 currents doxy group
and clean-up doxygen warnings a bit
2023-02-17 15:50:20 +01:00
Alex Voinea 9fce324bff Increase Idler SG_THRS to 7 2023-02-15 08:09:16 +01:00
D.R.racer ebdcc5a7e3 Increase version to 2.1.7
... due to removed left and right button handling in error states.
2023-02-10 14:39:45 +01:00
D.R.racer 009c692138 Remove related unit tests 2023-02-10 14:39:45 +01:00
D.R.racer 75a0ebaf0e Remove handling of left+right buttons in error states
Based on long-term test experience - saves some code + prevents the user from entering hard-to-understand states.
Only Retry remains as the one and only way of recovering from errors.
2023-02-10 14:39:45 +01:00
D.R.racer 2b5a129c7d Add new error codes 2022-12-30 14:44:12 +01:00
D.R.racer db2125e67a Bump version to 2.1.6
new features coming:
- Cut Filament
- Eject Filament
- probably also settable motor currents
2022-12-30 14:44:12 +01:00
D.R.racer 414ee1e0ca Finish EjectFilament operation 2022-12-30 14:44:12 +01:00
D.R.racer 88a489e3cb Add runtime iHold <= iRun check
+ refactor TMC register compilation (saves 26B)
+ update currents registers range documentation
+ update currents even in MovableBase::InitMovementNoReinitAxis
2022-12-29 11:27:34 +01:00
D.R.racer 425f89c862 Optimization - save 30B 2022-12-29 11:27:34 +01:00
D.R.racer 0bca66aeb5 Allow runtime config/register motor/axis iRun current
This commit introduces a new set of registers 0x1e, 0x1f and 0x20 which allow reading and writing iRun current values for each axis/motor.
Please note the register contains raw TMC2130 iRun value which needs to be translated into mA to be understandable by people.
Translation table of iRun -> mA is present in tmc2130.cpp for now.
2022-12-29 11:27:34 +01:00
D.R.racer 9c9322d02f Remove old commented code 2022-12-29 09:01:27 +01:00
D.R.racer b16ac63c5d Compute vSense dynamically from iRun/iHold 2022-12-29 09:01:27 +01:00
D.R.racer 7e8ad83e25 Distinguish iRun<32
as per suggestion from @leptun
2022-12-28 12:15:47 +01:00
D.R.racer e469929c1c Remove ErrEngagingIdler state 2022-12-28 12:15:47 +01:00
D.R.racer ada4ed3dda Workaround INVALID_TOOL error codes
May meed some more work to recover gracefully, not sure if it is just a unit test "issue" or a deeper problem in the state machines.
2022-12-28 12:15:47 +01:00
D.R.racer a52f833223 Fix and tune CutFilament + unit tests
Several issues addressed in this PR:
- CutFilament tuning + error recovery
- introduce register 0x1d (cut filament selector iRun current level)
- optimize setting iRun and iHold currents in the FW
- CutFilament unit test fixed
2022-12-28 12:15:47 +01:00
D.R.racer b6c3cba396 Refactor CheckFINDAvsEEPROM and setup2 2022-12-27 12:41:29 +01:00
D.R.racer 98daf765af Separate NoCommand and StartUp (new state machine)
The reasons for this change are:
- NoCommand is used during the lifetime of the firmware as a fallback in case an unknown command is received (simplifies command handling code). It must remain not doing anything.
- StartUp became a complex infrastructure which needs to "live" until an error is fixed (if any). That requires a "standard" StateInner() function which waits for the user to resolve the error.

Unit tests renamed as well.
2022-12-27 12:41:29 +01:00
Guðni Már Gilbert 35344f5a5e If Finda is not pressed, don't report Unload Manually error 2022-12-27 12:41:29 +01:00
Guðni Már Gilbert 8f212a5cb3 Add unit tests 2022-12-27 12:41:29 +01:00
Guðni Már Gilbert 4d38d1f620 PFW-1423 add Retry handling in NoCommand for init error 2022-12-27 12:41:29 +01:00
D.R.racer 3988a9aff0 Improve logging in unit tests' helpers.ipp
Based on work from @gudnimg: https://github.com/gudnimg/Prusa-Firmware-MMU-Private/tree/MMU-206
2022-12-20 10:35:59 +01:00
D.R.racer 3e9410c4f9 Fix: make sure VerifyEnvironmentState checks filamentLoaded reliably
... and improve unit tests
2022-12-20 06:32:51 +01:00
Guðni Már Gilbert 964ef0ce3d
Merge pull request #250 from gudnimg/Sync-with-MK3
Bump prusa3dboards and don't build with debug symbols when using VScode
2022-12-18 17:55:39 +00:00
Guðni Már Gilbert 6818ac3538 Sync with MK3
- Bump prusa3dboards package
- Set CMake Build Type to Release, otherwise building with this kit doesn't work (debug symbols don't fit)
-  Rename kit to be same as on MK3 firmware
2022-12-18 17:41:22 +00:00
Guðni Már Gilbert 6a4ebdaee6 optimisation: inline functions to reduce size
Change in memory:
Flash: -394 bytes
SRAM: 0 bytes

Breakdown:
|------------------------------------------------------------|
| Function name                            | Flash reduction |
|------------------------------------------| ----------------|
|CommandBase::FinishedOK                   | 182 bytes       |
|MovableBase::InitMovementNoReinitAxis     | 60 bytes        |
|TMC2130::CheckForErrors                   | 36 bytes        |
|Protocol::UInt16ToHex                     | 32 bytes        |
|AddErrorAxisBit                           | 24 bytes        |
|Application::CheckManualOperation         | 22 bytes        |
|CommandBase::GoToErrEngagingIdler         | 12 bytes        |
|Application::PlanCommand                  | 12 bytes        |
|Pulley::FinishHomingAndPlanMoveToParkPos  | 8 bytes         |
|Pulley::InitAxis                          | 4 bytes         |
|------------------------------------------------------------|
2022-11-19 11:55:46 +01:00
D.R.racer c0189d81af Distinguish among different error states when recovering ToolChange
Some errors need specific recovery, it seems it is no longer possible to "just" retry.
2022-11-18 22:42:05 +01:00
D.R.racer c8c39f7b69 Make sure ToolChange moves Selector to desired slot
and verify correct behaviour in unit tests - especially when Selector's start position is at a different slot.
2022-11-18 22:29:01 +01:00
Guðni Már Gilbert 2f6e364ad0 optimisation: compiler should not inline SetFilamentLoaded
Change in memory:
Flash: -130 bytes
SRAM: 0 bytes
2022-11-18 21:33:46 +01:00
D.R.racer eba2c298d1 Raise version to 2.1.5
because we introduced a new error code
2022-11-17 07:32:38 +01:00
D.R.racer 08f777b5cb Introduce FINDA_FLICKERS error code
Intended for scenarios when FINDA used to be OFF but accidentally became ON without a reason.
The user is obliged to inspect FINDA and tune its switching.
2022-11-17 07:32:38 +01:00
D.R.racer 3f09ba0c16 Unit tests: selector refused to move in ToolChange
Revealed all kinds of subtle issues (which is great). All have been fixed in this commit.
2022-11-17 07:32:38 +01:00
D.R.racer 8d992e2706 Report Selector refused to move as FINDA_DIDNT_SWITCH_OFF
MMU-176
2022-11-17 07:32:38 +01:00
D.R.racer c74d418016 Invalidate Idler+Selector homing flags when Retry from ToolChange Error
If FSENSOR_DIDNT_SWITCH_ON was caused by misaligned Idler, rehoming it may fix the issue when auto retrying -> no user intervention.
So first invalidate homing flags as the user may have moved the Idler or Selector accidentally.

Beware: we may run into issues when FINDA or FSensor do not work correctly. Selector may rely on the presumed filament position and actually cut it accidentally when trying to rehome.
It is yet to be seen if something like this can actually happen.

MMU-191
2022-11-15 17:42:12 +01:00
Alex Voinea 0e896cae85 Fix bootloader file generation 2022-11-15 10:43:34 +01:00
D.R.racer 299a31b765 Generate exactly 1 userInput event when button pressed (and held)
This PR is a different solution to what @gudnimg found in PR#233 / PFW-1404.

The benefit of this approach is the fact, that the button press event is generated when the button is pressed and not after it has been released.

The downside is obvious:
CPUFLASH: +28B
RAM: +1B
2022-11-15 07:19:20 +01:00
VintagePC 8ae82dd6b3 Build bootloader hex too 2022-11-11 16:28:39 +01:00
Alex Voinea a4463b9734 Selector: use freewheeling 2022-11-11 10:46:21 +01:00
Guðni Már Gilbert 21a3ceb2b2 PFW-1428 Enable UART1 receiver when the MMU is ready to process incoming messages 2022-11-01 06:39:10 +01:00
Guðni Már Gilbert 144725ab11
Merge pull request #232 from gudnimg/fix-firmware-panic-error-report
Fix issue where firmware panic error code is overwritten
2022-10-28 10:25:21 +00:00