Commit Graph

266 Commits (9232e55563c0dd7394d6691725a6fad8d4bd85b1)

Author SHA1 Message Date
Alex Voinea 9232e55563 millis interrupt 2021-08-04 10:51:33 +02:00
D.R.racer 2062a604d8 Improve unit computation
based on #76 which added a possibility to perform arithmetic operations
on unit-based quantities
2021-08-02 10:52:18 +02:00
D.R.racer 8694c53033 Fixes after rebase onto main 2021-08-02 10:52:18 +02:00
D.R.racer aa5995368d Update to latest main + fix unit tests
... in relation to the newly introduced stepping in physical units rather than in steps
2021-08-02 10:52:18 +02:00
D.R.racer 16dc129b49 Set real slot positions for the Idler and Selector
Extracted from the previous FW, may need some tuning based on units selected
for each of these axes (degrees, millimeters) - waiting for an update
of the motion implementation.

Updated starting conditions of the unit tests to reflect the global configuration.

MMU-58
2021-08-02 10:52:18 +02:00
D.R.racer ef96d998a3 Link top level error reporting to TMC2130 error flags 2021-08-02 07:45:45 +02:00
D.R.racer 7029b1b03d Reformat config.h after rebase 2021-08-02 07:45:45 +02:00
D.R.racer d94ad8b90e Merge coil errors, fix bit masks 2021-08-02 07:45:45 +02:00
D.R.racer f7c3d0b479 Fix axis bit masks 2021-08-02 07:45:45 +02:00
D.R.racer 751ee46450 Add bit masks for error codes for the TMC drivers
+ add common error handling for idler and selector
+ improve error handling in command_base
+ rename ERR1xxxx errors to ERRxxxx (remove the '1')
2021-08-02 07:45:45 +02:00
D.R.racer df2c1ba7fe Add prototype of unified handling of HW errors in the logic layer 2021-08-02 07:45:45 +02:00
D.R.racer f5df642eb5 Improve error codes
- Distinguish among FINDA on/off failuje
- The same applies to newly introduced Filament sensor errors
- Add TMC init error
- Add a communication error ID - to be used on the printer
2021-08-02 07:45:45 +02:00
Yuri D'Elia 7dcd4975e1 Allow units to be scaled by an unitless quantity
This allows Unit<> and AxisUnit<> to be scaled with a fraction as
expected, promoting the scaler to the same unit:

  0.2_mm * 10 => 2_mm (mm*f => mm)

Multiplication type is commutative:

  10 * 0.2_mm => 2_mm (f*mm => mm)

Division isn't:

  0.2_mm / 10 => 0.02_mm (mm*1/f => mm)
  10 / 0.2_mm => error (illegal type conversion)
2021-08-02 07:41:26 +02:00
D.R.racer fae7dead93 20 bits for coostep thr 2021-07-29 10:01:33 +02:00
D.R.racer b61836dd57 Remove shifting in config for TMC + add compile-time checks 2021-07-29 10:01:33 +02:00
D.R.racer a8147be803 Fix unit tests + rebase onto main + extract TMC parameters into config 2021-07-29 10:01:33 +02:00
Alex Voinea aca2cb7e79 tmc: Error flags 2021-07-29 10:01:33 +02:00
Alex Voinea 8577852b09 tmc2130: Stallguard and Isr 2021-07-29 10:01:33 +02:00
D.R.racer 3d1880c006 Make tests compile
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)
2021-07-29 10:01:33 +02:00
Alex Voinea 364f1bcb0d tmc2130: error handling stack overflow fix 2021-07-29 10:01:33 +02:00
Alex Voinea d071a6abf6 TMC pin map 2021-07-29 10:01:33 +02:00
Alex Voinea 2cdc3bfbc4 tmc2130: report error during init 2021-07-29 10:01:33 +02:00
Alex Voinea 3f20ff88ee Reorder functions 2021-07-29 10:01:33 +02:00
Alex Voinea b97aefcb5c tmc2130: More functions 2021-07-29 10:01:33 +02:00
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