Browse Source

Merge pull request #8256 from thinkyhead/bf2_cnc_coordinate_sys

[2.0.x] CNC_COORDINATE_SYSTEMS
Scott Lahteine 7 years ago
parent
commit
7de8a66780
No account linked to committer's email address
51 changed files with 691 additions and 98 deletions
  1. 5
    10
      .travis.yml
  2. 8
    0
      Marlin/Configuration_adv.h
  3. 4
    0
      Marlin/src/Marlin.cpp
  4. 8
    0
      Marlin/src/config/default/Configuration_adv.h
  5. 8
    0
      Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
  6. 8
    0
      Marlin/src/config/examples/Anet/A6/Configuration_adv.h
  7. 8
    0
      Marlin/src/config/examples/Anet/A8/Configuration_adv.h
  8. 8
    0
      Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h
  9. 8
    0
      Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
  10. 8
    0
      Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
  11. 8
    0
      Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
  12. 8
    0
      Marlin/src/config/examples/Cartesio/Configuration_adv.h
  13. 8
    0
      Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
  14. 8
    0
      Marlin/src/config/examples/Felix/Configuration_adv.h
  15. 8
    0
      Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
  16. 8
    0
      Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
  17. 8
    0
      Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
  18. 8
    0
      Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
  19. 8
    0
      Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
  20. 8
    0
      Marlin/src/config/examples/RigidBot/Configuration_adv.h
  21. 8
    0
      Marlin/src/config/examples/SCARA/Configuration_adv.h
  22. 8
    0
      Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
  23. 8
    0
      Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
  24. 8
    0
      Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
  25. 8
    0
      Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
  26. 8
    0
      Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
  27. 8
    0
      Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
  28. 8
    0
      Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
  29. 8
    0
      Marlin/src/config/examples/delta/generic/Configuration_adv.h
  30. 8
    0
      Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
  31. 8
    0
      Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h
  32. 8
    0
      Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
  33. 8
    0
      Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
  34. 8
    0
      Marlin/src/config/examples/makibox/Configuration_adv.h
  35. 8
    0
      Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
  36. 8
    0
      Marlin/src/config/examples/wt150/Configuration_adv.h
  37. 2
    15
      Marlin/src/feature/I2CPositionEncoder.h
  38. 55
    0
      Marlin/src/feature/fanmux.cpp
  39. 33
    0
      Marlin/src/feature/fanmux.h
  40. 18
    11
      Marlin/src/gcode/calibrate/G33.cpp
  41. 28
    17
      Marlin/src/gcode/gcode.cpp
  42. 19
    0
      Marlin/src/gcode/gcode.h
  43. 93
    0
      Marlin/src/gcode/geometry/G53-G59.cpp
  44. 31
    6
      Marlin/src/gcode/geometry/G92.cpp
  45. 20
    0
      Marlin/src/gcode/parser.cpp
  46. 5
    0
      Marlin/src/gcode/parser.h
  47. 1
    1
      Marlin/src/inc/Conditionals_post.h
  48. 4
    0
      Marlin/src/inc/SanityCheck.h
  49. 97
    10
      Marlin/src/module/configuration_store.cpp
  50. 0
    4
      Marlin/src/module/motion.cpp
  51. 4
    24
      Marlin/src/module/tool_change.cpp

+ 5
- 10
.travis.yml View File

@@ -59,18 +59,14 @@ script:
59 59
   - opt_set TEMP_SENSOR_0 -2
60 60
   - opt_set TEMP_SENSOR_1 1
61 61
   - opt_set TEMP_SENSOR_BED 1
62
-  - opt_enable PIDTEMPBED Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES
62
+  - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS
63 63
   - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS
64 64
   - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED
65
-  - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
66
-
67
-  #
68
-  # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE
69
-  #
70
-  - opt_enable AUTO_BED_LEVELING_LINEAR BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE
65
+  - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE
71 66
   - opt_enable_adv FWRETRACT MAX7219_DEBUG
72 67
   - opt_set ABL_GRID_POINTS_X 16
73 68
   - opt_set ABL_GRID_POINTS_Y 16
69
+  - opt_set_adv FANMUX0_PIN 53
74 70
   - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
75 71
   #
76 72
   # Test a probeless build of AUTO_BED_LEVELING_UBL
@@ -80,10 +76,9 @@ script:
80 76
   - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING
81 77
   - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
82 78
   #
83
-  # ...and with a probe
79
+  # And with a probe...
84 80
   #
85
-  - opt_enable BLTOUCH
86
-  - opt_enable_adv BABYSTEP_ZPROBE_OFFSET
81
+  - opt_enable FIX_MOUNTED_PROBE
87 82
   - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
88 83
   #
89 84
   # Test a Sled Z Probe

+ 8
- 0
Marlin/Configuration_adv.h View File

@@ -1258,6 +1258,14 @@
1258 1258
 #endif
1259 1259
 
1260 1260
 /**
1261
+ * CNC Coordinate Systems
1262
+ *
1263
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1264
+ * and G92.1 to reset the workspace to native machine space.
1265
+ */
1266
+//#define CNC_COORDINATE_SYSTEMS
1267
+
1268
+/**
1261 1269
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1262 1270
  */
1263 1271
 //#define PINS_DEBUGGING

+ 4
- 0
Marlin/src/Marlin.cpp View File

@@ -138,6 +138,10 @@
138 138
   #include "feature/caselight.h"
139 139
 #endif
140 140
 
141
+#if HAS_FANMUX
142
+  #include "feature/fanmux.h"
143
+#endif
144
+
141 145
 #if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
142 146
   #include "module/tool_change.h"
143 147
 #endif

+ 8
- 0
Marlin/src/config/default/Configuration_adv.h View File

@@ -1281,6 +1281,14 @@
1281 1281
 #endif
