From aae1089051367091ed9551d4c5aa942d9298c855 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Tue, 12 Mar 2013 18:10:24 -0600 Subject: [PATCH] Pushed minor changes. Thanks @Protoneer! --- eeprom.h | 2 +- gcode.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/eeprom.h b/eeprom.h index 1769903..cffbcde 100644 --- a/eeprom.h +++ b/eeprom.h @@ -2,7 +2,7 @@ #define eeprom_h char eeprom_get_char(unsigned int addr); -void eeprom_put_char(unsigned int addr, char new_value); +void eeprom_put_char(unsigned int addr, unsigned char new_value); void memcpy_to_eeprom_with_checksum(unsigned int destination, char *source, unsigned int size); int memcpy_from_eeprom_with_checksum(char *destination, unsigned int source, unsigned int size); diff --git a/gcode.c b/gcode.c index d67ace0..88e6951 100644 --- a/gcode.c +++ b/gcode.c @@ -325,17 +325,21 @@ uint8_t gc_execute_line(char *line) } // Retreive G28/30 go-home position data (in machine coordinates) from EEPROM float coord_data[N_AXIS]; - uint8_t home_select = SETTING_INDEX_G28; - if (non_modal_action == NON_MODAL_GO_HOME_1) { home_select = SETTING_INDEX_G30; } - if (!settings_read_coord_data(home_select,coord_data)) { return(STATUS_SETTING_READ_FAIL); } + if (non_modal_action == NON_MODAL_GO_HOME_0) { + if (!settings_read_coord_data(SETTING_INDEX_G28,coord_data)) { return(STATUS_SETTING_READ_FAIL); } + } else { + if (!settings_read_coord_data(SETTING_INDEX_G30,coord_data)) { return(STATUS_SETTING_READ_FAIL); } + } mc_line(coord_data[X_AXIS], coord_data[Y_AXIS], coord_data[Z_AXIS], -1.0, false); memcpy(gc.position, coord_data, sizeof(coord_data)); // gc.position[] = coord_data[]; axis_words = 0; // Axis words used. Lock out from motion modes by clearing flags. break; case NON_MODAL_SET_HOME_0: case NON_MODAL_SET_HOME_1: - home_select = SETTING_INDEX_G28; - if (non_modal_action == NON_MODAL_SET_HOME_1) { home_select = SETTING_INDEX_G30; } - settings_write_coord_data(home_select,gc.position); + if (non_modal_action == NON_MODAL_SET_HOME_0) { + settings_write_coord_data(SETTING_INDEX_G28,gc.position); + } else { + settings_write_coord_data(SETTING_INDEX_G30,gc.position); + } break; case NON_MODAL_SET_COORDINATE_OFFSET: if (!axis_words) { // No axis words