@@ -35,8 +35,9 @@ Changelog
35
35
05 Nov 2020 - V1.0.21 : poweron/off for plasma, coolant can be turned on for laser/plasma too
36
36
04 Dec 2020 - V1.0.22 : Add Router11 and dial settings
37
37
16 Jan 2021 - V1.0.23 : Remove end of file marker ' %' from end of output, arcs smaller than toolRadius will be linearized
38
+ 25 Jan 2021 - V1.0.24 : Improve coolant codes
38
39
*/
39
- obversion = ' V1.0.23 ' ;
40
+ obversion = ' V1.0.24 ' ;
40
41
description = " OpenBuilds CNC : GRBL/BlackBox" ; // cannot have brackets in comments
41
42
vendor = " OpenBuilds" ;
42
43
vendorUrl = " https://openbuilds.com" ;
@@ -761,14 +762,6 @@ function onSection() {
761
762
writeBlock(gFormat.format(53), gFormat.format(0), zOutput.format(toPreciseUnit(properties.machineHomeZ, MM)));
762
763
}
763
764
764
- // If the machine has coolant, write M8 or M9
765
- if (properties.hasCoolant) {
766
- if (tool.coolant || isLaser || isPlasma) {
767
- writeBlock(mFormat.format(8));
768
- } else {
769
- writeBlock(mFormat.format(9));
770
- }
771
- }
772
765
773
766
forceXYZ();
774
767
@@ -788,6 +781,15 @@ function onSection() {
788
781
else
789
782
f = " " ;
790
783
writeBlock(gAbsIncModal.format(90 ), gMotionModal.format(0 ), xOutput.format(initialPosition.x), yOutput.format(initialPosition.y), f);
784
+
785
+ // If the machine has coolant, write M8/M7 or M9
786
+ if (properties.hasCoolant) {
787
+ if (isLaser || isPlasma)
788
+ setCoolant(1) // always turn it on since plasma tool has no coolant option in fusion
789
+ else
790
+ setCoolant(tool.coolant); // use tool setting
791
+ }
792
+
791
793
if (isLaser && properties.UseZ)
792
794
writeBlock(gMotionModal.format(0 ), zOutput.format(0 ));
793
795
isNewfile = false;
@@ -965,7 +967,7 @@ function onClose() {
965
967
}
966
968
writeBlock(mFormat.format(5 )); // Stop Spindle
967
969
if (properties.hasCoolant) {
968
- writeBlock(mFormat.format(9) ); // Stop Coolant
970
+ setCoolant(0 ); // Stop Coolant
969
971
}
970
972
// onDwell(properties.spindleOnOffDelay); // Wait for spindle to stop
971
973
gMotionModal.reset();
@@ -1050,4 +1052,31 @@ function round(num,digits) {
1050
1052
function toFixedNumber (num, digits, base) {
1051
1053
var pow = Math.pow(base||10, digits); // cleverness found on web
1052
1054
return Math.round(num*pow) / pow;
1053
- }
1055
+ }
1056
+
1057
+ // set the coolant mode from the tool value
1058
+ function setCoolant (coolval)
1059
+ {
1060
+ //writeComment("setCoolant " + coolval);
1061
+ // 0 if off, 1 is flood, 2 is mist
1062
+ switch(coolval) {
1063
+ case 0:
1064
+ writeBlock(mFormat.format(9)); // off
1065
+ break;
1066
+ case 1:
1067
+ writeBlock(mFormat.format(8)); // flood
1068
+ break;
1069
+ case 2:
1070
+ writeComment("Mist coolant on pin A3. special GRBL compile for this.");
1071
+ writeBlock(mFormat.format(7)); // mist
1072
+ break;
1073
+ case 7: // flood and mist
1074
+ writeBlock(mFormat.format(8)); // flood
1075
+ writeBlock(mFormat.format(7)); // mist
1076
+ break;
1077
+ default:
1078
+ writeComment("Coolant option not understood: " + coolval);
1079
+ alert("Warning", "Coolant option not understood: " + coolval);
1080
+ }
1081
+ }
1082
+
0 commit comments