Commit Graph

564 Commits (9c9322d02f2f1b47d54986d3dbe8fd1beb6752dd)

Author SHA1 Message Date
Alex Voinea 55ac3d5c32 Update documentation 2021-08-23 08:18:47 +02:00
Alex Voinea 2144a3f440 Swap led direction 2021-08-23 08:18:47 +02:00
Alex Voinea 8766642a21 Turn off all LEDs after Init 2021-08-23 08:18:47 +02:00
Yuri D'Elia a6780d2224 Correct motor pins 2021-08-23 08:16:15 +02:00
D.R.racer 492208d25a Improve documentation of the startup process 2021-08-12 11:08:09 +02:00
D.R.racer f0b8cc9895 Fix encoding of Query responses for high numbers of errors
+ improve unit tests directly for the enumerated errors in logic/error_codes.h
2021-08-12 10:55:27 +02:00
D.R.racer a982381728 Only start a new command if the previous one finished
... that means with or without an error
and remember the Command's request message - to identify the responses
2021-08-12 10:30:40 +02:00
D.R.racer ccefe32ba1 Reset the error code for reusal of logic state machines 2021-08-12 10:30:40 +02:00
D.R.racer 9ba116e06e Handle slot indices out of range correctly at top level
Besides Unload Filament, which only operates on active slot, all other
top level state machines check the validity of the command's parameter.
If the parameter is out of range for available slots, they return
ErrorCode::INVALID_TOOL now.
2021-08-12 10:30:40 +02:00
D.R.racer c14c79f3ac Do not blink the left LED on start 2021-08-11 10:33:32 +02:00
D.R.racer 2c94e76ca9 Allow configurable LED's blinking period 2021-08-04 11:40:02 +02:00
D.R.racer 2f5dff6c5b Introduce short namespace aliases
especially for modules
2021-08-04 11:03:56 +02:00
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 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
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
D.R.racer 0744009955 Fix FW build - define (empty) TMC2130::Init 2021-07-14 09:00:40 +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 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 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
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
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 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ý 09819cb1aa Split the main CMakeLists.txt into more files within subdirectories 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
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 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 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 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
Yuri D'Elia 531f60ed27 Add modules::speed_table for acceleration lookup tables 2021-07-07 16:59:04 +02:00
Yuri D'Elia 1d6736cff6 Add modules::math for specialized math functions
Currently include reduced-precision 8x16 and 16x16 multiplication
functions used by the speed lookup tables.
2021-07-07 16:59:04 +02:00
Alan Dragomirecký 9448c04b36 Disable preprocessor code indentation 2021-07-07 16:33:03 +02:00
Yuri D'Elia f95c47638d CircularIndex: fight against type promotion in size checks
To generate optimal code, size itself needs to be of the same type as
the index to avoid promotion to the largest type.

In full(), wrap the subtraction explicity in another type cast to avoid
another automatic type promotion.
2021-07-06 12:51:56 +02:00
Yuri D'Elia f57a1c3b17 CircularIndex: add static checks for index/size limits
The empty/full distinction fails to work if size matches the number of
representable positions for the index type.

Add a static check to ensure this invariant is met where possible.
2021-07-06 12:51:56 +02:00
Yuri D'Elia 4362d77083 CircularIndex: alternate index management for full capacity
Comparing head/tail indexes cannot distinguish between empty/full cases,
so we end up wasting one item in the circular buffer. This also limits
the smallest and efficient size choice to be 4.

If the circular buffer is large, there's no issue, however for the
motion planner the block size is significant, and I was planning to use
exactly a ring buffer of two: one busy block, plus one planned.

Modify the indexer to store the internal "index" (aka cursor) pointer to
be one extra bit deeper than the final index. Comparing the underlying
cursor allow to distinguish the empty/full case due to the extra bit,
while producing the final index requires simple masking.

