Commit Graph

207 Commits (f6a943812f9c6e8673323a57bda0b4b148a63afe)

Author SHA1 Message Date
Guðni Már Gilbert b9677f922a Optimisation: make constructors constexpr
Cppcheck was complaining some member variables
are not initialised in the constructor.

Change in memory:
Flash: -186 bytes
SRAM: -15 bytes
2023-08-21 06:30:25 +02:00
D.R.racer 0419bdefd7 Perform up to maximumBowdenLength while unloading to FINDA
+ update unit tests to match the changed implementation
2023-08-10 16:08:07 +02:00
D.R.racer 3a105cab4a Introduce bowden length RW register (no runtime autotune)
contains updated unit tests
2023-08-10 16:08:07 +02:00
D.R.racer f164a8afa0 Enforce specific ErrorCodes bitmask values 2023-07-28 17:11:43 +02:00
Guðni Már Gilbert 169925fc9f fixup
No change in memory
2023-07-28 17:11:43 +02:00
Guðni Már Gilbert 5293547094 optimisation: Add << operator to ErrorCode
Change in memory:
Flash: -54 bytes
SRAM: 0 bytes
2023-07-28 17:11:43 +02:00
Guðni Már Gilbert edec4708b5 MMU-239 Add unit test for FINDA flickering when ejecting filament
The test case test the error recovery on all MMU slots.
2023-06-12 07:39:25 +02:00
Guðni Már Gilbert 48ea52bd47 Minor header cleanup 2023-06-12 07:39:25 +02:00
Guðni Már Gilbert ddc962067c Fix missing ErrorCode::RUNNING
This is needed in case we are recovering
from FINDA_FLICKERS
2023-06-12 07:39:25 +02:00
Guðni Már Gilbert 20a2ee7d56 Fix false FINDA_FLICKERS on Toolchange retry
Delay reporting the cut command finished until the selector has returned
back to the cutting slot. This was done by adding ProgressCode::Homing
to the Cut Filament state machine. ProgressCode::ReturningSelector is
then used to wait for the selector to return back to the cut slot after
homing becomes valid again. Only then is the cut operation reported
finished and a new command can be processed e.g. Toolchange.

Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-06-12 07:04:51 +02:00
Guðni Már Gilbert 4a315c920a Remove redundant call to SetPairButOffOthers
retract.Reset takes care of setting the green LED to blink.
Might as well turn of the red LED during reset just in case.

Change in memory:
Flash: -30 bytes
SRAM: 0 bytes
2023-05-04 07:51:45 +02:00
Guðni Már Gilbert c096725674 modules: leds: Implement SetAllOff()
A helper function which turns of all LEDs
reduces code size :)

Change in memory:
Flash: -64 bytes
SRAM: 0 bytes
2023-05-02 07:32:27 +02:00
Guðni Már Gilbert c6c23e2c06 logic: eject_filament: reset LED state on OK event
Fix a minor issue where once the FILAMENT_EJECTED error screen
is shown on the MK3S+, the LEDs will stay blinking red even after
the user has removed the filament and clicked "Done".

My proposal is to turn the LED off.

Steps to reproduce:
1. Boot up printer and MMU in a clean state
2. MK3S+: on the LCD click "Load to Nozzle"
3. Once the loading is done, click "Unload filament"
4. Once unloading is done, click "Eject filament"
5. FILAMENT_EJECTED MMU error screen appears on the printer's UI
6. Remove the filament and select "Done".
* Expected behavior: Blinking red LED turns off (or goes green).
* Actual behavior: LED continous to blink red with no error screen.

Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-05-02 07:32:27 +02:00
D.R.racer f07e206398 Hold/Resume Idler+Selector even after their homing errors
MMU-222
2023-03-14 18:14:02 +01:00
D.R.racer bafad408b7 Hold Idler and Selector even in logic::StartUp error handling
StartUp doesn't share the common ErrDisengageIdler code so the hold/resume must be used explicitly.
2023-03-14 18:08:10 +01:00
D.R.racer 59bbe0274a Reallocate MCU_UNDERVOLTAGE_VCC error code value 2023-03-08 15:14:36 +01:00
Alex Voinea 23a9978980 VCC undervoltage check module 2023-03-08 15:14:36 +01:00
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 d75119c8d6 Suspend all moves of Idler and Selector when entering an Error screen 2023-03-02 12:20:06 +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
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 414ee1e0ca Finish EjectFilament operation 2022-12-30 14:44:12 +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 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
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
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
Guðni Már Gilbert 394f290bfb Check for ERRInternal in command_base Step()
Reduces code size significantly
2022-10-27 15:40:15 +00:00
Guðni Már Gilbert ef4246dd9a Fix issue where firmware panic error code is overwritten
If QUEUE_FULL error happened, it would be overwritten as INTERNAL
and incorrectly display FW_RUNTIME_ERROR on MK3S.

The fix is to add handling for ERRInternal in every StepInner() and forward the error
to higher application layer
2022-10-26 20:39:28 +00:00
Alex Voinea 3b85df297e hwSanity: Disable the steppers after test
flash: -44
RAM: 0
2022-10-22 16:48:48 +02:00
VintagePC 33b9e74b72 Restore the Error check axis bits 2022-10-10 12:08:58 -04:00
vintagepc 9c7701c123
Merge pull request #203 from prusa3d/vintagepc-check-hardware
Add module to check for sketchy electronics
2022-09-22 12:17:04 -04:00
D.R.racer 0fa8a3c278 Refactor original solution from @leptun
- rename stall*guard to StallGuard (match name with the vendor)
- separate TMC2130 module from EEPROM (they do not need to know about each other at all)
- separate SGTHRS settings from motion - moved to globals like all other "global" parameters
- improved EEPROM storage for SGTHRS
2022-09-22 12:16:41 +02:00
VintagePC c5a5304775 Minor cleanup 2022-09-21 18:28:22 -04:00
VintagePC 8c6435d4e8 Change back a debug test 2022-09-16 19:46:48 -04:00
VintagePC 10fd23700b Improve implementation 2022-09-16 19:39:27 -04:00