From 9656a82609c83f9dc2e0f21973a26c13b336f953 Mon Sep 17 00:00:00 2001 From: Bob-the-Kuhn Date: Wed, 28 Mar 2018 13:14:39 -0500 Subject: [PATCH] Fix G53/CNC_COORDINATE_SYSTEMS compilation, Travis testing (#10227) --- .travis.yml | 11 +- Marlin/src/gcode/geometry/G53-G59.cpp | 119 +++++++++++----------- Marlin/src/module/configuration_store.cpp | 2 +- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9313b9fdb5..ac6777fb45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,13 +63,13 @@ script: - opt_set TEMP_SENSOR_1 1 - opt_set TEMP_SENSOR_BED 1 - opt_set POWER_SUPPLY 1 - - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS + - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE - - opt_enable_adv FWRETRACT MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING ADVANCED_PAUSE_FEATURE - - opt_set ABL_GRID_POINTS_X 16 - - opt_set ABL_GRID_POINTS_Y 16 + - opt_enable_adv ARC_P_CIRCLES ADVANCED_PAUSE_FEATURE CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS + - opt_enable_adv FWRETRACT MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING + - opt_set GRID_MAX_POINTS_X 16 - opt_set_adv FANMUX0_PIN 53 - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # @@ -363,8 +363,7 @@ script: - opt_enable PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER - opt_enable_adv ADVANCED_PAUSE_FEATURE LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA PARK_HEAD_ON_PAUSE - opt_set_adv I2C_SLAVE_ADDRESS 63 - - opt_set ABL_GRID_POINTS_X 16 - - opt_set ABL_GRID_POINTS_Y 16 + - opt_set GRID_MAX_POINTS_X 16 - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # # Test a Sled Z Probe with Linear leveling diff --git a/Marlin/src/gcode/geometry/G53-G59.cpp b/Marlin/src/gcode/geometry/G53-G59.cpp index ac4c2fd581..d2a89a4858 100644 --- a/Marlin/src/gcode/geometry/G53-G59.cpp +++ b/Marlin/src/gcode/geometry/G53-G59.cpp @@ -24,70 +24,71 @@ #include "../../module/motion.h" #if ENABLED(CNC_COORDINATE_SYSTEMS) - #include "../../module/stepper.h" - /** - * Select a coordinate system and update the workspace offset. - * System index -1 is used to specify machine-native. - */ - bool GcodeSuite::select_coordinate_system(const int8_t _new) { - if (active_coordinate_system == _new) return false; - stepper.synchronize(); - float old_offset[XYZ] = { 0 }, new_offset[XYZ] = { 0 }; - if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1)) - COPY(old_offset, coordinate_system[active_coordinate_system]); - if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1)) - COPY(new_offset, coordinate_system[_new]); - active_coordinate_system = _new; - LOOP_XYZ(i) { - const float diff = new_offset[i] - old_offset[i]; - if (diff) { - position_shift[i] += diff; - update_software_endstops((AxisEnum)i); - } - } - return true; - } +#include "../../module/stepper.h" - /** - * G53: Apply native workspace to the current move - * - * In CNC G-code G53 is a modifier. - * It precedes a movement command (or other modifiers) on the same line. - * This is the first command to use parser.chain() to make this possible. - * - * Marlin also uses G53 on a line by itself to go back to native space. - */ - inline void gcode_G53() { - const int8_t _system = active_coordinate_system; - active_coordinate_system = -1; - if (parser.chain()) { // If this command has more following... - process_parsed_command(); - active_coordinate_system = _system; +/** + * Select a coordinate system and update the workspace offset. + * System index -1 is used to specify machine-native. + */ +bool GcodeSuite::select_coordinate_system(const int8_t _new) { + if (active_coordinate_system == _new) return false; + stepper.synchronize(); + float old_offset[XYZ] = { 0 }, new_offset[XYZ] = { 0 }; + if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1)) + COPY(old_offset, coordinate_system[active_coordinate_system]); + if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1)) + COPY(new_offset, coordinate_system[_new]); + active_coordinate_system = _new; + LOOP_XYZ(i) { + const float diff = new_offset[i] - old_offset[i]; + if (diff) { + position_shift[i] += diff; + update_software_endstops((AxisEnum)i); } } + return true; +} - /** - * G54-G59.3: Select a new workspace - * - * A workspace is an XYZ offset to the machine native space. - * All workspaces default to 0,0,0 at start, or with EEPROM - * support they may be restored from a previous session. - * - * G92 is used to set the current workspace's offset. - */ - void G54_59(uint8_t subcode=0) { - const int8_t _space = parser.codenum - 54 + subcode; - if (gcode.select_coordinate_system(_space)) { - SERIAL_PROTOCOLLNPAIR("Select workspace ", _space); - report_current_position(); - } +/** + * G53: Apply native workspace to the current move + * + * In CNC G-code G53 is a modifier. + * It precedes a movement command (or other modifiers) on the same line. + * This is the first command to use parser.chain() to make this possible. + * + * Marlin also uses G53 on a line by itself to go back to native space. + */ +inline void GcodeSuite::G53() { + const int8_t _system = active_coordinate_system; + active_coordinate_system = -1; + if (parser.chain()) { // If this command has more following... + process_parsed_command(); + active_coordinate_system = _system; } - void GcodeSuite::G54() { G54_59(); } - void GcodeSuite::G55() { G54_59(); } - void GcodeSuite::G56() { G54_59(); } - void GcodeSuite::G57() { G54_59(); } - void GcodeSuite::G58() { G54_59(); } - void GcodeSuite::G59() { G54_59(parser.subcode); } +} + +/** + * G54-G59.3: Select a new workspace + * + * A workspace is an XYZ offset to the machine native space. + * All workspaces default to 0,0,0 at start, or with EEPROM + * support they may be restored from a previous session. + * + * G92 is used to set the current workspace's offset. + */ +void G54_59(uint8_t subcode=0) { + const int8_t _space = parser.codenum - 54 + subcode; + if (gcode.select_coordinate_system(_space)) { + SERIAL_PROTOCOLLNPAIR("Select workspace ", _space); + report_current_position(); + } +} +void GcodeSuite::G54() { G54_59(); } +void GcodeSuite::G55() { G54_59(); } +void GcodeSuite::G56() { G54_59(); } +void GcodeSuite::G57() { G54_59(); } +void GcodeSuite::G58() { G54_59(); } +void GcodeSuite::G59() { G54_59(parser.subcode); } #endif // CNC_COORDINATE_SYSTEMS diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 413ce35a23..e99d0768e1 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -851,7 +851,7 @@ void MarlinSettings::postprocess() { _FIELD_TEST(coordinate_system); #if ENABLED(CNC_COORDINATE_SYSTEMS) - EEPROM_WRITE(coordinate_system); // 27 floats + EEPROM_WRITE(gcode.coordinate_system); // 27 floats #else dummy = 0.0f; for (uint8_t q = MAX_COORDINATE_SYSTEMS * XYZ; q--;) EEPROM_WRITE(dummy);