This is just as efficient if the size is a power of two with
2-complement wrap-around logic, which is the optimized case. However
the implementation also works for non-power-of-two sizes.

Add tests for more failure cases in the CircularBuffer which is built on
top.

(tecnique described in the Art of Computer Programming by Knuth)
2021-07-06 12:51:56 +02:00
Yuri D'Elia 477539c791 Split CircularBuffer into CircularIndex+CircularBuffer
Allow the lower-level index to be used without an actual container by
splitting off the index management into CircularIndex.

Rebuild CircularBuffer using CircularIndex itself.
2021-07-06 12:51:56 +02:00
D.R.racer 43a423f299 Change buttons' ADC limits into an array
as proposed by @vintagePC

cleaned-up some of the unit tests by this change
2021-07-05 18:07:54 +02:00
D.R.racer 552fec9abf Parametrize Idler and Selector in common config.h 2021-07-05 18:07:54 +02:00
D.R.racer ccda84df80 Make buttons' ADC decision levels "inclusive"
especially because of the zero level, which is very likely to be a valid button0 level
2021-07-05 18:07:54 +02:00
D.R.racer b484eeacb6 Start using config.h
Added some constexpr vars for buttons, finda, fsensor and
applied them in the FW and unit tests accordingly.
2021-07-05 18:07:54 +02:00
Yuri D'Elia dd5c036d38 GPIO: reformat affected files 2021-07-05 15:20:11 +02:00
Yuri D'Elia 3ccfc3adfb GPIO: correctly stub known ports
- Use the correct port name in the #define
- Fully qualify all references
2021-07-05 15:20:11 +02:00
Yuri D'Elia 32b2ec7f8d Remove GPIOI 2021-07-05 15:20:11 +02:00
Yuri D'Elia 067deb7e55 Completely remove PIN macros 2021-07-05 15:20:11 +02:00
Yuri D'Elia 7c7aa95445 Mock GPIO when building tests
Add some conditional statements in gpio.h so that we can mock the GPIO
registers when building tests.
2021-07-05 15:20:11 +02:00
Yuri D'Elia 169665331e Change the pin definitions in order to be valid types
Remove the constructor from GPIO_pin so that we can use brace
initialization at compile time.

Rewrite the contents of pins.h to construct GPIO_pin types directly by
the use of a simple preprocessor macro.

Makes the code type-check and easier to read/extend.
2021-07-05 15:20:11 +02:00
Yuri D'Elia e9627ad0d4 TMC2130: Reformat 2021-07-05 13:34:08 +02:00
Yuri D'Elia f491072614 TMC2130: Make stepping methods static
To keep these methods efficient no member should be accessed away.
That's the reason MotorParams is passed explicitly for each.

Mark all stepping methods as static.
2021-07-05 13:34:08 +02:00
Yuri D'Elia 28c9e55a79 Add vSense to MotorCurrents 2021-07-05 13:34:08 +02:00
Yuri D'Elia c78ed77ccc Revise the TMC2130 interface for stepping
Change the TMC2130 class after starting to review the Motion API.
Move motor mode handling and stepping to this module.

Create a new MotorParams class for compile-time settings (currently
pins, direction, microstepping).

Keep other settings separate, so that we can pass constexpr expressions
while stepping and still get 1 instruction without overhead.
2021-07-05 13:34:08 +02:00
Yuri D'Elia ea8b335f8d progmem: fix for AVR
- Fix header name
- Rename pgm_read_word to read_word since pgm_read_word is a macro
  and cannot be scoped
