From 96f7d9b78e1c6e81d17bf98c878da60327faa960 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Tue, 19 Mar 2013 11:35:19 -0600 Subject: [PATCH] G-code updates for G10 L2 and L20 - Updated g-codes G10 L2 and G10 L20 to the new descriptions on linuxcnc.org --- gcode.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/gcode.c b/gcode.c index 630f5a1..478027d 100644 --- a/gcode.c +++ b/gcode.c @@ -282,28 +282,29 @@ uint8_t gc_execute_line(char *line) break; case NON_MODAL_SET_COORDINATE_DATA: int_value = trunc(p); // Convert p value to int. - if ((l != 2 && l != 20) || (int_value < 1 || int_value > N_COORDINATE_SYSTEM)) { // L2 and L20. P1=G54, P2=G55, ... + if ((l != 2 && l != 20) || (int_value < 0 || int_value > N_COORDINATE_SYSTEM)) { // L2 and L20. P1=G54, P2=G55, ... FAIL(STATUS_UNSUPPORTED_STATEMENT); } else if (!axis_words && l==2) { // No axis words. FAIL(STATUS_INVALID_STATEMENT); } else { - int_value--; // Adjust P index to EEPROM coordinate data indexing. - if (l == 20) { - settings_write_coord_data(int_value,gc.position); - // Update system coordinate system if currently active. - if (gc.coord_select == int_value) { memcpy(gc.coord_system,gc.position,sizeof(gc.position)); } - } else { - float coord_data[N_AXIS]; - if (!settings_read_coord_data(int_value,coord_data)) { return(STATUS_SETTING_READ_FAIL); } - // Update axes defined only in block. Always in machine coordinates. Can change non-active system. - uint8_t i; - for (i=0; i 0) { int_value--; } // Adjust P1-P6 index to EEPROM coordinate data indexing. + else { int_value = gc.coord_select; } // Index P0 as the active coordinate system + float coord_data[N_AXIS]; + if (!settings_read_coord_data(int_value,coord_data)) { return(STATUS_SETTING_READ_FAIL); } + uint8_t i; + // Update axes defined only in block. Always in machine coordinates. Can change non-active system. + for (i=0; i