Commit Graph

242 Commits (129a89cf075b55a1024ecaf3659ea0db798f1291)

Author SHA1 Message Date
Alex Voinea 129a89cf07 Fix stall detection polarity 2021-07-29 10:01:33 +02:00
Alex Voinea 5f83667b22 Finish init sequence 2021-07-29 10:01:33 +02:00
Alex Voinea e9046eed42 tmc2130: More init 2021-07-29 10:01:33 +02:00
Alex Voinea 1022603f9d tmc2130: Initial spi communication 2021-07-29 10:01:33 +02:00
Alex Voinea e2ba71fc03 tmc2130: Define the SPI bus for the tmc drivers 2021-07-29 10:01:33 +02:00
Alex Voinea d484685e02 tmc2130: Registers 2021-07-29 10:01:33 +02:00
DRracer 151a672f56
Merge pull request #71 from wavexx/motion_units
Motion units
2021-07-27 06:34:32 +02:00
D.R.racer 7f39f07679 Avoid repeated Enable/Disable on an axis if already in desired state 2021-07-27 06:25:01 +02:00
Yuri D'Elia 1abc8713bb Fix ejectLength typo 2021-07-26 11:22:40 +02:00
DRracer dc36afb82c
Merge branch 'main' into motion_units 2021-07-26 09:35:13 +02:00
D.R.racer 8a1df52d79 Add support for reporting MMU errors via S3 msg 2021-07-26 09:34:40 +02:00
D.R.racer 6af65bc4c8 Rename ISR -> Isr to avoid clash with AVR libc ISR #define 2021-07-26 09:34:24 +02:00
D.R.racer 1f7a84a623 Support CR XOR LF in protocol's line ending implementation
Please note Windows CRLF sequence is not supported,
but a separate CR xor a separate LF works now.

This is a workaround for stupid terminals for debugging purposes,
and it is not necessary for the protocol to work on its own.
It may be removed in the future.
2021-07-26 09:34:02 +02:00
Alex Voinea b109a520c2 buttons: Fix comment 2021-07-26 06:49:05 +02:00
Yuri D'Elia 5928ade6be Improve motion::unitToAxisUnit template parameter names 2021-07-26 01:28:29 +02:00
Yuri D'Elia 051bce9098 Nicely format doxygen documentation 2021-07-25 23:50:01 +02:00
Yuri D'Elia d955897829 Convert config::selectorSlotPositions to physical units 2021-07-25 23:13:28 +02:00
Yuri D'Elia 6daf7fd060 Convert config::idlerSlotPositions to physical units 2021-07-25 22:39:18 +02:00
Yuri D'Elia b133c8b975 Simplify and enhance unit conversion
- Move unit/step conversion to modules/axisunit.h
- Unify motion::unitToAxisUnit<> and motion::unitToSteps<>,
  making conversion in other modules just as easy as motion.
- Improve the documentation
2021-07-25 22:25:48 +02:00
Yuri D'Elia 187858d228 Move config/unit.h to unit.h and it's own namespace 2021-07-25 22:14:56 +02:00
Yuri D'Elia 49275b2cb2 Update eject_steps with the new unit API for demonstration 2021-07-25 17:25:37 +02:00
Yuri D'Elia 402a2b91ce Define Motion::PlanMove/PlanMoveTo as constexpr 2021-07-25 17:08:15 +02:00
Yuri D'Elia 888cdf7cd5 Introduce compile-time axis unit type checks and conversions
Introduces:

- config::Unit: base class for physical quantities
- motion::AxisUnit: type-checked steps type

"config/unit.h" defines basic physical quantities, which are not
normally used elsewhere besides config.h.

"modules/axisunit.h" extends the modules::motion namespace with
Axis-aware units, with one type per axis per unit.

P_pos_t defines step positions for the pulley, I_pos_t for the idler,
etc. These are defined through the literar operators which are
similarly named and automatically convert a physical quantity to an
AxisUnit at compile time:

P_pos_t pulley_pos = 10.0_P_mm;

Besides type-checking, AxisUnit are otherwise identical to raw step
counts and are intended to be used along with the updated Motion API.

