Commit Graph

834 Commits (034d007b33dd2a7a055d4341b117f3d77358b0e7)

Author SHA1 Message Date
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 d81b00a0f8 Test all filament slots 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
D.R.racer 75fe7b20b5 Verify and fix Tool Change state machine + unit tests 2021-07-01 07:03:02 +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 807eda7db3 Add prototypes of remaining logic layer's unit tests
- load filament
- feed to bondtech
- tool change
2021-06-30 07:39:31 +02:00
vintagepc 151b8c2586
Delete nonfunctional workflow 2021-06-29 09:51:36 -04:00
D.R.racer f81ecf1294 Circular buffer - basic unit test 2021-06-29 12:17:10 +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 3cd94996e9 Remove invalid/useless test sizeof(ptr) == 4
This test is currently valid only for 32bit architectures.

There doesn't seem to be a true reason for this test to
ensure a pointer is exactly 4 bytes, so remove the test.
2021-06-29 08:59:36 +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 d9b368bb92 Verify+fix second Feed to FINDA's unit test 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 b338949acb Shorten ADC reinit usage 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