preliminary DC motor extruder support

This commit is contained in:
Michael Moon 2010-11-09 10:59:13 +11:00
parent 98882e1c69
commit 37f6dbff23
3 changed files with 28 additions and 12 deletions

View File

@ -100,7 +100,7 @@
#ifdef ACCELERATION_REPRAP
#ifdef ACCELERATION_RAMPING
#error Can't use ACCELERATION_REPRAP and ACCELERATION_RAMPING together.
#error "Can't use ACCELERATION_REPRAP and ACCELERATION_RAMPING together."
#endif
#endif
@ -310,6 +310,13 @@ struct {
*/
#define MOVEBUFFER_SIZE 8
/*
DC extruder
If you have a DC motor extruder, configure it as a "heater" above and define this value as the index.
*/
// #define DC_EXTRUDER 1
// #define DC_EXTRUDER_PWM 180
/*
FiveD on Arduino implements a watchdog, which has to be reset every 250ms or it will reboot the controller. As rebooting (and letting the GCode sending application trying to continue the build with a then different Home point) is probably even worse than just hanging, and there is no better restore code in place, this is disabled for now.
*/

22
dda.c
View File

@ -13,6 +13,10 @@
#include "pinio.h"
#include "config.h"
#ifdef DC_EXTRUDER
#include "heater.h"
#endif
/*
X Stepper
*/
@ -68,8 +72,11 @@
(so we don't have to delay in interrupt context)
*/
#define unstep() do { _x_step(0); _y_step(0); _z_step(0); _e_step(0); } while (0)
#ifndef DC_EXTRUDER
#define unstep() do { _x_step(0); _y_step(0); _z_step(0); _e_step(0); } while (0)
#else
#define unstep() do { _x_step(0); _y_step(0); _z_step(0); } while (0)
#endif
/*
Used in distance calculation during DDA setup
*/
@ -401,12 +408,18 @@ void dda_start(DDA *dda) {
y_enable();
if (dda->z_delta)
z_enable();
// set direction outputs
x_direction(dda->x_direction);
y_direction(dda->y_direction);
z_direction(dda->z_direction);
e_direction(dda->e_direction);
#ifdef DC_EXTRUDER
if (dda->e_delta)
heater_set(DC_EXTRUDER, DC_EXTRUDER_PWM);
#endif
}
// ensure this dda starts
@ -629,6 +642,9 @@ void dda_step(DDA *dda) {
// linear acceleration code doesn't alter F during a move, so we must update it here
// in theory, we *could* update F every step, but that would require a divide in interrupt context which should be avoided if at all possible
current_position.F = dda->endpoint.F;
#ifdef DC_EXTRUDER
heater_set(DC_EXTRUDER, 0);
#endif
}
setTimer(dda->c >> 8);

View File

@ -46,14 +46,7 @@ typedef struct {
int16_t EE_i_limit;
} EE_factor;
EE_factor EEMEM EE_factors[NUM_HEATERS] = {
{
DEFAULT_P,
DEFAULT_I,
DEFAULT_D,
DEFAULT_I_LIMIT
}
};
EE_factor EEMEM EE_factors[NUM_HEATERS];
void heater_init() {
#if NUM_HEATERS > 0