Commit Graph

920 Commits (39b24f8b43e7121f7e8b8d194a92b3a0e2920118)

Author SHA1 Message Date
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
VintagePC 55637e6055 Fix pathing for gcovr 2021-07-12 12:50:06 +02:00
VintagePC b0c25e8bd4 Fix handling failed tests. 2021-07-12 12:50:06 +02:00
VintagePC dc161812f3 First take, WIP 2021-07-12 12:50:06 +02:00
Yuri D'Elia be9296281f Make Read/Write/Toggle pin functional for testing
Make ReadPin return the last value set by WritePin for proper testing.

Add a slow-path to TogglePin that goes through a read-write cycle. This
is useful both for testing and for platforms that don't have an
efficient toggle like AVR.
2021-07-12 11:25:04 +02:00
Yuri D'Elia 151f030318 Fix return value of gpio::ReadPin
The cast to Level is incorrect, since the expression returns either 0 or
a positive value if the pin is set. The value is directly assigned to
the underlying uint8_t, meaning that Level::high won't match for levels
greater than 0.

Return a boolean and cast that to Level instead.
2021-07-12 11:25:04 +02:00
Yuri D'Elia a5a91cbaa8 tests: remove relative cmake paths in pulse_gen/speed_table 2021-07-12 11:11:49 +02:00
Yuri D'Elia 6ba7d510ca pre-commit: handle cmake files in subdirectories
Apparently "files:" receives the full path and not just the basename,
so update the regex accordingly.
2021-07-12 10:45:35 +02:00
Yuri D'Elia 787c73ecff Merge remote-tracking branch 'upstream/main' into motion_wip 2021-07-12 10:25:06 +02:00
Yuri D'Elia 9b0dd2d633 Motion: fix new Step() prototype 2021-07-12 09:58:53 +02:00
Alan Dragomirecký cf5b1c3955 Do not use hard-to-read relative paths in CMake 2021-07-12 09:09:21 +02:00
Alan Dragomirecký 3a131cfa0a Remove mentions of the -m32 flag (commented code) 2021-07-12 09:09:21 +02:00
Alan Dragomirecký c3f0e59d12 Remove the empty integration tests directory 2021-07-12 09:09:21 +02:00
Alan Dragomirecký 332c740a8b Do not build the firmware target when crosscompiling 2021-07-12 09:09:21 +02:00
Alan Dragomirecký 5018c44489 Do not include the utils directory 2021-07-12 09:09:21 +02:00
Alan Dragomirecký 09819cb1aa Split the main CMakeLists.txt into more files within subdirectories 2021-07-12 09:09:21 +02:00
Alan Dragomirecký ed72b07e04 Remove `include` from header search paths 2021-07-12 09:09:21 +02:00
Alan Dragomirecký 6f68fc6e76 Remove empty CMakeLists from the utils directory 2021-07-12 09:09:21 +02:00
Alan Dragomirecký 99b847bf98 Remove the PRINTER cmake option and other irrelevant code 2021-07-12 09:09:21 +02:00
Yuri D'Elia b3f3f0538e Shim <limits> on AVR
Instead of adding #ifdefs for missing headers, create a shim that can be
included everywhere.

"limits.h" includes a bare-bone implementation of numeric_limits (to be
extended as needed).
2021-07-12 09:02:05 +02:00
Alan Dragomirecký 3dbba6ca88 holly: Temporarily disable builds of the firmware (as there is no
avr-gcc available)
2021-07-12 08:52:57 +02:00
Alan Dragomirecký ba19208469 Add Dockerfile/Jenkinsfile for Holly 2021-07-12 08:52:57 +02:00
Alan Dragomirecký 8361bd1027 Replace urls for gcc-avr with dummy (but working) ones 2021-07-12 08:52:57 +02:00