PlanMove/PlanMoveTo has been extended to support moves using these units
or physical quantities. Again, conversion is performed at compile time.
2021-07-25 16:39:54 +02:00
Yuri D'Elia 5e04d4ccaf Add getters/setters for Jerk in Motion/PulseGen
This allows us to make tests that expect jerk to be the same across two
axes, even if they're statically configured differently.
2021-07-25 01:24:40 +02:00
Yuri D'Elia 606b22a9ad Make Motion::Acceleration const 2021-07-25 01:17:25 +02:00
D.R.racer 777c830ac0 Add error handling and reporting documentation
and fix links from the main.dox page
2021-07-21 14:50:23 +02:00
D.R.racer 9d2f8b2b39 Fix indentation once again
please use the pre-commit script to solve indentation
2021-07-19 06:25:09 +02:00
Alan Dragomirecký 532f2fadb0 holly: Fix dependency downloading (clang-format) 2021-07-16 11:57:40 +02:00
D.R.racer 0744009955 Fix FW build - define (empty) TMC2130::Init 2021-07-14 09:00:40 +02:00
D.R.racer f62cb99b13 Fix TMC2130 stub
so that motion unit tests build and run
2021-07-14 08:38:10 +02:00
DRracer 52e3c3375a
Merge pull request #47 from wavexx/motion_wip
WIP: Motion API
2021-07-14 08:26:49 +02:00
Yuri D'Elia 4160d019be Motion: implement InitAxis 2021-07-13 20:44:09 +02:00
Yuri D'Elia 8f0732a0cc Motion: initial StallGuard support
Add the code in the right position to sample StallGuard and set/reset
the trigger flag.
2021-07-13 20:36:43 +02:00
Yuri D'Elia f28567a051 Motion tests: improve comments 2021-07-13 20:21:28 +02:00
Yuri D'Elia eec95d6fb7 Motion: add assertions for stepTimerQuantum 2021-07-13 19:40:00 +02:00
Yuri D'Elia 324fb92fd5 Motion: implement timer multiplexing 2021-07-13 19:21:13 +02:00
D.R.racer c81072d1d5 Add sending of response messages 2021-07-13 17:53:31 +02:00
Yuri D'Elia d0581bf494 Motion: Add more methods and tests
- Add SetPosition/CurPosition (not only) for testing
- Implement some real tests
2021-07-13 17:43:50 +02:00
Yuri D'Elia 4fd22f0656 Motion: add initial test infrastructure and stubs 2021-07-13 16:16:56 +02:00
Yuri D'Elia 18ced44341 Merge remote-tracking branch 'upstream/main' into motion_wip 2021-07-13 15:31:31 +02:00
Yuri D'Elia d9d769721f hal/cpu: reformat 2021-07-13 15:24:43 +02:00
Yuri D'Elia c7459df05e PulseGen: improve comments. 2021-07-13 15:10:47 +02:00
Yuri D'Elia fcb1b0c85d cmath.h: convert AVR min/max/abs into templates
At least for min/max this will ensure types for both arguments are the
same.

This should be a little bit closer to the <cmath> definition that
simply overloads these functions instead.
2021-07-13 01:08:33 +02:00
Yuri D'Elia 98845008aa Rename Motion::CurrentPos to Position()
This matches PulseGen::Position() and avoids confusion around the term
"current": Position() returns the head position in the queue, not the
"live" axis position.

We have PulseGen::CurPosition() now for this purpose, although we don't
expose it to Motion yet.
2021-07-13 01:03:03 +02:00
Yuri D'Elia 9bb1bf4a53 PulseGen: typos in comments 2021-07-13 00:54:03 +02:00
Yuri D'Elia 16e7f62aee PulseGen: introduce CurPosition() for testing
CurPosition() returns the live axis position, which in this
implementation is inherently expensive to compute.

This shouldn't be required for the MMU, but it /will/ come in handy to
check for the axis position/s in Motion tests.
2021-07-13 00:48:44 +02:00
D.R.racer eed1c3f07a Fix buttons unit tests after ADC update 2021-07-12 18:01:57 +02:00
Alex Voinea edf0804fd8 Fix Buttons ADC range 2021-07-12 16:55:37 +02:00
Alex Voinea d44de216a9 Fix ADC channels 2021-07-12 16:55:37 +02:00
Alex Voinea 4281e89e5d HAL adc 2021-07-12 16:55:37 +02:00