Commit Graph

528 Commits (fd6c0bcc234e0b44e32ffb2f34c30b657299e33e)

Author SHA1 Message Date
Alex Voinea fd6c0bcc23 Symmetrical latch signal 2021-12-01 09:07:08 +01:00
Alex Voinea f509dc8346 Adjust latch pulse length 2021-12-01 09:07:08 +01:00
Alex Voinea d399a024bb SHR16 correct signal timing 2021-12-01 09:07:08 +01:00
D.R.racer 662e05b813 Turn off other LEDs when appropriate
Solves an interesting tiny issue introduced in the previous commits.
When we start with the filament in selector, the corresponding LED
is set to ON. However, all of the logic state machines only operated
on the LED pair of the active slot -> the starting LED may have been
left ON in some edge cases.

Now, this is resolved by clearing all other LEDs except for the active
slot where appropriate.
2021-11-25 13:04:22 +01:00
D.R.racer f2f82c620a Set green LED at start when filament loaded + set Idler as idle at start 2021-11-25 13:04:22 +01:00
D.R.racer e064a6c2f5 Introduce H0 command to invoke Idler+Selector homing seq. if safe 2021-11-25 13:04:22 +01:00
D.R.racer 9bf2b401e4 Avoid homing the idler at start when printing 2021-11-25 13:04:22 +01:00
D.R.racer 6973dbff13 Introduce intelligent homing if Idler and Selector
Both movable components now perform homing sequences transparently
whenever the logic layer invalidates the homingValid flag.
That reflects the fact, that the user may have moved the Idler or Selector
while trying to resolve a HW issue with un/loading filament.

Basic rules:
- Idler gets rehomed immediately and then moves into the target slot position
- Selector rehomes once it is possible - i.e. when filament load state
  is AtPulley - then it immediately and spontanneously executes the homing
  sequence and then returns to the desired state

Motivation:
- resolve startup issues (EEPROM says we have filament, but FINDA is not triggered)
- resolve accidental moves of Idler and/or Selector while
  digging out stuck filament from the unit
2021-11-25 13:04:22 +01:00
D.R.racer 7d423df583 Swap buttons left<->right 2021-11-23 12:55:39 +01:00
D.R.racer 6f982e2505 Cleanup compiler warnings 2021-11-17 08:48:59 +01:00
D.R.racer 151adf810a Add ToolChange Error resolve Button2 unit tests 2021-11-17 08:48:59 +01:00
D.R.racer 515119edc8 Test ToolChange error recovery by button 0 and 1 2021-11-17 08:48:59 +01:00
D.R.racer 7fe9d7f329 Finish UnloadFilament unit test - error state resolved by user + checks 2021-11-17 08:48:59 +01:00
D.R.racer afab309d27 Extract common Dis/Engaging of idler in Error states into base class 2021-11-17 08:48:59 +01:00
D.R.racer c2325b687a Unittests: set buttons more consistently 2021-11-17 08:48:59 +01:00
D.R.racer 872b2206ed Cleanup error recovery of LoadFilament
+ cover all paths with unit tests
2021-11-17 08:48:59 +01:00
D.R.racer 96397ec16b Improve error handling of ToolChange state machines
... and fix an edge case in LoadFilament
2021-11-17 08:48:59 +01:00
D.R.racer bfa710525b Discard all remaining planned blocks with AbortPlannedMoves
Previously it looked like only the active block has been discarded
which worked most of the time, since we only planned single moves.
But with introduction of PlanLongMove in one of the last commits
this is not true anymore.
2021-11-17 08:48:59 +01:00
D.R.racer 62e12102fd Check for FSensor OFF after unloaded to FINDA
we may discuss when to check for the FSensor state and why,
but this approach seemed to me like the least invasive method
of just checking the fsensor state and reporting an error in case
it didn't switch off.
2021-11-17 08:48:59 +01:00
D.R.racer 2a1539b65b Fix Right button handling for Load/Unload 2021-11-17 08:48:59 +01:00
Yuri D'Elia b6a676e093 AVR: Do not use __builtin_abs() for long types
In AVR __builtin_abs() breaks for non-base types.

Provide a generic function and use an overload when it is safe to use
instead.

