diff options
author | David Crocker <dcrocker@eschertech.com> | 2017-08-05 00:21:24 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2017-08-05 00:21:24 +0300 |
commit | 26028ad14932a68da9e0b4e8604fcbc26277a261 (patch) | |
tree | e7de0c8823553ea7c549b06917c3f116e3301656 | |
parent | 2bc5b188399a4fa07244e925d95ef9138aacaee3 (diff) |
Version 1.19RC2
Changed the way we handel tool offsets to (I hope) meet the needs of
both IDEX and conventional dual-nozzle printers
Fixed spurious error message when G92 E0 is processed
Fixed Duet3D filament sensor data receive code
Device driver now supports Alligator board VID/PID
-rw-r--r-- | .cproject | 34 | ||||
-rw-r--r-- | Driver/DuetDriverFiles.zip | bin | 5654 -> 5699 bytes | |||
-rw-r--r-- | Driver/duet.inf | 26 | ||||
-rw-r--r-- | Driver/duetinf.cat | bin | 6648 -> 6730 bytes | |||
-rw-r--r-- | Release/Duet-0.6-0.8.5/Edge/RepRapFirmware-1.19RC2.bin | bin | 0 -> 341252 bytes | |||
-rw-r--r-- | Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.19RC2.bin | bin | 0 -> 322188 bytes | |||
-rw-r--r-- | Release/Duet-WiFi/Edge/DuetWiFiFirmware-1.19RC2.bin | bin | 0 -> 325652 bytes | |||
-rw-r--r-- | Release/RADDS/Edge/RepRapFirmware-RADDS-1.19RC2.bin | bin | 0 -> 270908 bytes | |||
-rw-r--r-- | src/FilamentSensors/Duet3DFilamentSensor.cpp | 10 | ||||
-rw-r--r-- | src/FilamentSensors/Duet3DFilamentSensor.h | 1 | ||||
-rw-r--r-- | src/GCodes/GCodes.cpp | 55 | ||||
-rw-r--r-- | src/GCodes/GCodes.h | 1 | ||||
-rw-r--r-- | src/GCodes/GCodes2.cpp | 3 | ||||
-rw-r--r-- | src/Version.h | 4 |
14 files changed, 71 insertions, 63 deletions
@@ -520,7 +520,7 @@ <configuration artifactExtension="elf" artifactName="${ProjName}-Alligator" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1745168887" name="Alligator" parent="cdt.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary file" postbuildStep="arm-none-eabi-objcopy -O binary ${workspace_loc:/${ProjName}/${ConfigName}}/${ProjName}-Alligator.elf ${workspace_loc:/${ProjName}/${ConfigName}}/${ProjName}-Alligator.bin"> <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1745168887." name="/" resourcePath=""> <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.623324432" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release"> - <option id="cdt.managedbuild.option.gnu.cross.path.645044151" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" useByScannerDiscovery="false" value="/Users/marcoantonini/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin" valueType="string"/> + <option id="cdt.managedbuild.option.gnu.cross.path.645044151" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" useByScannerDiscovery="false" value="C:\Arduino-1.5.8\hardware\tools\gcc-arm-none-eabi-4.8.3-2014q1\bin" valueType="string"/> <option id="cdt.managedbuild.option.gnu.cross.prefix.629438941" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" useByScannerDiscovery="false" value="arm-none-eabi-" valueType="string"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.878309876" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/> <builder buildPath="${workspace_loc:/RepRapFirmware}/Release" id="cdt.managedbuild.builder.gnu.cross.56178753" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/> @@ -557,12 +557,12 @@ <listOptionValue builtIn="false" value="printf=iprintf"/> </option> <option id="gnu.c.compiler.option.dialect.std.1020546177" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> - <option id="gnu.c.compiler.option.include.files.1091766282" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles"/> + <option id="gnu.c.compiler.option.include.files.1091766282" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1737201945" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1510685625" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/> <tool id="cdt.managedbuild.tool.gnu.cross.archiver.2031955379" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/> - <tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${LINK_FLAGS_1} "${workspace_loc:/${CoreName}/SAM3X8E/cores/arduino/syscalls.o}" ${INPUTS} ${LINK_FLAGS_2}" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1616069436" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"> + <tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${LINK_FLAGS_1} "${workspace_loc:/${CoreName}/Alligator/cores/arduino/syscalls.o}" ${INPUTS} ${LINK_FLAGS_2}" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1616069436" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"> <option id="gnu.cpp.link.option.nostdlibs.760089516" name="No startup or default libs (-nostdlib)" superClass="gnu.cpp.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/> <option id="gnu.cpp.link.option.paths.1593340130" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths"> <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/Alligator/}""/> @@ -613,9 +613,9 @@ <listOptionValue builtIn="false" value="__ALLIGATOR__"/> <listOptionValue builtIn="false" value="printf=iprintf"/> </option> - <option id="gnu.cpp.compiler.option.preprocessor.undef.913409309" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef" useByScannerDiscovery="false" valueType="undefDefinedSymbols"/> + <option id="gnu.cpp.compiler.option.preprocessor.undef.913409309" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef" useByScannerDiscovery="false"/> <option id="gnu.cpp.compiler.option.dialect.std.603621474" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.include.files.1575937801" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles"/> + <option id="gnu.cpp.compiler.option.include.files.1575937801" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files" useByScannerDiscovery="false"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.667323948" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> </tool> </toolChain> @@ -645,35 +645,11 @@ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> <storageModule moduleId="scannerConfiguration"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1806370384;cdt.managedbuild.tool.gnu.cpp.compiler.input.2135034744"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290.;cdt.managedbuild.tool.gnu.cross.c.compiler.1431507147;cdt.managedbuild.tool.gnu.c.compiler.input.786131774"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201;cdt.managedbuild.config.gnu.cross.exe.release.516195201.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1703390221;cdt.managedbuild.tool.gnu.cpp.compiler.input.111814721"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/> </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1027429289;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1027429289.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.2077096750;cdt.managedbuild.tool.gnu.cpp.compiler.input.1578939493"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1745168887;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1745168887.;cdt.managedbuild.tool.gnu.cross.c.compiler.429394189;cdt.managedbuild.tool.gnu.c.compiler.input.1737201945"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201;cdt.managedbuild.config.gnu.cross.exe.release.516195201.;cdt.managedbuild.tool.gnu.cross.c.compiler.220085372;cdt.managedbuild.tool.gnu.c.compiler.input.1345445195"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1027429289;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1027429289.;cdt.managedbuild.tool.gnu.cross.c.compiler.764246283;cdt.managedbuild.tool.gnu.c.compiler.input.110609707"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1745168887;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.1745168887.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1533537470;cdt.managedbuild.tool.gnu.cpp.compiler.input.667323948"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1261470824;cdt.managedbuild.tool.gnu.cpp.compiler.input.948285998"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> - <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850;cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.;cdt.managedbuild.tool.gnu.cross.c.compiler.278237460;cdt.managedbuild.tool.gnu.c.compiler.input.1642892736"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - </scannerConfigBuildInfo> </storageModule> </cproject> diff --git a/Driver/DuetDriverFiles.zip b/Driver/DuetDriverFiles.zip Binary files differindex 48fe36b5..357faa7b 100644 --- a/Driver/DuetDriverFiles.zip +++ b/Driver/DuetDriverFiles.zip diff --git a/Driver/duet.inf b/Driver/duet.inf index d956dcbb..a8a34112 100644 --- a/Driver/duet.inf +++ b/Driver/duet.inf @@ -5,7 +5,8 @@ Provider = "Escher 3D" DriverPackageDisplayName = "Duet3D USB driver"
DUET = "Duet 3D printer control electronics with pre-1.18 firmware"
DUET06 = "Duet 06 or 085 3D printer control electronics"
-DUETNG = "Duet WiFi or Ethernet 3D printer control electronics"
+ALLIGATOR = "Alligator 3D printer control electronics"
+DUETNG = "Duet WiFi or Duet Ethernet 3D printer control electronics"
Serial.SvcDesc = "USB Serial emulation driver"
BOSSAPORT = "Bossa Program Port"
@@ -19,7 +20,7 @@ ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318} DriverPackageDisplayName = %DriverPackageDisplayName%
Provider = %Provider%
CatalogFile = duetinf.cat
-DriverVer = 04/09/2017,1.18.1.0 ; date in US format
+DriverVer = 08/04/2017,1.19.0.0 ; date in US format
[Manufacturer]
%Provider% = DeviceList, NTAMD64, NT
@@ -30,21 +31,24 @@ FakeModemCopyFileSection = 12 [DeviceList]
%BOSSAPORT% = DriverInstall, USB\VID_03EB&PID_6124
-%DUET% = DriverInstall, USB\VID_03EB&PID_2404
-%DUET06% = DriverInstall, USB\VID_1209&PID_D3D8
-%DUETNG% = DriverInstall, USB\VID_1D50&PID_60EC
+%DUET% = DriverInstall, USB\VID_03EB&PID_2404
+%DUET06% = DriverInstall, USB\VID_1209&PID_D3D8
+%ALLIGATOR% = DriverInstall, USB\VID_1209&PID_AB3D
+%DUETNG% = DriverInstall, USB\VID_1D50&PID_60EC
[DeviceList.NTAMD64]
%BOSSAPORT% = DriverInstall, USB\VID_03EB&PID_6124
-%DUET% = DriverInstall.NTamd64, USB\VID_03EB&PID_2404
-%DUET06% = DriverInstall.NTamd64, USB\VID_1209&PID_D3D8
-%DUETNG% = DriverInstall.NTamd64, USB\VID_1D50&PID_60EC
+%DUET% = DriverInstall.NTamd64, USB\VID_03EB&PID_2404
+%DUET06% = DriverInstall.NTamd64, USB\VID_1209&PID_D3D8
+%ALLIGATOR% = DriverInstall.NTamd64, USB\VID_1209&PID_AB3D
+%DUETNG% = DriverInstall.NTamd64, USB\VID_1D50&PID_60EC
[DeviceList.NT]
%BOSSAPORT% = DriverInstall, USB\VID_03EB&PID_6124
-%DUET% = DriverInstall.NT, USB\VID_03EB&PID_2404
-%DUET06% = DriverInstall.NT, USB\VID_1209&PID_D3D8
-%DUETNG% = DriverInstall.NT, USB\VID_1D50&PID_60EC
+%DUET% = DriverInstall.NT, USB\VID_03EB&PID_2404
+%DUET06% = DriverInstall.NT, USB\VID_1209&PID_D3D8
+%ALLIGATOR% = DriverInstall.NT, USB\VID_1209&PID_AB3D
+%DUETNG% = DriverInstall.NT, USB\VID_1D50&PID_60EC
;------------------------------------------------------------
; Windows XP, Vista, Windows 7, Windows 8, Windows 10 - 32bit
diff --git a/Driver/duetinf.cat b/Driver/duetinf.cat Binary files differindex e2d2abae..cc71f5bf 100644 --- a/Driver/duetinf.cat +++ b/Driver/duetinf.cat diff --git a/Release/Duet-0.6-0.8.5/Edge/RepRapFirmware-1.19RC2.bin b/Release/Duet-0.6-0.8.5/Edge/RepRapFirmware-1.19RC2.bin Binary files differnew file mode 100644 index 00000000..ec47de6f --- /dev/null +++ b/Release/Duet-0.6-0.8.5/Edge/RepRapFirmware-1.19RC2.bin diff --git a/Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.19RC2.bin b/Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.19RC2.bin Binary files differnew file mode 100644 index 00000000..8636f841 --- /dev/null +++ b/Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.19RC2.bin diff --git a/Release/Duet-WiFi/Edge/DuetWiFiFirmware-1.19RC2.bin b/Release/Duet-WiFi/Edge/DuetWiFiFirmware-1.19RC2.bin Binary files differnew file mode 100644 index 00000000..6dbe8cdd --- /dev/null +++ b/Release/Duet-WiFi/Edge/DuetWiFiFirmware-1.19RC2.bin diff --git a/Release/RADDS/Edge/RepRapFirmware-RADDS-1.19RC2.bin b/Release/RADDS/Edge/RepRapFirmware-RADDS-1.19RC2.bin Binary files differnew file mode 100644 index 00000000..e827652a --- /dev/null +++ b/Release/RADDS/Edge/RepRapFirmware-RADDS-1.19RC2.bin diff --git a/src/FilamentSensors/Duet3DFilamentSensor.cpp b/src/FilamentSensors/Duet3DFilamentSensor.cpp index 091e47ca..a9362b47 100644 --- a/src/FilamentSensors/Duet3DFilamentSensor.cpp +++ b/src/FilamentSensors/Duet3DFilamentSensor.cpp @@ -71,7 +71,7 @@ void Duet3DFilamentSensor::Poll() static const uint32_t NominalBitLength = DDA::stepClockRate/BitsPerSecond; static const uint32_t MinBitLength = (NominalBitLength * 10)/13; // allow 30% clock speed tolerance static const uint32_t MaxBitLength = (NominalBitLength * 13)/10; // allow 30% clock speed tolerance - static const uint32_t ErrorRecoveryDelayBits = 25; // after an error we wait for the line to be low for this long + static const uint32_t ErrorRecoveryDelayBits = 12; // after an error we wait for the line to be low for this long static const uint32_t ErrorRecoveryTime = NominalBitLength * ErrorRecoveryDelayBits; const size_t numEdgesCaptured = numberOfEdgesCaptured; // capture volatile variable @@ -107,10 +107,10 @@ void Duet3DFilamentSensor::Poll() uint8_t currentNibble = 0; for (uint8_t numBits = 0; numBits < 5; ++numBits) { - if (bitChangeIndex < numEdgesCaptured && edgeCaptures[bitChangeIndex] - edgeCaptures[1] < samplePoint) + if (bitChangeIndex < numEdgesCaptured && edgeCaptures[bitChangeIndex] - nibbleStartTime < samplePoint) { ++bitChangeIndex; - if (bitChangeIndex < numEdgesCaptured && edgeCaptures[bitChangeIndex] - edgeCaptures[1] < samplePoint) + if (bitChangeIndex < numEdgesCaptured && edgeCaptures[bitChangeIndex] - nibbleStartTime < samplePoint) { state = RxdState::errorRecovery; // there should be at most 1 transition per bit return; @@ -184,7 +184,9 @@ void Duet3DFilamentSensor::Diagnostics(MessageType mtype, unsigned int extruder) : ((sensorValue & ErrorBit) != 0) ? "error" : (withSwitch && (sensorValue & SwitchOpenBit) != 0) ? "no filament" : "ok"; - reprap.GetPlatform().MessageF(mtype, "Extruder %u sensor: angle %u, %s\n", extruder, sensorValue, statusText); + // The sensor angle + const float sensorAngle = (sensorValue & AngleMask) * (360.0/1024.0); + reprap.GetPlatform().MessageF(mtype, "Extruder %u sensor: angle %.1f, %s\n", extruder, sensorAngle, statusText); } // End diff --git a/src/FilamentSensors/Duet3DFilamentSensor.h b/src/FilamentSensors/Duet3DFilamentSensor.h index 8e6fb9ca..723e78a3 100644 --- a/src/FilamentSensors/Duet3DFilamentSensor.h +++ b/src/FilamentSensors/Duet3DFilamentSensor.h @@ -27,6 +27,7 @@ private: static constexpr uint16_t SwitchOpenBit = 0x4000u; static constexpr uint16_t ErrorBit = 0x8000u; + static constexpr uint16_t AngleMask = 0x03FF; // 10-bit sensor angle float mmPerRev; float tolerance; diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index afaba613..72cb39b3 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -364,6 +364,8 @@ void GCodes::Spin() case GCodeState::m109ToolChange0: // Run tfree for the old tool (if any) doingToolChange = true; SaveFanSpeeds(); + memcpy(toolChangeRestorePoint.moveCoords, currentUserPosition, ARRAY_SIZE(currentUserPosition) * sizeof(currentUserPosition[0])); + toolChangeRestorePoint.feedRate = gb.MachineState().feedrate; gb.AdvanceState(); if ((toolChangeParam & TFreeBit) != 0) { @@ -378,6 +380,7 @@ void GCodes::Spin() case GCodeState::toolChange1: // Release the old tool (if any), then run tpre for the new tool case GCodeState::m109ToolChange1: // Release the old tool (if any), then run tpre for the new tool + toolChangeMappedAxes = reprap.GetCurrentYAxes() | reprap.GetCurrentYAxes(); { const Tool * const oldTool = reprap.GetCurrentTool(); if (oldTool != nullptr) @@ -396,6 +399,15 @@ void GCodes::Spin() case GCodeState::toolChange2: // Select the new tool (even if it doesn't exist - that just deselects all tools) and run tpost case GCodeState::m109ToolChange2: // Select the new tool (even if it doesn't exist - that just deselects all tools) and run tpost reprap.SelectTool(newToolNumber); + toolChangeMappedAxes |= reprap.GetCurrentXAxes() | reprap.GetCurrentYAxes(); + toolChangeMappedAxes &= ~LowestNBits<AxesBitmap>(Z_AXIS); // remove XYZ axes + + // The user position reflects the position of the old tool, but on an IDEX machine the new tool is at a different place + // So adjust the current user position to reflect the actual position of the tool so that commands in tpost.g work properly. + // By itself this would cause the tool offset (in particular, the Z offset) to be incorrect after the tool change, + // however we will restore the original user coordinates later. + ToolOffsetInverseTransform(moveBuffer.coords, currentUserPosition); + gb.AdvanceState(); if (AllAxesAreHomed()) { @@ -408,22 +420,36 @@ void GCodes::Spin() break; case GCodeState::toolChangeComplete: - doingToolChange = false; - gb.SetState(GCodeState::normal); - break; - case GCodeState::m109ToolChangeComplete: + // Restore the desired user position + for (size_t axis = 0; axis < MaxAxes; ++axis) + { + if (!IsBitSet(toolChangeMappedAxes, axis)) + { + currentUserPosition[axis] = toolChangeRestorePoint.moveCoords[axis]; + } + } + gb.MachineState().feedrate = toolChangeRestorePoint.feedRate; + // We don't restore the default fan speed in case the user wants to use a different one for the new tool doingToolChange = false; - UnlockAll(gb); // allow movement again - if (cancelWait || ToolHeatersAtSetTemperatures(reprap.GetCurrentTool(), gb.MachineState().waitWhileCooling)) + + if (gb.GetState() == GCodeState::toolChangeComplete) { - cancelWait = isWaiting = false; gb.SetState(GCodeState::normal); } else { - CheckReportDue(gb, reply); - isWaiting = true; + UnlockAll(gb); // allow movement again + if (cancelWait || ToolHeatersAtSetTemperatures(reprap.GetCurrentTool(), gb.MachineState().waitWhileCooling)) + { + cancelWait = isWaiting = false; + gb.SetState(GCodeState::normal); + } + else + { + CheckReportDue(gb, reply); + isWaiting = true; + } } break; @@ -1693,9 +1719,9 @@ bool GCodes::LoadExtrusionAndFeedrateFromGCode(GCodeBuffer& gb, int moveType) size_t mc = eMoveCount; gb.GetFloatArray(eMovement, mc, false); - if (mc == 1 && eMoveCount > 1) + if (mc == 1) { - // There are multiple extruders present but only one value has been specified, so use mixing + // There may be multiple extruders present but only one value has been specified, so use mixing const float moveArg = eMovement[0] * distanceScale; float requestedExtrusionAmount; if (gb.MachineState().drivesRelative) @@ -1722,7 +1748,7 @@ bool GCodes::LoadExtrusionAndFeedrateFromGCode(GCodeBuffer& gb, int moveType) } else { - // Either there is only one extruder associated with this tool, or individual extrusion amounts have been provided + // Individual extrusion amounts have been provided for (size_t eDrive = 0; eDrive < eMoveCount; eDrive++) { const int drive = tool->Drive(eDrive); @@ -2220,10 +2246,11 @@ bool GCodes::SetPositions(GCodeBuffer& gb) float eMovement[MaxExtruders]; size_t mc = eMoveCount; gb.GetFloatArray(eMovement, mc, false); - if (mc == 1 && eMoveCount > 1) + if (mc == 1) { // The tool has multiple extruders, but only one position was given. Treat it as the mix position. - tool->virtualExtruderPosition = gb.GetFValue() * distanceScale; + tool->virtualExtruderPosition = eMovement[0] * distanceScale; + lastRawExtruderPosition[tool->Drive(0)] = eMovement[0] * distanceScale; } else { diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h index b7561f19..22a6800a 100644 --- a/src/GCodes/GCodes.h +++ b/src/GCodes/GCodes.h @@ -342,6 +342,7 @@ private: int oldToolNumber, newToolNumber; // Tools being changed int toolChangeParam; // Bitmap of all the macros to be run during a tool change + AxesBitmap toolChangeMappedAxes; // Axes that X or Y were mapped tp in either the old or the new tool const char* eofString; // What's at the end of an HTML file? uint8_t eofStringCounter; // Check the... diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index 168e2843..5faa0003 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -3986,9 +3986,6 @@ bool GCodes::HandleTcode(GCodeBuffer& gb, StringRef& reply) newToolNumber = gb.GetIValue(); newToolNumber += gb.GetToolNumberAdjust(); - reprap.GetMove().GetCurrentUserPosition(toolChangeRestorePoint.moveCoords, 0, reprap.GetCurrentXAxes(), reprap.GetCurrentYAxes()); - toolChangeRestorePoint.feedRate = gb.MachineState().feedrate; - if (simulationMode == 0) // we don't yet simulate any T codes { const Tool * const oldTool = reprap.GetCurrentTool(); diff --git a/src/Version.h b/src/Version.h index b9a3984d..0b2d4276 100644 --- a/src/Version.h +++ b/src/Version.h @@ -9,11 +9,11 @@ #define SRC_VERSION_H_ #ifndef VERSION -# define VERSION "1.19RC1" +# define VERSION "1.19RC2" #endif #ifndef DATE -# define DATE "2017-08-03" +# define DATE "2017-08-04" #endif #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman" |