Commit Graph

292 Commits (448edfd84bb61f437d9e823fa8d67bc854cf7c1f)

Author SHA1 Message Date
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
Alan Dragomirecký 86f5e19b54 Remove unused Python dependecies 2021-07-12 08:52:57 +02:00
Yuri D'Elia 2db97c0f5e Fix CMake "files" expression in pre-commit 2021-07-12 08:51:10 +02:00
Yuri D'Elia 9b77623be1 PulseGen: ensure Abort calculates the current remainder correctly
Instead of stepping halfway, step ~1/3 of the way through.

This ensures we can check if the steps performed is correct due to the
internal step subtraction.
2021-07-11 22:19:44 +02:00
Yuri D'Elia 9e935f6a07 Comment Typo 2021-07-11 22:17:04 +02:00
Yuri D'Elia e53a91d563 Implement more methods in Motion, remove Motion::Full()
Motion::Full() (without a specific axis) is counter-productive.

When planning new moves the axis needs to be known beforehand, so it
might be as well be given to Full() to check the proper queue.
2021-07-11 22:07:23 +02:00
Yuri D'Elia 7337e97765 Rename Motion::DisableAxis to Disable
Implement Motion::SetEnabled (for symmetry with TMC2130::SetEnabled).

Rename DisableAxis to Disable and use the new SetEnabled. This makes the
member names more consistent.
2021-07-11 21:38:01 +02:00
Yuri D'Elia 066aab7adc Move cpuFrequencyDivider to config::stepTimerFrequencyDivider 2021-07-11 21:17:08 +02:00
Yuri D'Elia 0c47d8f0d1 PulseGen: add comprehensive tests (no acceleration yet) 2021-07-11 20:52:27 +02:00
Yuri D'Elia 5250cfd4fe Implement the SHR16::SetTMCDir stub for testing 2021-07-11 20:33:59 +02:00
Yuri D'Elia b01a819644 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-11 20:25:52 +02:00
Yuri D'Elia 32e09afd4c 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-11 20:23:21 +02:00
Yuri D'Elia 1ff9b81630 Rename PulseGen::Move to PlanMoveTo
Make Motion and PulseGen intentionally very similar.
2021-07-07 16:59:40 +02:00
Yuri D'Elia be30314634 Motion: initialize axes in the same order as the enumeration 2021-07-07 16:59:40 +02:00
Yuri D'Elia 2875e61484 Motion: allow to query the buffer per-axis
We might want to schedule new moves while a single motor is moving.
Allow to do that by introducing per-axis query functions.

The main QueueEmpty() and Full() still function as before:

- Call QueueEmpty() to wait for all moves to finish.
- Use !Full() to know that a Plan() move will never be discarded.
2021-07-07 16:59:40 +02:00
Yuri D'Elia 94f11642e0 PulseGen: perform an extra queue check in Move()
Since scheduling a move on a block which is being executed will jolt the
motors, be extra-safe and perform an extra lower-level check before
committing even if the caller is responsible.

Return the status, which can be useful to build a simple busy loop.
2021-07-07 16:59:40 +02:00
Yuri D'Elia bd8ae62211 PulseGen: cleanup AxisData initialization 2021-07-07 16:59:40 +02:00
Yuri D'Elia 16cf02726b test_speed_table: improve static assertion
Test against the resulting timer speed, not against the CPU clock
2021-07-07 16:59:40 +02:00
Yuri D'Elia d87db1ff76 Revised WIP for the Motion API
- Remove the combined PlanMove(a,b,c,rate) call. If we allow the units
  of the various motors to be changed at compile time, the unit of
  rate can vary between axes.
- Build PlanMove on top of the absolute PlanMoveTo.
- Add required stubs for TMC2130.
- Allow each axis mode to be set independently, since we have this
  feature for free anyway.
- Rework internals to use PulseGen data types and structs.
2021-07-07 16:59:39 +02:00
Yuri D'Elia e990b703e3 CMake: reformat 2021-07-07 16:59:04 +02:00
Yuri D'Elia d7874d5336 PulseGen: implement AbortPlannedMoves 2021-07-07 16:59:04 +02:00
Yuri D'Elia 44a263d334 PulseGen: move Step() to header for inlining 2021-07-07 16:59:04 +02:00
Yuri D'Elia 6f518f1ed2 PulseGen: complete implementation 2021-07-07 16:59:04 +02:00
Yuri D'Elia ed04bd02e2 PulseGen/speed_tables: cleanup constants 2021-07-07 16:59:04 +02:00
Yuri D'Elia 006dfd4abc PulseGen: remove all floating point calculations
Work in steps, steps/s, steps/s2 directly.
2021-07-07 16:59:04 +02:00
Yuri D'Elia cf5be5aade PulseGen: initial version of the ramp/pulse generator 2021-07-07 16:59:04 +02:00
Yuri D'Elia 7d2329cf85 Add src/cmath.h for <math.h> portability between platforms 2021-07-07 16:59:04 +02:00
Yuri D'Elia de88ed4c6b Add initial Axis configuration static structs 2021-07-07 16:59:04 +02:00
Yuri D'Elia ef7c776461 Update Motion for the new TMC2130/pins definitions 2021-07-07 16:59:04 +02:00