1282 1282
 
1283 1283
 /**
1284
+ * CNC Coordinate Systems
1285
+ *
1286
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1287
+ * and G92.1 to reset the workspace to native machine space.
1288
+ */
1289
+//#define CNC_COORDINATE_SYSTEMS
1290
+
1291
+/**
1284 1292
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1285 1293
  */
1286 1294
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Anet/A6/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Anet/A8/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h View File

@@ -1258,6 +1258,14 @@
1258 1258
 #endif
1259 1259
 
1260 1260
 /**
1261
+ * CNC Coordinate Systems
1262
+ *
1263
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1264
+ * and G92.1 to reset the workspace to native machine space.
1265
+ */
1266
+//#define CNC_COORDINATE_SYSTEMS
1267
+
1268
+/**
1261 1269
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1262 1270
  */
1263 1271
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h View File

@@ -1277,6 +1277,14 @@
1277 1277
 #endif
1278 1278
 
1279 1279
 /**
1280
+ * CNC Coordinate Systems
1281
+ *
1282
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1283
+ * and G92.1 to reset the workspace to native machine space.
1284
+ */
1285
+//#define CNC_COORDINATE_SYSTEMS
1286
+
1287
+/**
1280 1288
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1281 1289
  */
1282 1290
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Cartesio/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Felix/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h View File

@@ -1281,6 +1281,14 @@
1281 1281
 #endif
1282 1282
 
1283 1283
 /**
1284
+ * CNC Coordinate Systems
1285
+ *
1286
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1287
+ * and G92.1 to reset the workspace to native machine space.
1288
+ */
1289
+//#define CNC_COORDINATE_SYSTEMS
1290
+
1291
+/**
1284 1292
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1285 1293
  */
1286 1294
 #define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Malyan/M150/Configuration_adv.h View File

@@ -1274,6 +1274,14 @@
1274 1274
 #endif
1275 1275
 
1276 1276
 /**
1277
+ * CNC Coordinate Systems
1278
+ *
1279
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1280
+ * and G92.1 to reset the workspace to native machine space.
1281
+ */
1282
+//#define CNC_COORDINATE_SYSTEMS
1283
+
1284
+/**
1277 1285
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1278 1286
  */
1279 1287
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h View File

@@ -1284,6 +1284,14 @@
1284 1284
 #endif
1285 1285
 
1286 1286
 /**
1287
+ * CNC Coordinate Systems
1288
+ *
1289
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1290
+ * and G92.1 to reset the workspace to native machine space.
1291
+ */
1292
+//#define CNC_COORDINATE_SYSTEMS
1293
+
1294
+/**
1287 1295
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1288 1296
  */
1289 1297
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h View File

@@ -1302,6 +1302,14 @@
1302 1302
 #endif
1303 1303
 
1304 1304
 /**
1305
+ * CNC Coordinate Systems
1306
+ *
1307
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1308
+ * and G92.1 to reset the workspace to native machine space.
1309
+ */
1310
+//#define CNC_COORDINATE_SYSTEMS
1311
+
1312
+/**
1305 1313
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1306 1314
  */
1307 1315
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/RigidBot/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/SCARA/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Sanguinololu/Configuration_adv.h View File

@@ -1269,6 +1269,14 @@
1269 1269
 #endif
1270 1270
 
1271 1271
 /**
1272
+ * CNC Coordinate Systems
1273
+ *
1274
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1275
+ * and G92.1 to reset the workspace to native machine space.
1276
+ */
1277
+//#define CNC_COORDINATE_SYSTEMS
1278
+
1279
+/**
1272 1280
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1273 1281
  */
1274 1282
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/TinyBoy2/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h View File

@@ -1258,6 +1258,14 @@
1258 1258
 #endif
1259 1259
 
1260 1260
 /**
1261
+ * CNC Coordinate Systems
1262
+ *
1263
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1264
+ * and G92.1 to reset the workspace to native machine space.
1265
+ */
1266
+//#define CNC_COORDINATE_SYSTEMS
1267
+
1268
+/**
1261 1269
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1262 1270
  */
1263 1271
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h View File

@@ -1288,6 +1288,14 @@
1288 1288
 #endif
1289 1289
 
1290 1290
 /**
1291
+ * CNC Coordinate Systems
1292
+ *
1293
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1294
+ * and G92.1 to reset the workspace to native machine space.
1295
+ */
1296
+//#define CNC_COORDINATE_SYSTEMS
1297
+
1298
+/**
1291 1299
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1292 1300
  */
1293 1301
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h View File

@@ -1281,6 +1281,14 @@
1281 1281
 #endif
1282 1282
 
1283 1283
 /**
1284
+ * CNC Coordinate Systems
1285
+ *
1286
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1287
+ * and G92.1 to reset the workspace to native machine space.
1288
+ */
1289
+//#define CNC_COORDINATE_SYSTEMS
1290
+
1291
+/**
1284 1292
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1285 1293
  */
1286 1294
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -1282,6 +1282,14 @@
1282 1282
 #endif
1283 1283
 
1284 1284
 /**
1285
+ * CNC Coordinate Systems
1286
+ *
1287
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1288
+ * and G92.1 to reset the workspace to native machine space.
1289
+ */
1290
+//#define CNC_COORDINATE_SYSTEMS
1291
+
1292
+/**
1285 1293
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1286 1294
  */
1287 1295
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -1282,6 +1282,14 @@
1282 1282
 #endif
1283 1283
 
1284 1284
 /**
1285
+ * CNC Coordinate Systems
1286
+ *
1287
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1288
+ * and G92.1 to reset the workspace to native machine space.
1289
+ */
1290
+//#define CNC_COORDINATE_SYSTEMS
1291
+
1292
+/**
1285 1293
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1286 1294
  */
