Commit Graph

1502 Commits

Author SHA1 Message Date
Kevin O'Connor af99ab1645 extruder: Create a new class and python file to track the printer extruder
Create a new python file (extruder.py) to control the extruder heater
and stepper motors.  This separates the extruder control logic from
the cartesian robot code - making it easier to customize both the
kinematic control of the robot as well as the extruder.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:49:02 -04:00
Kevin O'Connor 4a527a46ce stepper: Store max_velocity/max_accel instead of max_step_velocity/accel
All users of max_step_velocity and max_step_accel end up multiplying
by step_dist anyway, so it's easier to store max_velocity and
max_accel.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:49:02 -04:00
Kevin O'Connor 5829aa8bd7 toolhead: Avoid using a dummy_move for an empty move_queue
Explicitly check for when the move_queue is empty and only call
move.calc_junction() when there is a previous move.  This avoids the
need to create a dummy "sentinal" move object and it simplifies the
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:49:01 -04:00
Kevin O'Connor 9bb1ae079f toolhead: Merge lookahead.py into toolhead.py
Remove the lookahead.py file and move its code directly into
toolhead.py.  The MoveQueue() class is small and tightly coupled to
the toolhead code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:49:01 -04:00
Kevin O'Connor e0a9a1b800 toolhead: Split toolhead code from cartesian.py to new file toolhead.py
Separate out the toolhead logic to its own python file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:48:59 -04:00
Kevin O'Connor 861f5a5387 cartesian: Separate out cartesian robot handling from ToolHead class
Separate out the low-level stepper motor kinematics handling from the
ToolHead class into its own class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:47:54 -04:00
Kevin O'Connor 20ae4e5d98 cartesian: Rename CartKinematics class to ToolHead
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:47:13 -04:00
Kevin O'Connor b3e8b430e5 cartesian: Do acceleration and lookahead on requested coordinates
Perform all acceleration calculations and lookahead checks in
millimeters using the cartesian coordinate system of the request.  The
conversion to step coordinates is now done at the time of the step
timing creation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 22:47:08 -04:00
Kevin O'Connor ae8d57e650 stepcompress: Fix compress_bisect_add() infinite loop
At high step speeds, it is possible to exit the inner scan due to
integer truncation.  Always update minadd or maxadd so that the outer
loop always terminates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 21:46:57 -04:00
Kevin O'Connor b0b2e9c4aa build: Avoid objcopy --dump-section flag
Commit da305e6b changed the objcopy command to use the --dump-section
flag.  However, the 2.24 version of avr-objcopy (which is common on
raspbian installs) does not support this flag.  Avoid using
--dump-section and continue to use the -j option instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 21:46:57 -04:00
Kevin O'Connor 409904c61c pins: Add Arduino Due pin name aliases
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 15:41:18 -04:00
Kevin O'Connor afb1839b6b docs: Update documentation with Arduino Due installation info
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 15:17:03 -04:00
Kevin O'Connor cc62a3dbf3 sam3x8e: Add initial support for Arduino Due boards
This adds basic support for running on the Atmel SAM3x8e
micro-controllers that are found in the Arudino Due boards.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:27:30 -04:00
Kevin O'Connor 31c04261c1 lib: Add Atmel SAM3x8e ARM CMSIS files
Add the ARM CMSIS definitions (obtained from an Arduino copy of
libsam) in preparation for Arduino Due support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:25:42 -04:00
Kevin O'Connor 6220cdda92 stepper: Support rescheduling of step events on faster MCUs
On faster MCUs the step and unstep events may be too close for the
stepper motor driver.  Add a CONFIG_NO_UNSTEP_DELAY build option and
support the case where it is not set.  This allows faster MCUs to
schedule two events for each step (one for the step and one for the
unstep).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:24:14 -04:00
Kevin O'Connor da305e6b61 build: Update declfuncs.lds.S to only use progmem sections on AVR
On non-avr platforms the declfunc stuff still needs to be in the
binary in a rodata section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor 343de9c454 serialhdl: Avoid using 1200 baud during serial reset
The Arduino Due uses a 1200 baud connection to signal an erase
sequence, so avoid it during normal serial resets.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor e59951c8ae avr/serial: Separate out low-level hardware manipulation to its own function
Introduce enable_tx_irq() for manipulating the AVR hardware.  This
keeps the low-level hardware code together.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor ea5f825a91 build: Default to O2 optimization
Default to O2 and set Os in the AVR makefile.  Platforms besides AVR
are likely to produce better code with O2 so make that the default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor b3e4ff7ef0 sched: Use 'unsigned int' instead of 'uint16_t' for shutdown reason
Use 'unsigned int' instead of 'uint16_t' as is faster on some
platforms.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor b0524947e5 sched: Use uint_fast8_t for return type of timers
Some architectures are faster passing regular integers than 8bit
integers.  Use uint_fast8_t so that the architecture chooses the
appropriate type.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:53 -04:00
Kevin O'Connor fa85094cbb irq: Allow boards to define the return type of irq_save()
The AVR wants a uint8_t return type for irq_save(), but other
architectures will generally prefer int.  Allow the board to configure
the size of the flag by introducing an irqstatus_t typedef.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 9dd101c26f irq: Prefer irq_disable/enable instead of irq_save/restore in cmds/tasks
Task and command handlers always run with irqs enabled, so it is not
necessary to save/restore the irq state when disabling irqs in these
handlers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 4fcf5a31f5 pwmcmds: Add Kconfig option to allow boards to disable hardware PWM commands
Some boards may not support hardware based PWM.  Update the build so
that those commands do not need to be compiled if they are not
available.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor c20f993747 spicmds: Add Kconfig option to allow boards to disable SPI commands
Some boards may not support SPI transfers.  Update the build so that
those commands do not need to be compiled if they are not available.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 71947d6bea gpiocmds: Add Kconfig option to allow boards to disable ADC commands
Some boards may not support the ADC hardware.  Update the build so
that those commands do not need to be compiled if they are not
available.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 220a1e4197 compiler.h: Check if __aligned and __section macros are already defined
Don't define these macros if they are already - doing so causes
compiler warnings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 4dd3478fc1 Makefile: Move listing of directories to create to board makefiles
Rename DIRS to dirs-y and populate it in the per-board Makefile rules.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 8e1c0941b0 generic: Add new file generic/io.h and move read/writeb() to it
Move the definitions of the readb() style functions to a new header
generic/io.h.  This eliminates the dependency of stdint.h on
compiler.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 62f96f0911 generic: Move simulator/gpio.h to generic/gpio.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 73f3b0636a generic: Move simulator/irq.h to new file generic/irq.h
Move the generic irq definitions into generic/irq.h and move the
simulator irq code into main.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:58 -04:00
Kevin O'Connor 9f8817a47e generic: Move board timer.h files into generic/misc.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:58 -04:00
Kevin O'Connor 9971f999b3 generic: Create generic board infrastructure and move misc.h to it
Instead of creating a misc.h file in each board directory, create a
generic board directory and declare misc.h there.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:58 -04:00
Kevin O'Connor ff789058df console: Update the debugging console to support setting local varables
Add a "SET varname value" local command to the console.py script.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:58 -04:00
Kevin O'Connor bd07cd1193 sched: Optimize timer list handling
Rework the timer list rescheduling to be more optimized.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 15:34:56 -04:00
Kevin O'Connor a6de2184ba stepper: Optimize for case where add is zero
At high rates, the "add" field is frequently zero.  It's possible to
optimize for that case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 15:34:56 -04:00
Kevin O'Connor bb3b881e21 docs: Change the debugging docs to recommend a serial baud rate of 250000
A baud of 250000 is a better choice for production use.  It's better
to test with that rate also.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 15:34:23 -04:00
Kevin O'Connor e4859d2e9a gpio: Fix off-by-one bug in check for the maximum gpio port
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 15:34:23 -04:00
Kevin O'Connor 91e7807af6 avr: Add config option to clear the CPU prescaler
Some AVR chips ship with a 1/8th clock divisor set.  Add a compile
time option to manually clear this field at startup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:46 -04:00
Kevin O'Connor 38f1d78e1b serialqueue: Add debugging helper functions for dumping a binary buffer
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:46 -04:00
Kevin O'Connor b52b65624b avr: Separate out gpio pwm pin definitions from pwm register definitions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:46 -04:00
Kevin O'Connor 2a17d9457a avr: Eliminate gpio_adc_info struct in gpio adc pin definitions
The gpio_adc_info only contains a single uint8_t field - it's simpler
to use an array of uint8_t instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:46 -04:00
Kevin O'Connor 7531d0c678 avr: Define timer1 timers and prevent their use as PWM at runtime
Instead of commenting out the timer1 pwm definitions, detect them at
runtime.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:45 -04:00
Kevin O'Connor 3eafc83458 avr: Initial support for Atmel AT90USB1286 mcu
Add GPIO definitions for the AT90USB1286.  Add code for communicating
over USB port on AT90USB1286.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:45 -04:00
Kevin O'Connor 4326a3adce buildcommands: Fix max_size calculation
The maximum max_size value should not include MESSAGE_MIN - that is
already added by the runtime code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:45 -04:00
Kevin O'Connor ed103822f5 sched: Change sched_from_ms() to sched_from_us()
Some code may require micro-second precision so update sched_from_ms()
to use micro-seconds.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-02 17:52:11 -04:00
Kevin O'Connor d68cb264c4 stepper: Use stepper_stop() instead of stepper_reset() in stepper_shutdown()
The stepper_stop() function is equivalent to stepper_reset() during a
shutdown event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-02 17:52:05 -04:00
Kevin O'Connor 45ba03efa3 timer: Move union u32_u16_u from compiler.h to avr/timer.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-01 09:54:13 -04:00
Kevin O'Connor f582a36e4d Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-05-25 11:37:40 -04:00
Kevin O'Connor 37a91e9c10 build: Update kconfig to always emit symbols - even when false.
Always emit CONFIG_X definitions in autoconf.h - set them to 0 when
they are disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-08-23 22:13:19 -04:00