configurations and adjustments to protocol
This commit is contained in:
parent
356517c6f2
commit
2bd984a734
6
config.h
6
config.h
@ -23,9 +23,9 @@
|
||||
|
||||
#define VERSION "0.0"
|
||||
|
||||
#define X_STEPS_PER_MM 10.0
|
||||
#define Y_STEPS_PER_MM 10.0
|
||||
#define Z_STEPS_PER_MM 10.0
|
||||
#define X_STEPS_PER_MM 1.0
|
||||
#define Y_STEPS_PER_MM 1.0
|
||||
#define Z_STEPS_PER_MM 1.0
|
||||
|
||||
#define INCHES_PER_MM 25.4
|
||||
#define X_STEPS_PER_INCH X_STEPS_PER_MM*INCHES_PER_MM
|
||||
|
7
gcode.c
7
gcode.c
@ -23,7 +23,7 @@
|
||||
|
||||
/* Intentionally not supported:
|
||||
- Canned cycles
|
||||
- Tool radius compensatino
|
||||
- Tool radius compensation
|
||||
- A,B,C-axes
|
||||
- Multiple coordinate systems
|
||||
- Evaluation of expressions
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
/*
|
||||
Omitted for the time being:
|
||||
group 0 = {G10, G28, G30, G53, G92, G92.1, G92.2, G92.3} (Non modal G-codes)
|
||||
group 0 = {G10, G28, G30, G92, G92.1, G92.2, G92.3} (Non modal G-codes)
|
||||
group 8 = {M7, M8, M9} coolant (special case: M7 and M8 may be active at the same time)
|
||||
group 9 = {M48, M49} enable/disable feed and speed override switches
|
||||
group 12 = {G54, G55, G56, G57, G58, G59, G59.1, G59.2, G59.3} coordinate system selection
|
||||
@ -114,6 +114,7 @@ void gc_init() {
|
||||
memset(&gc, 0, sizeof(gc));
|
||||
gc.feed_rate = DEFAULT_FEEDRATE;
|
||||
select_plane(X_AXIS, Y_AXIS, Z_AXIS);
|
||||
gc.absolute_mode = true;
|
||||
}
|
||||
|
||||
inline float to_millimeters(double value) {
|
||||
@ -180,7 +181,7 @@ uint8_t gc_execute_line(char *line) {
|
||||
case 'M':
|
||||
switch(int_value) {
|
||||
case 0: case 1: gc.program_flow = PROGRAM_FLOW_PAUSED; break;
|
||||
case 2: gc.program_flow = PROGRAM_FLOW_COMPLETED; break;
|
||||
case 2: case 30: case 60: gc.program_flow = PROGRAM_FLOW_COMPLETED; break;
|
||||
case 3: gc.spindle_direction = 1; break;
|
||||
case 4: gc.spindle_direction = -1; break;
|
||||
case 5: gc.spindle_direction = 0; break;
|
||||
|
@ -65,7 +65,7 @@ void mc_dwell(uint32_t milliseconds)
|
||||
|
||||
// Calculate the microseconds between steps that we should wait in order to travel the
|
||||
// designated amount of millimeters in the amount of steps we are going to generate
|
||||
void set_step_pace(double feed_rate, double millimeters_of_travel, uint32_t steps, int invert) {
|
||||
void compute_and_set_step_pace(double feed_rate, double millimeters_of_travel, uint32_t steps, int invert) {
|
||||
int32_t pace;
|
||||
if (invert) {
|
||||
pace = round(ONE_MINUTE_OF_MICROSECONDS/feed_rate/steps);
|
||||
@ -113,11 +113,11 @@ void mc_line(double x, double y, double z, float feed_rate, int invert_feed_rate
|
||||
|
||||
// Ask old Phytagoras to estimate how many mm our next move is going to take us
|
||||
double millimeters_of_travel =
|
||||
sqrt(pow(X_STEPS_PER_MM*step_count[X_AXIS],2) +
|
||||
pow(Y_STEPS_PER_MM*step_count[Y_AXIS],2) +
|
||||
pow(Z_STEPS_PER_MM*step_count[Z_AXIS],2));
|
||||
sqrt(square(X_STEPS_PER_MM*step_count[X_AXIS]) +
|
||||
square(Y_STEPS_PER_MM*step_count[Y_AXIS]) +
|
||||
square(Z_STEPS_PER_MM*step_count[Z_AXIS]));
|
||||
// And set the step pace
|
||||
set_step_pace(feed_rate, millimeters_of_travel, maximum_steps, invert_feed_rate);
|
||||
compute_and_set_step_pace(feed_rate, millimeters_of_travel, maximum_steps, invert_feed_rate);
|
||||
|
||||
// Execution -----------------------------------------------------------------------------------------------
|
||||
|
||||
@ -247,10 +247,10 @@ void mc_arc(double theta, double angular_travel, double radius, double linear_tr
|
||||
// Calculate feed rate -------------------------------------------------------------------------------------
|
||||
|
||||
// We then calculate the millimeters of helical travel
|
||||
double millimeters_of_travel = sqrt(pow(angular_travel*radius,2)+pow(abs(linear_travel),2));
|
||||
double millimeters_of_travel = hypot(angular_travel*radius, abs(linear_travel));
|
||||
// Then we calculate the microseconds between each step as if we will trace the full circle.
|
||||
// It doesn't matter what fraction of the circle we are actually going to trace. The pace is the same.
|
||||
set_step_pace(feed_rate, millimeters_of_travel, maximum_steps, invert_feed_rate);
|
||||
compute_and_set_step_pace(feed_rate, millimeters_of_travel, maximum_steps, invert_feed_rate);
|
||||
|
||||
// Execution -----------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -14,7 +14,7 @@ Status:
|
||||
* Runs on atmega168/arduino.
|
||||
* GCode interpreter complete
|
||||
* Linear interpolation machine control complete
|
||||
* Arcs complete (no helices yet)
|
||||
* Arcs and helical interpolation complete
|
||||
* Buffered, non blocking, asynchronous stepping so the rest of the system is free to generate new steps and parse
|
||||
g-code while the steppers are still steppin'
|
||||
* Basic serial protocol complete
|
||||
|
@ -32,7 +32,7 @@ char line[BLOCK_BUFFER_SIZE];
|
||||
uint8_t line_counter;
|
||||
|
||||
void prompt() {
|
||||
printString(PROMPT);
|
||||
printString("\r\n@");
|
||||
line_counter = 0;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ void sp_init()
|
||||
|
||||
printString("\r\nGrbl ");
|
||||
printString(VERSION);
|
||||
printByte('\r');
|
||||
printString("\r\n");
|
||||
prompt();
|
||||
}
|
||||
|
||||
@ -85,9 +85,12 @@ void sp_process()
|
||||
{
|
||||
if((c < 32)) { // Line is complete. Then execute!
|
||||
line[line_counter] = 0;
|
||||
// printByte('"');
|
||||
// printString(line);
|
||||
// printByte('"');
|
||||
gc_execute_line(line);
|
||||
line_counter = 0;
|
||||
print_result();
|
||||
//print_result();
|
||||
prompt();
|
||||
} else if (c == ' ' || c == '\t') { // Throw away whitepace
|
||||
} else if (c >= 'a' && c <= 'z') { // Upcase lowercase
|
||||
|
Loading…
Reference in New Issue
Block a user