@@ -77,19 +77,37 @@ let queryOngoing = QUERY_NONE
77
77
function listSDSerialFilesCmd ( ) {
78
78
switch ( currentFilesType ) {
79
79
case "TFTSD" :
80
- return [
81
- "M20 SD:" + currentPath [ currentFilesType ] ,
82
- "Begin file list" ,
83
- "End file list" ,
84
- "error" ,
85
- ]
80
+ if ( esp3dSettings . serialprotocol == "MKS" ) {
81
+ return [
82
+ "M998 1\r\nM20 1:" + currentPath [ currentFilesType ] ,
83
+ "Begin file list" ,
84
+ "End file list" ,
85
+ "error" ,
86
+ ]
87
+ } else {
88
+ return [
89
+ "M20 SD:" + currentPath [ currentFilesType ] ,
90
+ "Begin file list" ,
91
+ "End file list" ,
92
+ "error" ,
93
+ ]
94
+ }
86
95
case "TFTUSB" :
87
- return [
88
- "M20 U:" + currentPath [ currentFilesType ] ,
89
- "Begin file list" ,
90
- "End file list" ,
91
- "error" ,
92
- ]
96
+ if ( esp3dSettings . serialprotocol == "MKS" ) {
97
+ return [
98
+ "M998 0\r\nM20 0:" + currentPath [ currentFilesType ] ,
99
+ "Begin file list" ,
100
+ "End file list" ,
101
+ "error" ,
102
+ ]
103
+ } else {
104
+ return [
105
+ "M20 U:" + currentPath [ currentFilesType ] ,
106
+ "Begin file list" ,
107
+ "End file list" ,
108
+ "error" ,
109
+ ]
110
+ }
93
111
case "TARGETSD" :
94
112
switch ( esp3dSettings . FWTarget ) {
95
113
case "repetier" :
@@ -251,10 +269,15 @@ function consvertStringToFileDescriptor(data, list) {
251
269
if ( name . startsWith ( "/" ) ) {
252
270
name = name . substring ( 1 )
253
271
}
254
- return { name : name , size : size }
272
+ if ( esp3dSettings . serialprotocol == "MKS" && entry . endsWith ( ".DIR" ) ) {
273
+ name = entry . substring ( 0 , entry . length - 4 )
274
+ return { name : name , size : - 1 }
275
+ } else return { name : name , size : size }
255
276
} else {
256
277
if ( esp3dSettings . serialprotocol == "MKS" ) {
257
- if ( entry . endsWith ( ".DIR" ) ) return null
278
+ if ( entry . endsWith ( ".DIR" ) ) {
279
+ return null
280
+ }
258
281
return { name : entry , size : "" }
259
282
}
260
283
pos = entry . lastIndexOf ( " " )
@@ -456,14 +479,14 @@ function processFiles(rawdata) {
456
479
* Check is can create directory
457
480
*/
458
481
function canDelete ( entry ) {
459
- if (
460
- currentFilesType == "SDDirect" ||
461
- currentFilesType == "FS" ||
462
- currentFilesType == "TFTSD" ||
463
- currentFilesType == "TFTUSB"
464
- ) {
482
+ if ( currentFilesType == "SDDirect" || currentFilesType == "FS" ) {
465
483
return true
466
484
}
485
+ if ( currentFilesType == "TFTSD" || currentFilesType == "TFTUSB" ) {
486
+ if ( esp3dSettings . serialprotocol == "MKS" ) return false
487
+ else return true
488
+ }
489
+
467
490
if ( currentFilesType == "TARGETSD" ) {
468
491
switch ( esp3dSettings . FWTarget ) {
469
492
case "repetier" :
@@ -525,6 +548,8 @@ function canUpload() {
525
548
currentFilesType == "FS" ||
526
549
currentFilesType == "SDDirect" ||
527
550
( currentFilesType == "TARGETSD" &&
551
+ esp3dSettings . serialprotocol == "MKS" ) ||
552
+ ( ( currentFilesType == "TFTSD" || currentFilesType == "TFTUSB" ) &&
528
553
esp3dSettings . serialprotocol == "MKS" )
529
554
) {
530
555
return true
@@ -695,7 +720,7 @@ function processCreateDir() {
695
720
696
721
function startJobFile ( source , filename ) {
697
722
console . log ( "print " + filename + " from " + source )
698
- let cmd
723
+ let cmd = ""
699
724
const { dispatch } = useStoreon ( )
700
725
dispatch ( "status/print" , T ( "P63" ) )
701
726
switch ( source ) {
@@ -706,7 +731,11 @@ function startJobFile(source, filename) {
706
731
case "repetier" :
707
732
case "marlin" :
708
733
case "marlinkimbra" :
709
- cmd = "M23 " + filename + "\nM24"
734
+ if ( ( esp3dSettings . serialprotocol == "MKS" ) && ( ( source == "TFTSD" ) || ( source == "TFTUSB" ) ) ) {
735
+ if ( source == "TFTSD" ) cmd = "M998 1\n"
736
+ else cmd = "M998 0\n"
737
+ }
738
+ cmd += "M23 " + filename + "\nM24"
710
739
break
711
740
case "smoothieware" :
712
741
cmd = "play /sd" + filename
@@ -739,12 +768,18 @@ function processPrint(entry) {
739
768
case "TFTSD" :
740
769
path = currentPath [ currentFilesType ]
741
770
if ( ! path . endsWith ( "/" ) ) path += "/"
742
- path += "SD:" + entry . name
771
+ if ( esp3dSettings . serialprotocol != "MKS" ) {
772
+ path += "SD:"
773
+ }
774
+ path += entry . name
743
775
break
744
776
case "TFTUSB" :
745
777
path = currentPath [ currentFilesType ]
746
778
if ( ! path . endsWith ( "/" ) ) path += "/"
747
- path += "U:" + entry . name
779
+ if ( esp3dSettings . serialprotocol != "MKS" ) {
780
+ path += "U:"
781
+ }
782
+ ath += entry . name
748
783
break
749
784
case "TARGETSD" :
750
785
path = currentPath [ currentFilesType ]
@@ -1268,8 +1303,15 @@ function clickUpload() {
1268
1303
document
1269
1304
. getElementById ( "uploadFilesControl" )
1270
1305
. setAttribute ( "multiple" , "false" )
1271
- if ( esp3dSettings . serialprotocol == "MKS" ) pathUpload = "/upload"
1272
- else pathUpload = "/sdfiles"
1306
+ if ( esp3dSettings . serialprotocol == "MKS" ) {
1307
+ if ( currentFilesType == "TFTUSB" ) {
1308
+ pathUpload = "/upload?rpath=USB:"
1309
+ } else if ( currentFilesType == "TFTSD" ) {
1310
+ pathUpload = "/upload?rpath=SD:"
1311
+ } else {
1312
+ pathUpload = "/upload"
1313
+ }
1314
+ } else pathUpload = "/sdfiles"
1273
1315
}
1274
1316
PrepareUpload ( )
1275
1317
}
0 commit comments