acceleration-Grbl now works with atmega 168 by disabling arc motion
This commit is contained in:
parent
5eddbabcd3
commit
67d7607e60
4
gcode.c
4
gcode.c
@ -169,8 +169,10 @@ uint8_t gc_execute_line(char *line) {
|
|||||||
switch(int_value) {
|
switch(int_value) {
|
||||||
case 0: gc.motion_mode = MOTION_MODE_SEEK; break;
|
case 0: gc.motion_mode = MOTION_MODE_SEEK; break;
|
||||||
case 1: gc.motion_mode = MOTION_MODE_LINEAR; break;
|
case 1: gc.motion_mode = MOTION_MODE_LINEAR; break;
|
||||||
|
#ifdef __AVR_ATmega328P__
|
||||||
case 2: gc.motion_mode = MOTION_MODE_CW_ARC; break;
|
case 2: gc.motion_mode = MOTION_MODE_CW_ARC; break;
|
||||||
case 3: gc.motion_mode = MOTION_MODE_CCW_ARC; break;
|
case 3: gc.motion_mode = MOTION_MODE_CCW_ARC; break;
|
||||||
|
#endif
|
||||||
case 4: next_action = NEXT_ACTION_DWELL; break;
|
case 4: next_action = NEXT_ACTION_DWELL; break;
|
||||||
case 17: select_plane(X_AXIS, Y_AXIS, Z_AXIS); break;
|
case 17: select_plane(X_AXIS, Y_AXIS, Z_AXIS); break;
|
||||||
case 18: select_plane(X_AXIS, Z_AXIS, Y_AXIS); break;
|
case 18: select_plane(X_AXIS, Z_AXIS, Y_AXIS); break;
|
||||||
@ -264,6 +266,7 @@ uint8_t gc_execute_line(char *line) {
|
|||||||
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
|
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
|
||||||
(gc.inverse_feed_rate_mode) ? inverse_feed_rate : gc.feed_rate, gc.inverse_feed_rate_mode);
|
(gc.inverse_feed_rate_mode) ? inverse_feed_rate : gc.feed_rate, gc.inverse_feed_rate_mode);
|
||||||
break;
|
break;
|
||||||
|
#ifdef __AVR_ATmega328P__
|
||||||
case MOTION_MODE_CW_ARC: case MOTION_MODE_CCW_ARC:
|
case MOTION_MODE_CW_ARC: case MOTION_MODE_CCW_ARC:
|
||||||
if (radius_mode) {
|
if (radius_mode) {
|
||||||
/*
|
/*
|
||||||
@ -394,6 +397,7 @@ uint8_t gc_execute_line(char *line) {
|
|||||||
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
|
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
|
||||||
(gc.inverse_feed_rate_mode) ? inverse_feed_rate : gc.feed_rate, gc.inverse_feed_rate_mode);
|
(gc.inverse_feed_rate_mode) ? inverse_feed_rate : gc.feed_rate, gc.inverse_feed_rate_mode);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
main.c
6
main.c
@ -31,9 +31,9 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "wiring_serial.h"
|
#include "wiring_serial.h"
|
||||||
|
|
||||||
#ifndef __AVR_ATmega328P__
|
// #ifndef __AVR_ATmega328P__
|
||||||
# error "As of version 0.6 Grbl only supports atmega328p. If you want to run Grbl on an 168 check out 0.51 ('git co v0_51')"
|
// # error "As of version 0.6 Grbl only supports atmega328p. If you want to run Grbl on an 168 check out 0.51 ('git co v0_51')"
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,7 @@ void mc_dwell(uint32_t milliseconds)
|
|||||||
// axis in axis_l which will be the axis for linear travel if you are tracing a helical motion.
|
// axis in axis_l which will be the axis for linear travel if you are tracing a helical motion.
|
||||||
// position is a pointer to a vector representing the current position in millimeters.
|
// position is a pointer to a vector representing the current position in millimeters.
|
||||||
|
|
||||||
|
#ifdef __AVR_ATmega328P__
|
||||||
// The arc is approximated by generating a huge number of tiny, linear segments. The length of each
|
// The arc is approximated by generating a huge number of tiny, linear segments. The length of each
|
||||||
// segment is configured in settings.mm_per_arc_segment.
|
// segment is configured in settings.mm_per_arc_segment.
|
||||||
void mc_arc(double theta, double angular_travel, double radius, double linear_travel, int axis_1, int axis_2,
|
void mc_arc(double theta, double angular_travel, double radius, double linear_travel, int axis_1, int axis_2,
|
||||||
@ -77,6 +78,7 @@ void mc_arc(double theta, double angular_travel, double radius, double linear_tr
|
|||||||
}
|
}
|
||||||
plan_set_acceleration_manager_enabled(acceleration_manager_was_enabled);
|
plan_set_acceleration_manager_enabled(acceleration_manager_was_enabled);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void mc_go_home()
|
void mc_go_home()
|
||||||
{
|
{
|
||||||
|
@ -31,12 +31,14 @@
|
|||||||
// NOTE: Although this function structurally belongs in this module, there is nothing to do but
|
// NOTE: Although this function structurally belongs in this module, there is nothing to do but
|
||||||
// to forward the request to the planner. For efficiency the function is implemented with a macro.
|
// to forward the request to the planner. For efficiency the function is implemented with a macro.
|
||||||
|
|
||||||
|
#ifdef __AVR_ATmega328P__
|
||||||
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc,
|
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc,
|
||||||
// positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the
|
// positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the
|
||||||
// circle in millimeters. axis_1 and axis_2 selects the circle plane in tool space. Stick the remaining
|
// circle in millimeters. axis_1 and axis_2 selects the circle plane in tool space. Stick the remaining
|
||||||
// axis in axis_l which will be the axis for linear travel if you are tracing a helical motion.
|
// axis in axis_l which will be the axis for linear travel if you are tracing a helical motion.
|
||||||
void mc_arc(double theta, double angular_travel, double radius, double linear_travel, int axis_1, int axis_2,
|
void mc_arc(double theta, double angular_travel, double radius, double linear_travel, int axis_1, int axis_2,
|
||||||
int axis_linear, double feed_rate, int invert_feed_rate, double *position);
|
int axis_linear, double feed_rate, int invert_feed_rate, double *position);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Dwell for a couple of time units
|
// Dwell for a couple of time units
|
||||||
void mc_dwell(uint32_t milliseconds);
|
void mc_dwell(uint32_t milliseconds);
|
||||||
|
@ -64,7 +64,11 @@
|
|||||||
#include "wiring_serial.h"
|
#include "wiring_serial.h"
|
||||||
|
|
||||||
// The number of linear motions that can be in the plan at any give time
|
// The number of linear motions that can be in the plan at any give time
|
||||||
#define BLOCK_BUFFER_SIZE 20
|
#ifdef __AVR_ATmega328P__
|
||||||
|
#define BLOCK_BUFFER_SIZE 20
|
||||||
|
#else
|
||||||
|
#define BLOCK_BUFFER_SIZE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
static block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions
|
static block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions
|
||||||
static volatile int block_buffer_head; // Index of the next block to be pushed
|
static volatile int block_buffer_head; // Index of the next block to be pushed
|
||||||
|
@ -31,7 +31,11 @@
|
|||||||
// using a ring buffer (I think), in which rx_buffer_head is the index of the
|
// using a ring buffer (I think), in which rx_buffer_head is the index of the
|
||||||
// location to which to write the next incoming character and rx_buffer_tail
|
// location to which to write the next incoming character and rx_buffer_tail
|
||||||
// is the index of the location from which to read.
|
// is the index of the location from which to read.
|
||||||
#define RX_BUFFER_SIZE 200
|
#ifdef __AVR_ATmega328P__
|
||||||
|
#define RX_BUFFER_SIZE 256
|
||||||
|
#else
|
||||||
|
#define RX_BUFFER_SIZE 64
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned char rx_buffer[RX_BUFFER_SIZE];
|
unsigned char rx_buffer[RX_BUFFER_SIZE];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user