1287 1295
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/delta/generic/Configuration_adv.h View File

@@ -1282,6 +1282,14 @@
1282 1282
 #endif
1283 1283
 
1284 1284
 /**
1285
+ * CNC Coordinate Systems
1286
+ *
1287
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1288
+ * and G92.1 to reset the workspace to native machine space.
1289
+ */
1290
+//#define CNC_COORDINATE_SYSTEMS
1291
+
1292
+/**
1285 1293
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1286 1294
  */
1287 1295
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h View File

@@ -1282,6 +1282,14 @@
1282 1282
 #endif
1283 1283
 
1284 1284
 /**
1285
+ * CNC Coordinate Systems
1286
+ *
1287
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1288
+ * and G92.1 to reset the workspace to native machine space.
1289
+ */
1290
+//#define CNC_COORDINATE_SYSTEMS
1291
+
1292
+/**
1285 1293
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1286 1294
  */
1287 1295
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h View File

@@ -1287,6 +1287,14 @@
1287 1287
 #endif
1288 1288
 
1289 1289
 /**
1290
+ * CNC Coordinate Systems
1291
+ *
1292
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1293
+ * and G92.1 to reset the workspace to native machine space.
1294
+ */
1295
+//#define CNC_COORDINATE_SYSTEMS
1296
+
1297
+/**
1290 1298
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1291 1299
  */
1292 1300
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h View File

@@ -1282,6 +1282,14 @@
1282 1282
 #endif
1283 1283
 
1284 1284
 /**
1285
+ * CNC Coordinate Systems
1286
+ *
1287
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1288
+ * and G92.1 to reset the workspace to native machine space.
1289
+ */
1290
+//#define CNC_COORDINATE_SYSTEMS
1291
+
1292
+/**
1285 1293
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1286 1294
  */
1287 1295
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/makibox/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h View File

@@ -1280,6 +1280,14 @@
1280 1280
 #endif
1281 1281
 
1282 1282
 /**
1283
+ * CNC Coordinate Systems
1284
+ *
1285
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1286
+ * and G92.1 to reset the workspace to native machine space.
1287
+ */
1288
+//#define CNC_COORDINATE_SYSTEMS
1289
+
1290
+/**
1283 1291
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1284 1292
  */
1285 1293
 //#define PINS_DEBUGGING

+ 8
- 0
Marlin/src/config/examples/wt150/Configuration_adv.h View File

@@ -1281,6 +1281,14 @@
1281 1281
 #endif
1282 1282
 
1283 1283
 /**
1284
+ * CNC Coordinate Systems
1285
+ *
1286
+ * Enables G53 and G54-G59.3 commands to select coordinate systems
1287
+ * and G92.1 to reset the workspace to native machine space.
1288
+ */
1289
+//#define CNC_COORDINATE_SYSTEMS
1290
+
1291
+/**
1284 1292
  * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
1285 1293
  */
1286 1294
 //#define PINS_DEBUGGING

+ 2
- 15
Marlin/src/feature/I2CPositionEncoder.h View File

@@ -124,10 +124,7 @@ class I2CPositionEncoder {
124 124
               invert              = false,
125 125
               ec                  = true;
126 126
 
127
-    float     axisOffset          = 0;
128
-
129
-    int32_t   axisOffsetTicks     = 0,
130
-              zeroOffset          = 0,
127
+    int32_t   zeroOffset          = 0,
131 128
               lastPosition        = 0,
132 129
               position;
133 130
 
@@ -165,7 +162,7 @@ class I2CPositionEncoder {
165 162
     }
166 163
 
167 164
     FORCE_INLINE float get_position_mm() { return mm_from_count(get_position()); }
168
-    FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset - axisOffsetTicks; }
165
+    FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset; }
169 166
 
170 167
     int32_t get_axis_error_steps(const bool report);
171 168
     float get_axis_error_mm(const bool report);
@@ -216,16 +213,6 @@ class I2CPositionEncoder {
216 213
 
217 214
     FORCE_INLINE int get_stepper_ticks() { return stepperTicks; }
218 215
     FORCE_INLINE void set_stepper_ticks(const int ticks) { stepperTicks = ticks; }
219
-
220
-    FORCE_INLINE float get_axis_offset() { return axisOffset; }
221
-    FORCE_INLINE void set_axis_offset(const float newOffset) {
222
-      axisOffset = newOffset;
223
-      axisOffsetTicks = int32_t(axisOffset * get_encoder_ticks_mm());
224
-    }
225
-
226
-    FORCE_INLINE void set_current_position(const float newPositionMm) {
227
-      set_axis_offset(get_position_mm() - newPositionMm + axisOffset);
228
-    }
229 216
 };
230 217
 