2021-07-05 13:33:49 +02:00
Yuri D'Elia a9937b94e2 Add initial AVR PROGMEM abstraction in hal::progmem 2021-07-05 13:33:49 +02:00
D.R.racer 9efb127acb Explain and fix the LED states while cutting filament
now the test is correct including LEDs
2021-07-01 08:12:47 +02:00
D.R.racer 974c1ba6db Verify Cut filament state machine + update unit tests 2021-07-01 07:03:39 +02:00
vintagepc e2ec745286
Simple config header with example (#39)
Simple config header with example
2021-07-01 06:47:40 +02:00
Yuri D'Elia ab01413116 Call LED::Step() correctly 2021-06-30 12:39:03 +02:00
D.R.racer 9122a33693 Rebase onto upstream/main, adapt to cleaned-up circular buffer interface 2021-06-30 07:39:31 +02:00
D.R.racer ffae941a28 Fix unit tests of load/unload filament 2021-06-30 07:39:31 +02:00
D.R.racer 9a8038ccb6 Add user_input module and use it instead of raw buttons
Encapsulates buttons and commands coming from the communication
2021-06-30 07:39:31 +02:00
D.R.racer af8c866f1a Update doxygen main page 2021-06-30 07:39:31 +02:00
D.R.racer 2c89b14de1 Add doxygen main page dox file 2021-06-30 07:39:31 +02:00
D.R.racer 4df4bf59b4 Update doxyfile + document modules namespace 2021-06-30 07:39:31 +02:00
D.R.racer 3f98ec03ca Fix doxygen documentation for the logic layer 2021-06-30 07:39:31 +02:00
D.R.racer c15b1d59c4 Introduce Doxyfile + fix modules documentation 2021-06-30 07:39:31 +02:00
D.R.racer f6e5d4ae76 Improve and verify Load filament alg and unit tests 2021-06-30 07:39:31 +02:00
D.R.racer 46a40f7488 Extend Unload filament unit tests
+ now error states are covered as well
+ greatly cleaned-up code
2021-06-30 07:39:31 +02:00
D.R.racer ce20f0b001 Greatly improve unload filament unit test
+ relevant changes for other unit tests -> prepare for improving
of the other unit tests as well
2021-06-30 07:39:31 +02:00
D.R.racer 5a4903a2ff Cleanup circular_buffer implementation
unit tests will follow
2021-06-29 12:17:10 +02:00
Yuri D'Elia 3ba072aea7 Define the global Timebase instance 2021-06-29 08:59:16 +02:00
Yuri D'Elia f097aecbaa Qualify leds::Mode in LED to fix build 2021-06-29 08:58:37 +02:00
D.R.racer 4d6d6fe0af Add more checks (esp. positions of idler and selector)
that resulted in finding several weak spots and now Cut and Eject filament
do not pass the test (which is correct, they really have logical issues)
2021-06-21 10:28:56 +02:00
D.R.racer 317a486d1e Logic layer Eject filament unit tests
initial setup, it compiles, but is blocked by Unload filament
2021-06-21 10:26:04 +02:00
D.R.racer 1f8934c2c1 Fix+verify Cut filament unit test
it now finished ok, but future tweaks and improvements are expected
2021-06-21 10:22:17 +02:00
D.R.racer ede475c5a6 Introduce Timebase module, refactor timing code + unit tests 2021-06-21 10:22:17 +02:00
D.R.racer 398181e26c Feed to FINDA unit tests : green 2021-06-21 10:22:17 +02:00
D.R.racer 85910497f7 Unify buttons' API with other modules
- accepts millis() instead of doing the timing internally (which has
been a temporary solution just for the tests until now)
2021-06-21 10:22:17 +02:00
D.R.racer 3cb3cebed9 Add forced reinit of all automata for the unit tests
+ added a few constexpr to constructors on the way
2021-06-21 10:22:17 +02:00
D.R.racer b8f6bc9a4e Tune Feed to FINDA state machine and its unit test
so that it works as expected

Still, there is a task of resetting all of the state machines just for
the next unit test to be run.
2021-06-21 10:22:17 +02:00
D.R.racer f0a042c1b6 Add unit tests for Feed to FINDA state machine
+ improve infrastructure
2021-06-21 10:22:17 +02:00
D.R.racer 925201d77a Basic unit test structure for the logic layer
It compiles the Cut Filament unit test with all the necessary components.
Still, the unit test does nothing.
2021-06-21 10:22:17 +02:00
Alex Voinea e5215c7b84 SHR16 tmc control 2021-06-21 06:14:01 +02:00
Alex Voinea 19bc26219b Fix usart not working 2021-06-18 06:43:55 +02:00
Alex Voinea 113f9d7664 Fix build 2021-06-18 06:42:28 +02:00
Alex Voinea 6bd4db2681 Functional SHR16 2021-06-18 06:42:28 +02:00
Alex Voinea 7845f9aad4 SHR16 gpio 2021-06-18 06:42:28 +02:00
D.R.racer 58fe013471 Fix compilation 2021-06-16 06:43:20 +02:00
D.R.racer d6c9e58e66 Add global state hive
+ solve many TODO's in the code (active slot/extruder and filament loaded flag)
2021-06-16 06:43:20 +02:00
D.R.racer 9e4bd97968 Add empty EEPROM HAL implementation 2021-06-14 07:34:59 +02:00
D.R.racer dfb57bcae5 Add Load filament state machine
+ printer's fsensor (external) module
+ state machine for loading to bondtech
2021-06-14 07:34:59 +02:00
D.R.racer 7cab9dc915 Add Tool change operation 2021-06-14 07:34:59 +02:00
D.R.racer ea65b75120 Add Eject filament operation
+ refactor other state machines a bit - Reset() now has the parameter which comes in the RequestMsg
2021-06-14 07:34:59 +02:00
D.R.racer 7bfc1bad97 Cut filament prototype state machine 2021-06-14 07:34:59 +02:00
D.R.racer 4a79b4b865 UnloadFilament - refactor for the new Idler API 2021-06-14 07:34:59 +02:00
D.R.racer 96be4b18a2 main - add Idler and Selector modules into main loop stepping 2021-06-14 07:34:59 +02:00
D.R.racer d0095a01aa Buttons - add AnyButtonPressed() 2021-06-14 07:34:59 +02:00
D.R.racer ade5f11fe2 Motion - remove dummy Idler functions 2021-06-14 07:34:59 +02:00
D.R.racer 9caf680633 Add Feed to FINDA state machine 2021-06-14 07:34:59 +02:00
D.R.racer 7555bbb906 Add Selector module 2021-06-14 07:34:59 +02:00
D.R.racer b4e8c3fa5d Add Idler module 2021-06-14 07:34:59 +02:00
D.R.racer 05ff998c01 Lay out the other high-level commands/operations
- cut, eject, load filament, toolchange
- uncomment them in main.cpp
- their implementation is still empty
2021-06-14 07:34:59 +02:00
D.R.racer 5b4eb0cee3 Extract Unload filament into a separate file
+ cleanup the object structure
+ add no_command as the starting "operation" to simplify the rest of the command handling at runtime
2021-06-14 07:34:59 +02:00
D.R.racer 271a2dd7df Minor tweaks after rebase onto main 2021-06-14 07:34:59 +02:00
D.R.racer 6f1624b718 Make logic prototype compilable 2021-06-14 07:34:59 +02:00
D.R.racer 2159558d88 Prototype of Unload Filament command/operation
+ related stuff:
- command decoding+processing+reporting in main.cpp
- slight refactoring of modules
2021-06-14 07:34:59 +02:00
D.R.racer ca6de101c3 Logic - first try 2021-06-14 07:34:59 +02:00
D.R.racer 019f74d6f2 Add debouncing for FINDA 2021-06-08 07:00:07 +02:00
D.R.racer 939b47d260 FINDA interface module 2021-06-08 07:00:07 +02:00
D.R.racer 3ef113cf6c Add basic motion API 2021-06-08 06:59:49 +02:00
D.R.racer 8e994c3b17 Take over permanent storage implementation from MM-control-01 2021-06-08 06:59:14 +02:00
D.R.racer 9f2b5e5ecb Add vscode configuration to allow easier switching among firmware and unit tests 2021-05-31 12:28:47 +02:00
D.R.racer bd335ec30d Unit test for LEDs interface + fixes 2021-05-26 11:39:24 +02:00
D.R.racer 004db59da0 Add shift register interface and improve LED integration with it 2021-05-26 09:29:32 +02:00
D.R.racer 9226230fd5 Reformat sources to fit the new namespace formatting rules 2021-05-25 12:24:19 +02:00
D.R.racer acc33bfacb Do not indent namespaces 2021-05-25 12:23:29 +02:00
D.R.racer 6cb072ce79 Rebase onto main + clean up the code a bit 2021-05-25 11:55:28 +02:00
D.R.racer fce2195558 Interface module for driving LEDs
+ start shaping up main.cpp
+ make the usage of namespaces and class names more consistent throughout the whole project
+ refactor related unit tests accordingly
2021-05-25 11:00:30 +02:00
D.R.racer 7611b98830 Add more unit tests and optimize (saved 1 byte per button on the AVR) 2021-05-25 10:02:02 +02:00
D.R.racer 7ece1fb28d Add missing buttons.h 2021-05-25 10:02:02 +02:00
D.R.racer ba8eacfe33 Buttons module implementation
A module representing a model of the 3 buttons
Includes a unit test project (empty at this stage)
2021-05-25 10:02:02 +02:00
Alex Voinea 47528c3bca USART hal prototype 2021-05-24 12:32:10 +02:00
D.R.racer fe0ac4f9f9 More unit tests for decoding of response messages
+ related changes in code
2021-05-18 08:18:11 +02:00
D.R.racer 30fbf6d870 Unit tests for decoding requests and responses
+errors on requests
2021-05-18 08:18:11 +02:00
D.R.racer 0633dea881 Protocol implementation
+ unit tests for encoding of messages

API still subject to minor changes
2021-05-18 08:18:11 +02:00
Alex Voinea c378e71018 SPI example 2021-05-17 19:11:35 +03:00
Alex Voinea 13ee425352 Configurable SPI CPHA and CPOL 2021-05-17 17:45:31 +03:00
Alex Voinea 57abb7ecc4 Example TMC2130 pinout 2021-05-17 17:10:02 +03:00
Alex Voinea 041d75012d Add all possible ports to the AVR GPIO hal 2021-05-17 17:09:00 +03:00
Alex Voinea 2cf1b8b523 __attribute__((always_inline)) comment 2021-05-17 12:08:20 +03:00
Alex Voinea d2d275da25 Explain why we set SS as output 2021-05-17 09:11:24 +03:00
Alex Voinea db98d0cf7b Add SPI TxRx function 2021-05-17 09:11:11 +03:00
Alex Voinea dc9528b4ea SPI hal: Winning combo 2021-05-17 09:01:22 +03:00
Alex Voinea ac4fdd30ad spi hal checkpoint 2021-05-17 08:42:21 +03:00
Alex Voinea 47400f16c6
GPIO hal prototype (#9)
* gpio hal prototype
* Example gpio hal usage
* Use uint8_t for GPIO enums
2021-05-14 15:42:41 +02:00
D.R.racer 57bc5a802b Add cpu.h/cpp, avr subdir
The idea is to have a separate implementation of the HAL interface for each CPU. So far we only have the AVR.
2021-04-19 07:03:47 +02:00
D.R.racer ec44ef5f23 Prepare main.cpp 2021-04-19 07:03:47 +02:00
D.R.racer f848c8d550 Create basic FW structure
- Design API's based on our discussion and block diagrams
- Set doxygen rules/preferred syntax
2021-04-19 07:03:47 +02:00
D.R.racer 257d0ec340 Prepare parts of the build system
extracted and slightly modified from Buddy-FW, still doesn't work
2021-04-19 07:03:47 +02:00