This fixes the underlying step count calculation in PlanMove, thus
removing the need for the PlanLongMove work-around.
2021-11-11 07:41:48 +01:00
D.R.racer 2d81332626 Fix typo - selector homing condition 2021-11-03 10:37:51 +01:00
D.R.racer ffd8924d8c Fix start MMU with filament blocking the selector 2021-11-03 10:37:51 +01:00
D.R.racer 2640e9d899 Fix inverted condition (kudos to @leptun) 2021-11-03 10:13:03 +01:00
D.R.racer fa4e687fdc Fix chopping negative move values in PlanLongMove
+ use PlanLongMove in UnloadToFinda
+ fix comment in unit test
2021-11-03 10:13:03 +01:00
D.R.racer c3aec0bf92 Fix pulse gen unit tests with the larger block buffer 2021-11-03 10:13:03 +01:00
D.R.racer 5f1e3e018e Workaround planning moves longer than 32K steps 2021-11-03 10:13:03 +01:00
D.R.racer 7f9fc78cf6 Improve motion's unit tests 2021-11-03 10:13:03 +01:00
D.R.racer 6294e39746 Avoid repeated writes into the shift register
May reduce flickering of LEDs on some boards
2021-11-03 10:13:03 +01:00
D.R.racer 22522c253f Update code after rebase onto main 2021-10-21 15:16:29 +02:00
D.R.racer 9438253106 Avoid trying to unload filament when not loaded
however, it looks like the EEPROM is not updated correctly, needs more testing
2021-10-21 15:16:29 +02:00
D.R.racer 04348b2d86 Make all SHR16 public functions "thread-safe" 2021-10-21 10:17:10 +02:00
D.R.racer 19dcfcef79 Revert selector's config back after testing on real HW 2021-10-21 07:55:41 +02:00
D.R.racer 021c79ff10 Fix unit test Feed to Bondtech 2021-10-21 07:55:41 +02:00
D.R.racer 63509af294 Fix cut filament unit tests
still, this may need some more work in relation to PR #128
2021-10-21 07:55:41 +02:00
D.R.racer 3d2a76b6a0 Fix feed_to_finda unit test 2021-10-21 07:55:41 +02:00
D.R.racer ee247246ee Fix unit tests
- fix homing procedure for Idler and Selector
  (homing now ends with a move to the Parking position)
- fix unit tests' startup conditions with regard to necessary
  homing of Idler and Selector

TODO: still test_cut_filament fails for minor reasons
2021-10-21 07:55:41 +02:00
Alex Voinea 7380cb740a Pulley SG increased 2021-10-21 07:55:41 +02:00
Alex Voinea 99c05b79d0 Adjust SG filtering threshold 2021-10-21 07:55:41 +02:00
Alex Voinea a87b981a3d Homing initial 2021-10-21 07:55:41 +02:00
D.R.racer 0fbcb9dac2 Tag all source files with @file for doxygen 2021-10-18 17:59:46 +02:00
D.R.racer 5b9c6ec36e Fix (workaround) LED blink when millis overflow + unit test 2021-10-18 16:30:08 +02:00
D.R.racer 8eb6240541 Add HAL AVR EEPROM implementation 2021-10-18 16:29:54 +02:00
D.R.racer abe2567c84 Fixes for loading filament into nozzle
Slower speed once we reach the fsensor + avoid grind while disengaging the Idler
while the printer is already pulling the filament.
2021-10-18 07:29:13 +02:00
Alex Voinea 9dc2ccc337 Revert accidental include 2021-10-14 14:27:56 +02:00
Alex Voinea 438ced6b96 Revert accidental commit 2021-10-14 14:27:56 +02:00
D.R.racer 9994d05d7f Reformat usb_cdc.cpp 2021-10-14 14:27:56 +02:00
D.R.racer d35bcd258a Refactor after rebase onto main 2021-10-14 14:27:56 +02:00
Alex Voinea 78af22e6c3 Dual bank test. Seemed to work for me. Don't care if it's placebo 2021-10-14 14:27:56 +02:00
Alex Voinea 538d4c8ef6 Remove useless debug info 2021-10-14 14:27:56 +02:00