231 218
 class I2CPositionEncodersMgr {

+ 55
- 0
Marlin/src/feature/fanmux.cpp View File

@@ -0,0 +1,55 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * feature/pause.cpp - Pause feature support functions
25
+ * This may be combined with related G-codes if features are consolidated.
26
+ */
27
+
28
+#include "../inc/MarlinConfig.h"
29
+
30
+#if HAS_FANMUX
31
+
32
+#include "fanmux.h"
33
+
34
+void fanmux_switch(const uint8_t e) {
35
+  WRITE(FANMUX0_PIN, TEST(e, 0) ? HIGH : LOW);
36
+  #if PIN_EXISTS(FANMUX1)
37
+    WRITE(FANMUX1_PIN, TEST(e, 1) ? HIGH : LOW);
38
+    #if PIN_EXISTS(FANMUX2)
39
+      WRITE(FANMUX2, TEST(e, 2) ? HIGH : LOW);
40
+    #endif
41
+  #endif
42
+}
43
+
44
+void fanmux_init(void) {
45
+  SET_OUTPUT(FANMUX0_PIN);
46
+  #if PIN_EXISTS(FANMUX1)
47
+    SET_OUTPUT(FANMUX1_PIN);
48
+    #if PIN_EXISTS(FANMUX2)
49
+      SET_OUTPUT(FANMUX2_PIN);
50
+    #endif
51
+  #endif
52
+  fanmux_switch(0);
53
+}
54
+
55
+#endif // HAS_FANMUX

+ 33
- 0
Marlin/src/feature/fanmux.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * feature/fanmux.h - Cooling Fan Multiplexer support functions
25
+ */
26
+
27
+#ifndef _FANMUX_H_
28
+#define _FANMUX_H_
29
+
30
+extern void fanmux_switch(const uint8_t e);
31
+extern void fanmux_init(void);
32
+
33
+#endif // _FANMUX_H_

+ 18
- 11
Marlin/src/gcode/calibrate/G33.cpp View File

@@ -30,9 +30,12 @@
30 30
 #include "../../module/motion.h"
31 31
 #include "../../module/stepper.h"
32 32
 #include "../../module/endstops.h"
33
-#include "../../module/tool_change.h"
34 33
 #include "../../lcd/ultralcd.h"
35 34
 
35
+#if HOTENDS > 1
36
+  #include "../../module/tool_change.h"
37
+#endif
38
+
36 39
 #if HAS_LEVELING
37 40
   #include "../../feature/bedlevel/bedlevel.h"
38 41
 #endif
@@ -160,11 +163,13 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points,
160 163
   if (!_0p_calibration) {
161 164
 
162 165
     if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
163
-      #if ENABLED(PROBE_MANUALLY)
164
-        z_at_pt[CEN] += lcd_probe_pt(0, 0);
165
-      #else
166
-        z_at_pt[CEN] += probe_pt(dx, dy, stow_after_each, 1, false);
167
-      #endif
166
+      z_at_pt[CEN] +=
167
+        #if ENABLED(PROBE_MANUALLY)
168
+          lcd_probe_pt(0, 0)
169
+        #else
170
+          probe_pt(dx, dy, stow_after_each, 1, false)
171
+        #endif
172
+      ;
168 173
     }
169 174
 
170 175
     if (_7p_calibration) { // probe extra center points
@@ -173,11 +178,13 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points,
173 178
       I_LOOP_CAL_PT(axis, start, steps) {
174 179
         const float a = RADIANS(210 + (360 / NPP) *  (axis - 1)),
175 180
                     r = delta_calibration_radius * 0.1;
176
-        #if ENABLED(PROBE_MANUALLY)
177
-          z_at_pt[CEN] += lcd_probe_pt(cos(a) * r, sin(a) * r);
178
-        #else
179
-          z_at_pt[CEN] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
180
-        #endif
181
+        z_at_pt[CEN] +=
182
+          #if ENABLED(PROBE_MANUALLY)
183
+            lcd_probe_pt(cos(a) * r, sin(a) * r)
184
+          #else
185
+            probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1)
186
+          #endif
187
+        ;
181 188
       }
182 189
       z_at_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
183 190
     }

+ 28
- 17
Marlin/src/gcode/gcode.cpp View File

@@ -56,6 +56,11 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
56 56
   GcodeSuite::WorkspacePlane GcodeSuite::workspace_plane = PLANE_XY;
57 57
 #endif
58 58
 
59
+#if ENABLED(CNC_COORDINATE_SYSTEMS)
60
+  int8_t GcodeSuite::active_coordinate_system = -1; // machine space
61
+  float GcodeSuite::coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ];
62
+#endif
63
+
59 64
 /**
60 65
  * Set target_extruder from the T parameter or the active_extruder
61 66
  *
@@ -125,26 +130,11 @@ void GcodeSuite::dwell(millis_t time) {
125 130
 #endif
126 131
 
127 132
 /**
128
- * Process a single command and dispatch it to its handler
129
- * This is called from the main loop()
133
+ * Process the parsed command and dispatch it to its handler
130 134
  */
