Introduces a nasty hack to forcefully write into the constexpr SPI descriptor's registers
(which is the correct way in ASM, but kind of cumbersome in C++ now)
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.
- 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
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.
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.
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.