Commit Graph

292 Commits (d75eefff85840e34ad3db0e6651823cc3101a4cc)

Author SHA1 Message Date
Guðni Már Gilbert b00ac883c4 tests: homing: improve SimulateIdlerHoming
Add handling for HomingFailed which can cause the tests
to timeout.

Add checks for HomeForward and HomeBack
2025-10-30 07:43:35 +01:00
Guðni Már Gilbert 9e44c06f1e tests: homing: cleanup SimulateFailedHomeFirstTime
We never home Idler and Selector at the same time. I think we did early perhaps, but now the selector always waits
for the idler homing to be valid.
2025-10-30 07:43:35 +01:00
Guðni Már Gilbert e9889ec066 tests: load_filament: idler homing is not invalidated
The idler is only put on hold, and resumed after a user event is seen.

We must ensure the idler is engaged before feeding to FINDA.
2025-10-30 07:43:35 +01:00
gudnimg 195aad9cf0 tests: fix -Wparentheses in Github CI
warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
2024-12-24 00:14:59 +00:00
vintagepc 8d6e4d1be5
Update CMakeLists.txt
Fix output path of Summary.txt
2023-10-02 16:45:05 -04:00
vintagepc dda3899156
Adjust CTest timeout 2023-09-18 07:29:40 -04:00
VintagePC fe354a1f51 - allow report upload on error
- fix coverage paths
2023-09-17 18:30:50 -04:00
VintagePC fbb00f38d3 - Add tests to cmake run
- Share .dependencies cache with pr-size
2023-09-17 18:15:07 -04: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
Yuri D'Elia 35a89d2452 CircularIndex: add tests for non-power-of-two sizes 2023-07-28 15:48:14 +02:00
D.R.racer 4fa352b4fa Change minimum unit tests to reflect new version nr 2023-07-20 10:28:58 +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 4d3067213f MMU-239 Add unit test for ejecting slots 0-4
This test ejects slots 0 to 4 and goes through the state machine
without creating any errors like FINDA_FLICKERS.

It also verifies the selector parking position is correct for each
ejected filament slot.
2023-06-12 07:39:25 +02:00
Guðni Már Gilbert 9842375450 Improve homing behavior more
Split the wait for HomingValid and the event where we wait
for the Selector/Idler status to go 'Ready' into separate functions
2023-06-12 07:04:51 +02:00
Guðni Már Gilbert bfc953f52d Add more strings to error output in unit tests 2023-06-12 07:04:51 +02:00
Guðni Már Gilbert eb52475819 Improve selector homing behavior in unit tests
Waiting for the selector to return to the parked position after homing
is not enforced by the firmware and should therefore not be enforced by
the unit tests. There are some few exceptions to this, and for those
situations I added a parameter to SimulateSelectorHoming() called
waitForParkedPosition to explicitly wait for the selector to return to
the parked position if set to true. This is very useful when setting up
test cases in general and also allows us to control the behavior in each
test.
2023-06-12 07:04:51 +02:00
Guðni Már Gilbert 372045c38c Update cut filament unit test 2023-06-12 07:04:51 +02:00
Guðni Már Gilbert 8c873c8a53 cleanup: unit tests: Remove unused Catch namespace 2023-06-04 14:06:03 +00: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 c4e23b687d Clean-up TMC SG trs setting in COOLCONF register 2023-03-14 17:58:11 +01:00
D.R.racer f0a633b4b6 Ignore Idler's SG signal from TMC when rolling over filaments 2023-03-14 17:58:11 +01:00
D.R.racer 95915cb080 Prototype adaptive Idler homing sg_thrs
Needs to be tweaked further to make it a production code.
But my primary concern now is the fact that it doesn't seem to help too much while homing over the too-tightened Idler cover.
2023-03-14 17:58:11 +01:00
D.R.racer 314233b37f Add runtime VCC measurement as register
- extract logic of undervoltage handling into main.cpp
- fix unit tests
- bump version to 2.1.9 (new register)
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 ea41fd6b83 Update unit tests 2023-03-02 12:20:06 +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 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 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
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
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 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
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
Guðni Már Gilbert 0e625dc551 circular_buffer: implement reset()
reset() discards any data in the buffer (head == tail)

Change in memory:
Flash: -116 bytes
SRAM: 0 bytes
2022-10-25 07:21:33 +02:00
Yuri D'Elia 3567a3dcd5 motion: Also test for the simplest case of a single+unplanned move 2022-10-22 17:40:28 +02:00
Yuri D'Elia 7053755b0e motion: Add tests for unscheduled moves in AbortPlannedMoves
This catches the previously untested #228
2022-10-22 17:21:08 +02:00
Guðni Már Gilbert 0506af08ac
Merge pull request #226 from gudnimg/parallel-unit-tests
Run unit tests in parallel when possible
2022-10-22 14:50:17 +00:00
Guðni Már Gilbert 353affb9f3 Optimise Catch2 V3 includes + fix a few cases of missing includes 2022-10-22 15:41:44 +02:00
Guðni Már Gilbert 45f70e004c Update CMake integration for Catch v3.1.0 2022-10-22 15:41:44 +02:00
Guðni Már Gilbert 8c5c84cc17 Formatting 2022-10-21 22:03:08 +00:00
Guðni Már Gilbert d6029f7fd2 Move the other Ctest arguments into a single variable 2022-10-21 22:02:19 +00:00
Guðni Már Gilbert 745be900ef Run unit tests in parallel if possible
ReadResponse unit tests usually takes at least 30 seconds to run on my
computer, so having the unit tests run on more than one thread makes a
big difference.
2022-10-21 21:30:15 +00:00
Alex Voinea e2924c3506 Fix tests 2022-10-20 12:09:42 +02:00