Skip to content

Commit 04567c1

Browse files
committed
Made configuration setting for E-axis that chooses between absolute and relative behaviour.
Changed default to absolute mode as pronterface's demo file expects so.
1 parent fcc0175 commit 04567c1

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

bebopr.h

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ extern int bebopr_pre_init( void);
1414

1515
// Configuration
1616

17+
extern int config_e_axis_is_always_relative( void);
18+
1719
// determines stepper driver control
1820
extern int config_use_pololu_drivers( void);
1921

bebopr_r2.c

+7
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,10 @@ double config_get_home_max_feed( axis_e axis)
317317
}
318318
}
319319

320+
/*
321+
* Specify is the E axis is being fed relative coordinates only
322+
*/
323+
int config_e_axis_is_always_relative( void)
324+
{
325+
return 0;
326+
}

gcode_parse.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,13 @@ void gcode_parse_char(uint8_t c) {
364364

365365
if (next_target.option_relative) {
366366
next_target.target.X = next_target.target.Y = next_target.target.Z = 0;
367-
#ifdef E_ABSOLUTE
367+
if (!config_e_axis_is_always_relative()) {
368368
next_target.target.E = 0;
369-
#endif
369+
}
370370
}
371-
#ifndef E_ABSOLUTE
372-
// E always relative
371+
if (config_e_axis_is_always_relative()) {
373372
next_target.target.E = 0;
374-
#endif
373+
}
375374
newline = 1;
376375
} else {
377376
newline = 0;

gcode_process.c

+9-15
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ static void enqueue_pos( TARGET* target)
7676
/* make the move */
7777
traject_delta_on_all_axes( &traj);
7878
/* update our sense of position */
79-
#ifndef E_ABSOLUTE
80-
/*
81-
* For a 3D printer, an E-axis coordinate is often a relative setting,
82-
* independant of the absolute or relative mode. (This way it doesn't
83-
* overflow because it is mostly moving in one direction.)
84-
* This requires special handling here.
85-
*/
86-
target->E = gcode_home_pos.E;
87-
#endif
79+
if (config_e_axis_is_always_relative()) {
80+
/*
81+
* For a 3D printer, an E-axis coordinate is often a relative setting,
82+
* independant of the absolute or relative mode. (This way it doesn't
83+
* overflow because it is mostly moving in one direction.)
84+
* This requires special handling here.
85+
*/
86+
target->E = gcode_home_pos.E;
87+
}
8888
memcpy( &gcode_current_pos, target, sizeof( TARGET));
8989
}
9090
}
@@ -110,12 +110,6 @@ void process_gcode_command() {
110110
next_target.target.Z += gcode_current_pos.Z;
111111
next_target.target.E += gcode_current_pos.E;
112112
}
113-
// E ALWAYS relative, otherwise we overflow our registers after only a few layers
114-
// next_target.target.E += startpoint.E;
115-
// easier way to do this
116-
// startpoint.E = 0;
117-
// moved to dda.c, end of dda_create() and dda_queue.c, next_move()
118-
119113
// implement axis limits
120114
if (config_axis_has_min_limit_switch( x_axis)) {
121115
double x_min = config_axis_get_min_pos( x_axis);

traject.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,9 @@ void traject_delta_on_all_axes( traject5D* traject)
356356
if (ramp_de != 0.0) {
357357
pruss_queue_adjust_for_ramp( 4, (int32_t)(1.0E9 * ramp_de));
358358
}
359-
pruss_queue_adjust_origin( 4);
359+
if (config_e_axis_is_always_relative()) {
360+
pruss_queue_adjust_origin( 4);
361+
}
360362
}
361363

362364
static void pruss_axis_config( int axis, double step_size, int reverse)

0 commit comments

Comments
 (0)