131
-void GcodeSuite::process_next_command() {
132
-  char * const current_command = command_queue[cmd_queue_index_r];
133
-
134
-  if (DEBUGGING(ECHO)) {
135
-    SERIAL_ECHO_START();
136
-    SERIAL_ECHOLN(current_command);
137
-    #if ENABLED(M100_FREE_MEMORY_WATCHER)
138
-      SERIAL_ECHOPAIR("slot:", cmd_queue_index_r);
139
-      M100_dump_routine("   Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue)));
140
-    #endif
141
-  }
142
-
135
+void GcodeSuite::process_parsed_command() {
143 136
   KEEPALIVE_STATE(IN_HANDLER);
144 137
 
145
-  // Parse the next command in the queue
146
-  parser.parse(current_command);
147
-
148 138
   // Handle a known G, M, or T
149 139
   switch (parser.command_letter) {
150 140
     case 'G': switch (parser.codenum) {
@@ -711,6 +701,27 @@ void GcodeSuite::process_next_command() {
711 701
   ok_to_send();
712 702
 }
713 703
 
704
+/**
705
+ * Process a single command and dispatch it to its handler
706
+ * This is called from the main loop()
707
+ */
708
+void GcodeSuite::process_next_command() {
709
+  char * const current_command = command_queue[cmd_queue_index_r];
710
+
711
+  if (DEBUGGING(ECHO)) {
712
+    SERIAL_ECHO_START();
713
+    SERIAL_ECHOLN(current_command);
714
+    #if ENABLED(M100_FREE_MEMORY_WATCHER)
715
+      SERIAL_ECHOPAIR("slot:", cmd_queue_index_r);
716
+      M100_dump_routine("   Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue)));
717
+    #endif
718
+  }
719
+
720
+  // Parse the next command in the queue
721
+  parser.parse(current_command);
722
+  process_parsed_command();
723
+}
724
+
714 725
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
715 726
 
716 727
   /**

+ 19
- 0
Marlin/src/gcode/gcode.h View File

@@ -266,11 +266,19 @@ public:
266 266
     static WorkspacePlane workspace_plane;
267 267
   #endif
268 268
 
269
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
270
+    #define MAX_COORDINATE_SYSTEMS 9
271
+    static int8_t active_coordinate_system;
272
+    static float coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ];
273
+    static bool select_coordinate_system(const int8_t _new);
274
+  #endif
275
+
269 276
   static millis_t previous_cmd_ms;
270 277
   FORCE_INLINE static void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
271 278
 
272 279
   static bool get_target_extruder_from_command();
273 280
   static void get_destination_from_command();
281
+  static void process_parsed_command();
274 282
   static void process_next_command();
275 283
 
276 284
   static FORCE_INLINE void home_all_axes() { G28(true); }
@@ -383,6 +391,17 @@ private:
383 391
     static void G42();
384 392
   #endif
385 393
 
394
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
395
+    bool select_coordinate_system(const int8_t _new);
396
+    static void G53();
397
+    static void G54();
398
+    static void G55();
399
+    static void G56();
400
+    static void G57();
401
+    static void G58();
402
+    static void G59();
403
+  #endif
404
+
386 405
   static void G92();
387 406
 
388 407
   #if HAS_RESUME_CONTINUE

+ 93
- 0
Marlin/src/gcode/geometry/G53-G59.cpp View File

@@ -0,0 +1,93 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../gcode.h"
24
+#include "../../module/motion.h"
25
+//#include "../../module/stepper.h"
26
+
27
+#if ENABLED(CNC_COORDINATE_SYSTEMS)
28
+
29
+  /**
30
+   * Select a coordinate system and update the current position.
31
+   * System index -1 is used to specify machine-native.
32
+   */
33
+  bool GCodeSuite::select_coordinate_system(const int8_t _new) {
34
+    if (active_coordinate_system == _new) return false;
35
+    stepper.synchronize();
36
+    float old_offset[XYZ] = { 0 }, new_offset[XYZ] = { 0 };
37
+    if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
38
+      COPY(old_offset, coordinate_system[active_coordinate_system]);
39
+    if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
40
+      COPY(new_offset, coordinate_system[_new]);
41
+    active_coordinate_system = _new;
42
+    bool didXYZ = false;
43
+    LOOP_XYZ(i) {
44
+      const float diff = new_offset[i] - old_offset[i];
45
+      if (diff) {
46
+        position_shift[i] += diff;
47
+        update_software_endstops((AxisEnum)i);
48
+        didXYZ = true;
49
+      }
50
+    }
51
+    if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC();
52
+    return true;
53
+  }
54
+
55
+  /**
56
+   * In CNC G-code G53 is like a modifier
57
+   * It precedes a movement command (or other modifiers) on the same line.
58
+   * This is the first command to use parser.chain() to make this possible.
59
+   */
60
+  void GCodeSuite::G53() {
61
+    // If this command has more following...
62
+    if (parser.chain()) {
63
+      const int8_t _system = active_coordinate_system;
64
+      active_coordinate_system = -1;
65
+      process_parsed_command();
66
+      active_coordinate_system = _system;
67
+    }
68
+  }
69
+
70
+  /**
71
+   * G54-G59.3: Select a new workspace
72
+   *
73
+   * A workspace is an XYZ offset to the machine native space.
74
+   * All workspaces default to 0,0,0 at start, or with EEPROM
75
+   * support they may be restored from a previous session.
76
+   *
77
+   * G92 is used to set the current workspace's offset.
78
+   */
79
+  void G54_59(uint8_t subcode=0) {
80
+    const int8_t _space = parser.codenum - 54 + subcode;
81
+    if (gcode.select_coordinate_system(_space)) {
82
+      SERIAL_PROTOCOLLNPAIR("Select workspace ", _space);
83
+      report_current_position();
84
+    }
85
+  }
86
+  void GCodeSuite::G54() { G54_59(); }
87
+  void GCodeSuite::G55() { G54_59(); }
88
+  void GCodeSuite::G56() { G54_59(); }
89
+  void GCodeSuite::G57() { G54_59(); }
90
+  void GCodeSuite::G58() { G54_59(); }
91
+  void GCodeSuite::G59() { G54_59(parser.subcode); }
92
+
93
+#endif // CNC_COORDINATE_SYSTEMS

+ 31
- 6
Marlin/src/gcode/geometry/G92.cpp View File

@@ -37,7 +37,30 @@ void GcodeSuite::G92() {
37 37
 
38 38
   if (!didE) stepper.synchronize();
39 39
 
40
-  LOOP_XYZE(i) {
40
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
41
+    switch (parser.subcode) {
42
+      case 1:
43
+        // Zero the G92 values and restore current position
44
+        #if !IS_SCARA
45
+          LOOP_XYZ(i) {
46
+            const float v = position_shift[i];
47
+            if (v) {
48
+              position_shift[i] = 0;
49
+              update_software_endstops((AxisEnum)i);
50
+            }
51
+          }
52
+        #endif // Not SCARA
53
+        return;
54
+    }
55
+  #endif
56
+
57
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
58
+    #define IS_G92_0 (parser.subcode == 0)
59
+  #else
60
+    #define IS_G92_0 true
61
+  #endif
62
+
63
+  if (IS_G92_0) LOOP_XYZE(i) {
41 64
     if (parser.seenval(axis_codes[i])) {
42 65
       #if IS_SCARA
43 66
         current_position[i] = parser.value_axis_units((AxisEnum)i);
@@ -55,16 +78,18 @@ void GcodeSuite::G92() {
55 78
           #if HAS_POSITION_SHIFT
56 79
             position_shift[i] += v - p; // Offset the coordinate space
57 80
             update_software_endstops((AxisEnum)i);
58
-
59
-            #if ENABLED(I2C_POSITION_ENCODERS)
60
-              I2CPEM.encoders[I2CPEM.idx_from_axis((AxisEnum)i)].set_axis_offset(position_shift[i]);
61
-            #endif
62
-
63 81
           #endif
64 82
         }
65 83
       #endif
66 84
     }
67 85
   }
86
+
87
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
88
+    // Apply workspace offset to the active coordinate system
89
+    if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
90
+      COPY(coordinate_system[active_coordinate_system], position_shift);
91
+  #endif
92
+
68 93
   if (didXYZ)
69 94
     SYNC_PLAN_POSITION_KINEMATIC();
70 95
   else if (didE)

+ 20
- 0
Marlin/src/gcode/parser.cpp View File

@@ -233,6 +233,26 @@ void GCodeParser::parse(char *p) {
233 233
   }
234 234
 }
235 235
 
236
+#if ENABLED(CNC_COORDINATE_SYSTEMS)
237
+
238
+  // Parse the next parameter as a new command
239
+  bool GCodeParser::chain() {
240
+    #if ENABLED(FASTER_GCODE_PARSER)
241
+      char *next_command = command_ptr;
242
+      if (next_command) {
243
+        while (*next_command && *next_command != ' ') ++next_command;
244
+        while (*next_command == ' ') ++next_command;
245
+        if (!*next_command) next_command = NULL;
246
+      }
247
+    #else
248
+      const char *next_command = command_args;
249
+    #endif
250
+    if (next_command) parse(next_command);
251
+    return !!next_command;
252
+  }
253
+
254
+#endif // CNC_COORDINATE_SYSTEMS
255
+
236 256
 void GCodeParser::unknown_command_error() {
237 257
   SERIAL_ECHO_START();
238 258
   SERIAL_ECHOPAIR(MSG_UNKNOWN_COMMAND, command_ptr);

+ 5
- 0
Marlin/src/gcode/parser.h View File

@@ -156,6 +156,11 @@ public:
156 156
   // This uses 54 bytes of SRAM to speed up seen/value
157 157
   static void parse(char * p);
158 158
 
159
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
160
+    // Parse the next parameter as a new command
161
+    static bool chain();
162
+  #endif
163
+
159 164
   // The code value pointer was set
160 165
   FORCE_INLINE static bool has_value() { return value_ptr != NULL; }
161 166
 

+ 1
- 1
Marlin/src/inc/Conditionals_post.h View File

@@ -1112,7 +1112,7 @@
1112 1112
 #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
1113 1113
 
1114 1114
 // Add commands that need sub-codes to this list
1115
-#define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET)
1115
+#define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) || ENABLED(CNC_COORDINATE_SYSTEMS)
1116 1116
 
1117 1117
 // MESH_BED_LEVELING overrides PROBE_MANUALLY
1118 1118
 #if ENABLED(MESH_BED_LEVELING)

+ 4
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -1450,6 +1450,10 @@ static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has to
1450 1450
 static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements.");
1451 1451
 static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements.");
1452 1452
 
1453
+#if ENABLED(CNC_COORDINATE_SYSTEMS) && ENABLED(NO_WORKSPACE_OFFSETS)
1454
+  #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS."
1455
+#endif
1456
+
1453 1457
 #include "../HAL/HAL_SanityCheck.h"  // get CPU specific checks
1454 1458
 
1455 1459
 #endif // _SANITYCHECK_H_

+ 97
- 10
Marlin/src/module/configuration_store.cpp View File

@@ -36,13 +36,13 @@
36 36
  *
37 37
  */
38 38
 
39
-#define EEPROM_VERSION "V43"
39
+#define EEPROM_VERSION "V44"
40 40
 
41 41
 // Change EEPROM version if these are changed:
42 42
 #define EEPROM_OFFSET 100
43 43
 
44 44
 /**
45
- * V43 EEPROM Layout:
45
+ * V44 EEPROM Layout:
46 46
  *
47 47
  *  100  Version                                    (char x4)
48 48
  *  104  EEPROM CRC16                               (uint16_t)
@@ -162,8 +162,11 @@
162 162
  *  588  M907 Z    Stepper Z current                (uint32_t)
163 163
  *  592  M907 E    Stepper E current                (uint32_t)
164 164
  *
165
- *  596                                Minimum end-point
166
- * 1917 (596 + 36 + 9 + 288 + 988)     Maximum end-point
165
+ * CNC_COORDINATE_SYSTEMS                           108 bytes
166
+ *  596  G54-G59.3 coordinate_system                (float x 27)
167
+ *
168
+ *  704                                Minimum end-point
169
+ * 2025 (704 + 36 + 9 + 288 + 988)     Maximum end-point
167 170
  *
168 171
  * ========================================================================
169 172
  * meshes_begin (between max and min end-point, directly above)
@@ -207,6 +210,10 @@ MarlinSettings settings;
207 210
   float new_z_fade_height;
208 211
 #endif
209 212
 
213
+#if ENABLED(CNC_COORDINATE_SYSTEMS)
214
+  bool position_changed;
215
+#endif
216
+
210 217
 /**
211 218
  * Post-process after Retrieve or Reset
212 219
  */
@@ -255,6 +262,13 @@ void MarlinSettings::postprocess() {
255 262
   #if ENABLED(FWRETRACT)
256 263
     fwretract.refresh_autoretract();
257 264
   #endif
265
+
266
+  #if ENABLED(CNC_COORDINATE_SYSTEMS)
267
+    if (position_changed) {
268
+      report_current_position();
269
+      position_changed = false;
270
+    }
271
+  #endif
258 272
 }
259 273
 
260 274
 #if ENABLED(EEPROM_SETTINGS)
@@ -292,7 +306,7 @@ void MarlinSettings::postprocess() {
292 306
     EEPROM_WRITE(ver);     // invalidate data first
293 307
     EEPROM_SKIP(working_crc); // Skip the checksum slot
294 308
 
295
-    working_crc = 0; // clear before first "real data"
309
+    working_crc = 0;  // Init to 0. Accumulated by EEPROM_READ
296 310
 
297 311
     const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ;
298 312
     EEPROM_WRITE(esteppers);
@@ -630,6 +644,13 @@ void MarlinSettings::postprocess() {
630 644
       for (uint8_t q = 3; q--;) EEPROM_WRITE(dummyui32);
631 645
     #endif
632 646
 
647
+    #if ENABLED(CNC_COORDINATE_SYSTEMS)
648
+      EEPROM_WRITE(coordinate_system); // 27 floats
649
+    #else
650
+      dummy = 0.0f;
651
+      for (uint8_t q = 27; q--;) EEPROM_WRITE(dummy);
652
+    #endif
653
+
633 654
     if (!eeprom_error) {
634 655
       #if ENABLED(EEPROM_CHITCHAT)
635 656
         const int eeprom_size = eeprom_index;
@@ -699,6 +720,10 @@ void MarlinSettings::postprocess() {
699 720
       uint8_t esteppers;
700 721
       EEPROM_READ(esteppers);
701 722
 
723
+      //
724
+      // Planner Motion
725
+      //
726
+
702 727
       // Get only the number of E stepper parameters previously stored
703 728
       // Any steppers added later are set to their defaults
704 729
       const float def1[] = DEFAULT_AXIS_STEPS_PER_UNIT, def2[] = DEFAULT_MAX_FEEDRATE;
@@ -722,6 +747,10 @@ void MarlinSettings::postprocess() {
722 747
       EEPROM_READ(planner.min_segment_time_us);
723 748
       EEPROM_READ(planner.max_jerk);
724 749
 
750
+      //
751
+      // Home Offset (M206)
752
+      //
753
+
725 754
       #if !HAS_HOME_OFFSET
726 755
         float home_offset[XYZ];
727 756
       #endif
@@ -733,6 +762,10 @@ void MarlinSettings::postprocess() {
733 762
         home_offset[Z_AXIS] -= DELTA_HEIGHT;
734 763
       #endif
735 764
 
765
+      //
766
+      // Hotend Offsets, if any
767
+      //
768
+
736 769
       #if HOTENDS > 1
737 770
         // Skip hotend 0 which must be 0
738 771
         for (uint8_t e = 1; e < HOTENDS; e++)
@@ -816,6 +849,10 @@ void MarlinSettings::postprocess() {
816 849
           for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy);
817 850
         }
818 851
 
852
+      //
853
+      // Unified Bed Leveling active state
854
+      //
855
+
819 856
       #if ENABLED(AUTO_BED_LEVELING_UBL)
820 857
         EEPROM_READ(planner.leveling_active);
821 858
         EEPROM_READ(ubl.storage_slot);
@@ -825,6 +862,10 @@ void MarlinSettings::postprocess() {
825 862
         EEPROM_READ(dummyui8);
826 863
       #endif // AUTO_BED_LEVELING_UBL
827 864
 
865
+      //
866
+      // DELTA Geometry or Dual Endstops offsets
867
+      //
868
+
828 869
       #if ENABLED(DELTA)
829 870
         EEPROM_READ(delta_endstop_adj);         // 3 floats
830 871
         EEPROM_READ(delta_radius);              // 1 float
@@ -861,19 +902,27 @@ void MarlinSettings::postprocess() {
861 902
 
862 903
       #endif
863 904
 
905
+      //
906
+      // LCD Preheat settings
907
+      //
908
+
864 909
       #if DISABLED(ULTIPANEL)
865 910
         int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
866 911
       #endif
867 912
 
868
-      EEPROM_READ(lcd_preheat_hotend_temp);
869
-      EEPROM_READ(lcd_preheat_bed_temp);
870
-      EEPROM_READ(lcd_preheat_fan_speed);
913
+      EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
914
+      EEPROM_READ(lcd_preheat_bed_temp);    // 2 floats
915
+      EEPROM_READ(lcd_preheat_fan_speed);   // 2 floats
871 916
 
872 917
       //EEPROM_ASSERT(
873 918
       //  WITHIN(lcd_preheat_fan_speed, 0, 255),
874 919
       //  "lcd_preheat_fan_speed out of range"
875 920
       //);
876 921
 
922
+      //
923
+      // Hotend PID
924
+      //
925
+
877 926
       #if ENABLED(PIDTEMP)
878 927
         for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
879 928
           EEPROM_READ(dummy); // Kp
@@ -897,11 +946,19 @@ void MarlinSettings::postprocess() {
897 946
         for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy);  // Kp, Ki, Kd, Kc
898 947
       #endif // !PIDTEMP
899 948
 
949
+      //
950
+      // PID Extrusion Scaling
951
+      //
952
+
900 953
       #if DISABLED(PID_EXTRUSION_SCALING)
901 954
         int lpq_len;
902 955
       #endif
903 956
       EEPROM_READ(lpq_len);
904 957
 
958
+      //
959
+      // Heated Bed PID
960
+      //
961
+
905 962
       #if ENABLED(PIDTEMPBED)
906 963
         EEPROM_READ(dummy); // bedKp
907 964
         if (dummy != DUMMY_PID_VALUE) {
@@ -913,11 +970,19 @@ void MarlinSettings::postprocess() {
913 970
         for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
914 971
       #endif
915 972
 
973
+      //
974
+      // LCD Contrast
975
+      //
976
+
916 977
       #if !HAS_LCD_CONTRAST
917 978
         uint16_t lcd_contrast;
918 979
       #endif
919 980
       EEPROM_READ(lcd_contrast);
920 981
 
982
+      //
983
+      // Firmware Retraction
984
+      //
985
+
921 986
       #if ENABLED(FWRETRACT)
922 987
         EEPROM_READ(fwretract.autoretract_enabled);
923 988
         EEPROM_READ(fwretract.retract_length);
@@ -933,13 +998,20 @@ void MarlinSettings::postprocess() {
933 998
         for (uint8_t q=8; q--;) EEPROM_READ(dummy);
934 999
       #endif
935 1000
 
936
-      EEPROM_READ(parser.volumetric_enabled);
1001
+      //
1002
+      // Volumetric & Filament Size
1003
+      //
937 1004
 
1005
+      EEPROM_READ(parser.volumetric_enabled);
938 1006
       for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
939 1007
         EEPROM_READ(dummy);
940 1008
         if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy;
941 1009
       }
942 1010
 
1011
+      //
1012
+      // TMC2130 Stepper Current
1013
+      //
1014
+
943 1015
       uint16_t val;
944 1016
       #if ENABLED(HAVE_TMC2130)
945 1017
         EEPROM_READ(val);
@@ -987,7 +1059,7 @@ void MarlinSettings::postprocess() {
987 1059
           stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
988 1060
         #endif
989 1061
       #else
990
-        for (uint8_t q = 0; q < 11; q++) EEPROM_READ(val);
1062
+        for (uint8_t q = 11; q--;) EEPROM_READ(val);
991 1063
       #endif
992 1064
 
993 1065
       //
@@ -1002,6 +1074,10 @@ void MarlinSettings::postprocess() {
1002 1074
         EEPROM_READ(dummy);
1003 1075
       #endif
1004 1076
 
1077
+      //
1078
+      // Motor Current PWM
1079
+      //
1080
+
1005 1081
       #if HAS_MOTOR_CURRENT_PWM
1006 1082
         for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
1007 1083
       #else
@@ -1009,6 +1085,17 @@ void MarlinSettings::postprocess() {
1009 1085
         for (uint8_t q = 3; q--;) EEPROM_READ(dummyui32);
1010 1086
       #endif
1011 1087
 
1088
+      //
1089
+      // CNC Coordinate System
1090
+      //
1091
+
1092
+      #if ENABLED(CNC_COORDINATE_SYSTEMS)
1093
+        position_changed = gcode.select_coordinate_system(-1); // Go back to machine space
1094
+        EEPROM_READ(gcode.coordinate_system);                  // 27 floats
1095
+      #else
1096
+        for (uint8_t q = 27; q--;) EEPROM_READ(dummy);
1097
+      #endif
1098
+
1012 1099
       if (working_crc == stored_crc) {
1013 1100
         postprocess();
1014 1101
         #if ENABLED(EEPROM_CHITCHAT)

+ 0
- 4
Marlin/src/module/motion.cpp View File

@@ -39,10 +39,6 @@
39 39
   #include "../lcd/ultralcd.h"
40 40
 #endif
41 41
 
42
-// #if ENABLED(DUAL_X_CARRIAGE)
43
-//   #include "tool_change.h"
44
-// #endif
45
-
46 42
 #if HAS_BED_PROBE
47 43
   #include "probe.h"
48 44
 #endif

+ 4
- 24
Marlin/src/module/tool_change.cpp View File

@@ -50,6 +50,10 @@
50 50
   #include "../feature/bedlevel/bedlevel.h"
51 51
 #endif
52 52
 
53
+#if HAS_FANMUX
54
+  #include "../feature/fanmux.h"
55
+#endif
56
+
53 57
 #if ENABLED(SWITCHING_EXTRUDER)
54 58
 
55 59
   #if EXTRUDERS > 3
@@ -109,30 +113,6 @@
109 113
 
110 114
 #endif // PARKING_EXTRUDER
111 115
 
112
-#if HAS_FANMUX
113
-
114
-  void fanmux_switch(const uint8_t e) {
115
-    WRITE(FANMUX0_PIN, TEST(e, 0) ? HIGH : LOW);
116
-    #if PIN_EXISTS(FANMUX1)
117
-      WRITE(FANMUX1_PIN, TEST(e, 1) ? HIGH : LOW);
118
-      #if PIN_EXISTS(FANMUX2)
119
-        WRITE(FANMUX2, TEST(e, 2) ? HIGH : LOW);
120
-      #endif
121
-    #endif
122
-  }
123
-
124
-  FORCE_INLINE void fanmux_init(void){
125
-    SET_OUTPUT(FANMUX0_PIN);
126
-    #if PIN_EXISTS(FANMUX1)
127
-      SET_OUTPUT(FANMUX1_PIN);
128
-      #if PIN_EXISTS(FANMUX2)
129
-        SET_OUTPUT(FANMUX2_PIN);
130
-      #endif
131
-    #endif
132
-    fanmux_switch(0);
133
-  }
134
-
135
-#endif // HAS_FANMUX
136 116
 
137 117
 inline void invalid_extruder_error(const uint8_t e) {
138 118
   SERIAL_ECHO_START();

Loading…
Cancel
Save