ARM: bring in gcode_process.c.

Again, the whole file compiled flawlessly without change. Still,
to get it linked as well, most of the functionality had to
be #ifdef'd out.

Nevertheless, the firmware shows first signs of life, e.g. M115
works.
This commit is contained in:
Markus Hitter 2015-07-30 23:52:19 +02:00
parent 7be5212f06
commit 96f7dbd2b1
3 changed files with 51 additions and 3 deletions

View File

@ -98,7 +98,7 @@ TARGET = $(PROGRAM).hex
# Until the generic ARM port is completed, we'd have to wrap all sources # Until the generic ARM port is completed, we'd have to wrap all sources
# in #ifdef __AVR__. To avoid this, build only a selection for now: # in #ifdef __AVR__. To avoid this, build only a selection for now:
SOURCES = mendel.c cpu.c serial.c sermsg.c sersendf.c delay.c SOURCES = mendel.c cpu.c serial.c sermsg.c sersendf.c delay.c
SOURCES += gcode_parse.c SOURCES += gcode_parse.c gcode_process.c
ifeq ($(MCU), lpc1114) ifeq ($(MCU), lpc1114)
SOURCES += cmsis-system_lpc11xx.c SOURCES += cmsis-system_lpc11xx.c
endif endif

View File

@ -387,9 +387,7 @@ uint8_t gcode_parse_char(uint8_t c) {
#endif #endif
) { ) {
// process // process
#ifndef __ARMEL_NOTYET__
process_gcode_command(); process_gcode_command();
#endif /* __ARMEL_NOTYET__ */
// Acknowledgement ("ok") is sent in the main loop, in mendel.c. // Acknowledgement ("ok") is sent in the main loop, in mendel.c.

View File

@ -46,12 +46,14 @@ uint8_t next_tool;
void process_gcode_command() { void process_gcode_command() {
uint32_t backup_f; uint32_t backup_f;
#ifndef __ARMEL_NOTYET__
// convert relative to absolute // convert relative to absolute
if (next_target.option_all_relative) { if (next_target.option_all_relative) {
next_target.target.axis[X] += startpoint.axis[X]; next_target.target.axis[X] += startpoint.axis[X];
next_target.target.axis[Y] += startpoint.axis[Y]; next_target.target.axis[Y] += startpoint.axis[Y];
next_target.target.axis[Z] += startpoint.axis[Z]; next_target.target.axis[Z] += startpoint.axis[Z];
} }
#endif /* __ARMEL_NOTYET__ */
// E relative movement. // E relative movement.
// Matches Sprinter's behaviour as of March 2012. // Matches Sprinter's behaviour as of March 2012.
@ -99,7 +101,9 @@ void process_gcode_command() {
} }
if (next_target.seen_G) { if (next_target.seen_G) {
#ifndef __ARMEL_NOTYET__
uint8_t axisSelected = 0; uint8_t axisSelected = 0;
#endif /* __ARMEL_NOTYET__ */
switch (next_target.G) { switch (next_target.G) {
case 0: case 0:
//? G0: Rapid Linear Motion //? G0: Rapid Linear Motion
@ -110,7 +114,9 @@ void process_gcode_command() {
//? //?
backup_f = next_target.target.F; backup_f = next_target.target.F;
next_target.target.F = MAXIMUM_FEEDRATE_X * 2L; next_target.target.F = MAXIMUM_FEEDRATE_X * 2L;
#ifndef __ARMEL_NOTYET__
enqueue(&next_target.target); enqueue(&next_target.target);
#endif /* __ARMEL_NOTYET__ */
next_target.target.F = backup_f; next_target.target.F = backup_f;
break; break;
@ -121,7 +127,9 @@ void process_gcode_command() {
//? //?
//? Go in a straight line from the current (X, Y) point to the point (90.6, 13.8), extruding material as the move happens from the current extruded length to a length of 22.4 mm. //? Go in a straight line from the current (X, Y) point to the point (90.6, 13.8), extruding material as the move happens from the current extruded length to a length of 22.4 mm.
//? //?
#ifndef __ARMEL_NOTYET__
enqueue(&next_target.target); enqueue(&next_target.target);
#endif /* __ARMEL_NOTYET__ */
break; break;
// G2 - Arc Clockwise // G2 - Arc Clockwise
@ -137,7 +145,9 @@ void process_gcode_command() {
//? //?
//? In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example the temperatures of its extruders) will still be preserved and controlled. //? In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example the temperatures of its extruders) will still be preserved and controlled.
//? //?
#ifndef __ARMEL_NOTYET__
queue_wait(); queue_wait();
#endif /* __ARMEL_NOTYET__ */
// delay // delay
if (next_target.seen_P) { if (next_target.seen_P) {
for (;next_target.P > 0;next_target.P--) { for (;next_target.P > 0;next_target.P--) {
@ -171,7 +181,9 @@ void process_gcode_command() {
//? --- G30: Go home via point --- //? --- G30: Go home via point ---
//? //?
//? Undocumented. //? Undocumented.
#ifndef __ARMEL_NOTYET__
enqueue(&next_target.target); enqueue(&next_target.target);
#endif /* __ARMEL_NOTYET__ */
// no break here, G30 is move and then go home // no break here, G30 is move and then go home
case 28: case 28:
@ -193,6 +205,7 @@ void process_gcode_command() {
//? ignored. //? ignored.
//? //?
#ifndef __ARMEL_NOTYET__
queue_wait(); queue_wait();
if (next_target.seen_X) { if (next_target.seen_X) {
@ -224,6 +237,7 @@ void process_gcode_command() {
if (!axisSelected) { if (!axisSelected) {
home(); home();
} }
#endif /* __ARMEL_NOTYET__ */
break; break;
case 90: case 90:
@ -264,6 +278,7 @@ void process_gcode_command() {
//? Allows programming of absolute zero point, by reseting the current position to the values specified. This would set the machine's X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur. //? Allows programming of absolute zero point, by reseting the current position to the values specified. This would set the machine's X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur.
//? //?
#ifndef __ARMEL_NOTYET__
queue_wait(); queue_wait();
if (next_target.seen_X) { if (next_target.seen_X) {
@ -291,6 +306,7 @@ void process_gcode_command() {
} }
dda_new_startpoint(); dda_new_startpoint();
#endif /* __ARMEL_NOTYET__ */
break; break;
case 161: case 161:
@ -298,6 +314,7 @@ void process_gcode_command() {
//? //?
//? Find the minimum limit of the specified axes by searching for the limit switch. //? Find the minimum limit of the specified axes by searching for the limit switch.
//? //?
#ifndef __ARMEL_NOTYET__
#if defined X_MIN_PIN #if defined X_MIN_PIN
if (next_target.seen_X) if (next_target.seen_X)
home_x_negative(); home_x_negative();
@ -310,6 +327,7 @@ void process_gcode_command() {
if (next_target.seen_Z) if (next_target.seen_Z)
home_z_negative(); home_z_negative();
#endif #endif
#endif /* __ARMEL_NOTYET__ */
break; break;
case 162: case 162:
@ -317,6 +335,7 @@ void process_gcode_command() {
//? //?
//? Find the maximum limit of the specified axes by searching for the limit switch. //? Find the maximum limit of the specified axes by searching for the limit switch.
//? //?
#ifndef __ARMEL_NOTYET__
#if defined X_MAX_PIN #if defined X_MAX_PIN
if (next_target.seen_X) if (next_target.seen_X)
home_x_positive(); home_x_positive();
@ -329,6 +348,7 @@ void process_gcode_command() {
if (next_target.seen_Z) if (next_target.seen_Z)
home_z_positive(); home_z_positive();
#endif #endif
#endif /* __ARMEL_NOTYET__ */
break; break;
// unknown gcode: spit an error // unknown gcode: spit an error
@ -339,7 +359,9 @@ void process_gcode_command() {
} }
} }
else if (next_target.seen_M) { else if (next_target.seen_M) {
#ifndef __ARMEL_NOTYET__
uint8_t i; uint8_t i;
#endif /* __ARMEL_NOTYET__ */
switch (next_target.M) { switch (next_target.M) {
case 0: case 0:
@ -359,10 +381,12 @@ void process_gcode_command() {
//? //?
//? http://linuxcnc.org/handbook/RS274NGC_3/RS274NGC_33a.html#1002379 //? http://linuxcnc.org/handbook/RS274NGC_3/RS274NGC_33a.html#1002379
//? //?
#ifndef __ARMEL_NOTYET__
queue_wait(); queue_wait();
for (i = 0; i < NUM_HEATERS; i++) for (i = 0; i < NUM_HEATERS; i++)
temp_set(i, 0); temp_set(i, 0);
power_off(); power_off();
#endif /* __ARMEL_NOTYET__ */
serial_writestr_P(PSTR("\nstop\n")); serial_writestr_P(PSTR("\nstop\n"));
break; break;
@ -373,6 +397,7 @@ void process_gcode_command() {
tool = next_tool; tool = next_tool;
break; break;
#ifndef __ARMEL_NOTYET__
#ifdef SD #ifdef SD
case 20: case 20:
//? --- M20: list SD card. --- //? --- M20: list SD card. ---
@ -421,6 +446,7 @@ void process_gcode_command() {
gcode_sources &= ! GCODE_SOURCE_SD; gcode_sources &= ! GCODE_SOURCE_SD;
break; break;
#endif /* SD */ #endif /* SD */
#endif /* __ARMEL_NOTYET__ */
case 82: case 82:
//? --- M82 - Set E codes absolute --- //? --- M82 - Set E codes absolute ---
@ -453,12 +479,14 @@ void process_gcode_command() {
//? --- M101: extruder on --- //? --- M101: extruder on ---
//? //?
//? Undocumented. //? Undocumented.
#ifndef __ARMEL_NOTYET__
if (temp_achieved() == 0) { if (temp_achieved() == 0) {
enqueue(NULL); enqueue(NULL);
} }
#ifdef DC_EXTRUDER #ifdef DC_EXTRUDER
heater_set(DC_EXTRUDER, DC_EXTRUDER_PWM); heater_set(DC_EXTRUDER, DC_EXTRUDER_PWM);
#endif #endif
#endif /* __ARMEL_NOTYET__ */
break; break;
// M5/M103- extruder off // M5/M103- extruder off
@ -467,9 +495,11 @@ void process_gcode_command() {
//? --- M103: extruder off --- //? --- M103: extruder off ---
//? //?
//? Undocumented. //? Undocumented.
#ifndef __ARMEL_NOTYET__
#ifdef DC_EXTRUDER #ifdef DC_EXTRUDER
heater_set(DC_EXTRUDER, 0); heater_set(DC_EXTRUDER, 0);
#endif #endif
#endif /* __ARMEL_NOTYET__ */
break; break;
case 104: case 104:
@ -488,6 +518,7 @@ void process_gcode_command() {
//? //?
if ( ! next_target.seen_S) if ( ! next_target.seen_S)
break; break;
#ifndef __ARMEL_NOTYET__
if ( ! next_target.seen_P) if ( ! next_target.seen_P)
#ifdef HEATER_EXTRUDER #ifdef HEATER_EXTRUDER
next_target.P = HEATER_EXTRUDER; next_target.P = HEATER_EXTRUDER;
@ -495,6 +526,7 @@ void process_gcode_command() {
next_target.P = 0; next_target.P = 0;
#endif #endif
temp_set(next_target.P, next_target.S); temp_set(next_target.P, next_target.S);
#endif /* __ARMEL_NOTYET__ */
break; break;
case 105: case 105:
@ -511,12 +543,14 @@ void process_gcode_command() {
//? Teacup supports an optional P parameter as a zero-based temperature //? Teacup supports an optional P parameter as a zero-based temperature
//? sensor index to address. //? sensor index to address.
//? //?
#ifndef __ARMEL_NOTYET__
#ifdef ENFORCE_ORDER #ifdef ENFORCE_ORDER
queue_wait(); queue_wait();
#endif #endif
if ( ! next_target.seen_P) if ( ! next_target.seen_P)
next_target.P = TEMP_SENSOR_none; next_target.P = TEMP_SENSOR_none;
temp_print(next_target.P); temp_print(next_target.P);
#endif /* __ARMEL_NOTYET__ */
break; break;
case 7: case 7:
@ -531,6 +565,7 @@ void process_gcode_command() {
//? index to address. The heater index can differ from the temperature //? index to address. The heater index can differ from the temperature
//? sensor index, see config.h. //? sensor index, see config.h.
#ifndef __ARMEL_NOTYET__
#ifdef ENFORCE_ORDER #ifdef ENFORCE_ORDER
// wait for all moves to complete // wait for all moves to complete
queue_wait(); queue_wait();
@ -544,6 +579,7 @@ void process_gcode_command() {
if ( ! next_target.seen_S) if ( ! next_target.seen_S)
break; break;
heater_set(next_target.P, next_target.S); heater_set(next_target.P, next_target.S);
#endif /* __ARMEL_NOTYET__ */
break; break;
case 110: case 110:
@ -588,12 +624,14 @@ void process_gcode_command() {
//? restart is to press the reset button on the master microcontroller. //? restart is to press the reset button on the master microcontroller.
//? See also M0. //? See also M0.
//? //?
#ifndef __ARMEL_NOTYET__
timer_stop(); timer_stop();
queue_flush(); queue_flush();
power_off(); power_off();
cli(); cli();
for (;;) for (;;)
wd_reset(); wd_reset();
#endif /* __ARMEL_NOTYET__ */
break; break;
case 114: case 114:
@ -607,6 +645,7 @@ void process_gcode_command() {
//? //?
//? <tt>ok C: X:0.00 Y:0.00 Z:0.00 E:0.00</tt> //? <tt>ok C: X:0.00 Y:0.00 Z:0.00 E:0.00</tt>
//? //?
#ifndef __ARMEL_NOTYET__
#ifdef ENFORCE_ORDER #ifdef ENFORCE_ORDER
// wait for all moves to complete // wait for all moves to complete
queue_wait(); queue_wait();
@ -632,6 +671,7 @@ void process_gcode_command() {
); );
print_queue(); print_queue();
} }
#endif /* __ARMEL_NOTYET__ */
// newline is sent from gcode_parse after we return // newline is sent from gcode_parse after we return
break; break;
@ -659,14 +699,18 @@ void process_gcode_command() {
//? //?
//? Wait for temperatures and other slowly-changing variables to arrive at their set values. //? Wait for temperatures and other slowly-changing variables to arrive at their set values.
#ifndef __ARMEL_NOTYET__
enqueue(NULL); enqueue(NULL);
#endif /* __ARMEL_NOTYET__ */
break; break;
case 119: case 119:
//? --- M119: report endstop status --- //? --- M119: report endstop status ---
//? Report the current status of the endstops configured in the //? Report the current status of the endstops configured in the
//? firmware to the host. //? firmware to the host.
#ifndef __ARMEL_NOTYET__
power_on(); power_on();
#endif /* __ARMEL_NOTYET__ */
endstops_on(); endstops_on();
delay_ms(10); // allow the signal to stabilize delay_ms(10); // allow the signal to stabilize
{ {
@ -707,6 +751,7 @@ void process_gcode_command() {
serial_writechar('\n'); serial_writechar('\n');
break; break;
#ifndef __ARMEL_NOTYET__
#ifdef EECONFIG #ifdef EECONFIG
case 130: case 130:
//? --- M130: heater P factor --- //? --- M130: heater P factor ---
@ -769,6 +814,7 @@ void process_gcode_command() {
heater_save_settings(); heater_save_settings();
break; break;
#endif /* EECONFIG */ #endif /* EECONFIG */
#endif /* __ARMEL_NOTYET__ */
#ifdef DEBUG #ifdef DEBUG
case 136: case 136:
@ -781,7 +827,9 @@ void process_gcode_command() {
#else #else
next_target.P = 0; next_target.P = 0;
#endif #endif
#ifndef __ARMEL_NOTYET__
heater_print(next_target.P); heater_print(next_target.P);
#endif /* __ARMEL_NOTYET__ */
break; break;
#endif /* DEBUG */ #endif /* DEBUG */
@ -791,7 +839,9 @@ void process_gcode_command() {
#ifdef HEATER_BED #ifdef HEATER_BED
if ( ! next_target.seen_S) if ( ! next_target.seen_S)
break; break;
#ifndef __ARMEL_NOTYET__
temp_set(HEATER_BED, next_target.S); temp_set(HEATER_BED, next_target.S);
#endif /* __ARMEL_NOTYET__ */
#endif #endif
break; break;