From d376f03bd0706456a6e66f44ca27f6b0f4498d38 Mon Sep 17 00:00:00 2001 From: Bertus Kruger Date: Tue, 12 Mar 2013 19:01:17 +1300 Subject: [PATCH 1/5] Update eeprom.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Function eeprom_put_char's parameters did not align with the .h file. --- eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eeprom.c b/eeprom.c index 02caf20..7169b37 100644 --- a/eeprom.c +++ b/eeprom.c @@ -71,7 +71,7 @@ unsigned char eeprom_get_char( unsigned int addr ) * \param addr EEPROM address to write to. * \param new_value New EEPROM value. */ -void eeprom_put_char( unsigned int addr, unsigned char new_value ) +void eeprom_put_char( unsigned int addr, char new_value ) { char old_value; // Old EEPROM value. char diff_mask; // Difference mask, i.e. old value XOR new value. From 058cf3f13a3ebd1adb07db684db838467b2d8e36 Mon Sep 17 00:00:00 2001 From: Bertus Kruger Date: Tue, 12 Mar 2013 19:08:44 +1300 Subject: [PATCH 2/5] Update gcode.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit home_select defined out of scope. Moved it outside the switch so the rest of the switch can see it properly.  --- gcode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcode.c b/gcode.c index c741fc2..3556bad 100644 --- a/gcode.c +++ b/gcode.c @@ -271,6 +271,8 @@ uint8_t gc_execute_line(char *line) // [G4,G10,G28,G30,G92,G92.1]: Perform dwell, set coordinate system data, homing, or set axis offsets. // NOTE: These commands are in the same modal group, hence are mutually exclusive. G53 is in this // modal group and do not effect these actions. + uint8_t home_select; + switch (non_modal_action) { case NON_MODAL_DWELL: if (p < 0) { // Time cannot be negative. @@ -328,7 +330,7 @@ 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; + 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); } mc_line(coord_data[X_AXIS], coord_data[Y_AXIS], coord_data[Z_AXIS], settings.default_seek_rate, false); From 7bb20a7505eb0b57af36265d0e7d45376d6986a7 Mon Sep 17 00:00:00 2001 From: Bertus Kruger Date: Wed, 13 Mar 2013 09:43:04 +1300 Subject: [PATCH 3/5] Update eeprom.c Changed back --- eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eeprom.c b/eeprom.c index 7169b37..02caf20 100644 --- a/eeprom.c +++ b/eeprom.c @@ -71,7 +71,7 @@ unsigned char eeprom_get_char( unsigned int addr ) * \param addr EEPROM address to write to. * \param new_value New EEPROM value. */ -void eeprom_put_char( unsigned int addr, char new_value ) +void eeprom_put_char( unsigned int addr, unsigned char new_value ) { char old_value; // Old EEPROM value. char diff_mask; // Difference mask, i.e. old value XOR new value. From 5ecc661ec8adc61a9e4f9dec704f259450309394 Mon Sep 17 00:00:00 2001 From: Bertus Kruger Date: Wed, 13 Mar 2013 09:44:22 +1300 Subject: [PATCH 4/5] Update eeprom.h Fixed the function signature. --- eeprom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eeprom.h b/eeprom.h index 1769903..311eee3 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); From 8e01fed143c6fbd5239a93bedcdb64f2eb245102 Mon Sep 17 00:00:00 2001 From: Bertus Kruger Date: Wed, 13 Mar 2013 10:19:42 +1300 Subject: [PATCH 5/5] Update gcode.c Removed the home_select variable. --- gcode.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gcode.c b/gcode.c index 3556bad..630f5a1 100644 --- a/gcode.c +++ b/gcode.c @@ -271,8 +271,6 @@ uint8_t gc_execute_line(char *line) // [G4,G10,G28,G30,G92,G92.1]: Perform dwell, set coordinate system data, homing, or set axis offsets. // NOTE: These commands are in the same modal group, hence are mutually exclusive. G53 is in this // modal group and do not effect these actions. - uint8_t home_select; - switch (non_modal_action) { case NON_MODAL_DWELL: if (p < 0) { // Time cannot be negative. @@ -330,18 +328,22 @@ uint8_t gc_execute_line(char *line) } // Retreive G28/30 go-home position data (in machine coordinates) from EEPROM float coord_data[N_AXIS]; - 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_1) { + if (!settings_read_coord_data(SETTING_INDEX_G30 ,coord_data)) { return(STATUS_SETTING_READ_FAIL); } + } else { + if (!settings_read_coord_data(SETTING_INDEX_G28 ,coord_data)) { return(STATUS_SETTING_READ_FAIL); } + } mc_line(coord_data[X_AXIS], coord_data[Y_AXIS], coord_data[Z_AXIS], settings.default_seek_rate, 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); - break; + if (non_modal_action == NON_MODAL_SET_HOME_1) { + settings_write_coord_data(SETTING_INDEX_G30,gc.position); + } else { + settings_write_coord_data(SETTING_INDEX_G28,gc.position); + } + break; case NON_MODAL_SET_COORDINATE_OFFSET: if (!axis_words) { // No axis words FAIL(STATUS_INVALID_STATEMENT);